Class LeftPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class LeftPanel extends JPanel
Custom JPanel that serves as the left panel of the application, containing various sub-panels for searching, preferences, statistics, and settings.
Author:
Riccardo Finocchiaro, Samuele Lombardi
See Also:
  • Constructor Details

  • Method Details

    • updateModularPanel

      public void updateModularPanel(JPanel panel, boolean isVisible)
      Updates the modular panel to display the specified panel. If the panel is set to be visible, it will be added to the modular panel. Otherwise, it will be hidden.
      Parameters:
      panel - The panel to display in the modular area.
      isVisible - Whether the panel should be visible or not.
    • getSearchPanel

      public SearchPanel getSearchPanel()
      Returns the SearchPanel instance contained in this LeftPanel.
      Returns:
      The SearchPanel instance.
    • getButtonPanel

      public ButtonPanel getButtonPanel()
      Returns the PreferPanel instance contained in this LeftPanel.
      Returns:
      The PreferPanel instance.
    • setRealtimeStatus

      public void setRealtimeStatus(RealtimeStatus status)
    • setTableRowClickBehaviour

      public void setTableRowClickBehaviour(TableRowClickBehaviour listener)
      Sets the click behaviour for table rows in both the search and prefer panels.
      Parameters:
      listener - The listener to handle table row clicks.
    • setButtonPanelGeneralBehaviour

      public void setButtonPanelGeneralBehaviour(ButtonPanelBehaviour listener)
      Sets the button panel general behaviour.
      Parameters:
      listener - The listener to handle button panel actions.
    • setButtonPanelPreferBehaviour

      public void setButtonPanelPreferBehaviour(ButtonPanelBehaviour listener)
      Sets the button panel preference behaviour.
      Parameters:
      listener - The listener to handle button panel preference actions.
    • setLogoutBehaviour

      public void setLogoutBehaviour(LogoutBehaviour behaviour)
      Sets the logout behaviour for the settings panel.
      Parameters:
      behaviour - The logout behaviour to set.
    • setRealtimeSwitchListener

      public void setRealtimeSwitchListener(SwitchBarListener listener)
      Sets the listener for the realtime switch in the settings panel.
      Parameters:
      listener - The listener to handle realtime switch events.
    • updateFavStopTable

      public void updateFavStopTable(StopModel stop, UpdateMode updateMode)
      Updates the favorite stop table in the prefer panel with the specified stop and update mode.
      Parameters:
      stop - The stop to update in the table.
      updateMode - The mode of update (ADD or REMOVE).
    • updateFavRouteTable

      public void updateFavRouteTable(List<RouteDirection> route, UpdateMode updateMode)
      Updates the favorite route table in the prefer panel with the specified route and update mode.
      Parameters:
      route - The route to update in the table.
      updateMode - The mode of update (ADD or REMOVE).
    • initPreferPanelPreferTable

      public void initPreferPanelPreferTable(List<StopModel> stops, List<RouteDirection> routes)
      Initializes the prefer panel's table with the provided stops and routes.
      Parameters:
      stops - The list of stops to initialize in the prefer table.
      routes - The list of route directions to initialize in the prefer table.
    • setSearchPanelListener

      public void setSearchPanelListener(SearchBarListener listener)
      Sets the listener for search events in the search panel.
      Parameters:
      listener - The listener to handle search events.
    • setPreferPanelListener

      public void setPreferPanelListener(SearchBarListener listener)
      Sets the listener for search events in the prefer panel.
      Parameters:
      listener - The listener to handle search events.
    • setupStatisticsPanel

      public void setupStatisticsPanel(RealtimeGtfsService realtimeService, Map<RealtimeMetricType,List<RealtimeMetricModel>> metricsMap, MetricCollector collector)
      Sets up the statistics panel with the provided realtime service and database service.
      Parameters:
      realtimeService - The realtime GTFS service to use for statistics.
      metricsMap - A map of realtime metric types to their corresponding metric models.
      collector - The metric collector to gather and process metrics.
    • clearPreferPanelTable

      public void clearPreferPanelTable()
      Clears the tables in the prefer panel.
    • initPreferTable

      public void initPreferTable(List<StopModel> favoriteStops, List<RouteDirection> favoriteRoutes)
      Initializes the prefer panel's table with the provided favorite stops and routes.
      Parameters:
      favoriteStops - The list of favorite stops to initialize in the prefer table.
      favoriteRoutes - The list of favorite route directions to initialize in the prefer table.
    • renderSearchPanel

      public void renderSearchPanel(List<StopModel> stops, List<RouteDirection> routes)
      Updates the search panel with the provided list of stops and routes.
      Parameters:
      stops - The list of stops to display in the search panel.
      routes - The list of route directions to display in the search panel.