java.lang.Object
com.example.cab302project.NavBarController
Controller for the shared bottom navigation bar (nav-bar.fxml).
This controller is embedded in all main screens via
<fx:include>.
It provides three navigation buttons — Map, Reports, and Profile — each
routing to the appropriate screen based on whether the logged-in user is
a regular user or a police officer. Call setActiveTab(String) from
the host screen's initialize() method to highlight the current tab.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidonCrimes()Navigates to the crimes / reports screen.voidonMap()Navigates to the map screen.voidNavigates to the user profile screen.voidsetActiveTab(String tab) Marks the specified tab as active by applying the active label style and recolouring itsFontIconto the primary navy colour.
-
Constructor Details
-
NavBarController
public NavBarController()
-
-
Method Details
-
onMap
public void onMap()Navigates to the map screen. Routes topolice-dashboard-view.fxmlfor police users, ordashboard-view.fxmlfor regular users. -
onCrimes
public void onCrimes()Navigates to the crimes / reports screen. Routes toPolice-crimes-view.fxmlfor police users, orcrimes-view.fxmlfor regular users. -
onProfile
public void onProfile()Navigates to the user profile screen. Both user types share the same profile view. -
setActiveTab
Marks the specified tab as active by applying the active label style and recolouring itsFontIconto the primary navy colour. Should be called from the host screen'sinitialize()method so the correct tab is highlighted when the screen loads.- Parameters:
tab- the tab to activate; must be one of"map","crimes", or"profile"
-