Package com.nnamo.controllers
Class MainController
java.lang.Object
com.nnamo.controllers.MainController
Main controller that manages the overall application flow.
It coordinates between the user, map, UI, and real-time controllers,
handles user sessions, and initializes the main application frame.
It also sets up listeners for search and preference panels, and manages
real-time data updates.
- Author:
- Samuele Lombardi, Riccardo Finocchiaro, Davide Galilei
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates aSearchBarListener
that handles search queries for the prefer panel.Creates aSearchBarListener
that handles search queries for the search panel.void
run()
Initialize the view and runs all the sub-controllersvoid
setLocalMapCache
(File cacheDir) Sets the local tiles cache from a directory
-
Constructor Details
-
MainController
- Parameters:
db
-realtimeService
-- Throws:
IOException
-
-
Method Details
-
run
Initialize the view and runs all the sub-controllers- Throws:
IOException
InterruptedException
SQLException
- See Also:
-
setLocalMapCache
Sets the local tiles cache from a directory- Parameters:
cacheDir
- Where the cache is located
-
createSearchPanelQueryBehavior
Creates aSearchBarListener
that handles search queries for the search panel. It uses caching to store previously fetched results for stops and routes to improve performance on repeated searches. When a search is performed, it checks the cache first before querying the database. The results are then rendered in the search panel of the main frame.- Returns:
- a
SearchBarListener
for handling search queries in the search panel - See Also:
-
createPreferPanelQueryBehavior
Creates aSearchBarListener
that handles search queries for the prefer panel. It fetches favorite stops and routes for the logged-in user based on the search text. The results are then displayed in the prefer panel of the main frame. This listener does not use caching since favorite items are user-specific and may change frequently.- Returns:
- a
SearchBarListener
for handling search queries in the prefer panel - See Also:
-