Class NavBarController

java.lang.Object
com.example.cab302project.NavBarController

public class NavBarController extends Object
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 Details

    • NavBarController

      public NavBarController()
  • Method Details

    • onMap

      public void onMap()
      Navigates to the map screen. Routes to police-dashboard-view.fxml for police users, or dashboard-view.fxml for regular users.
    • onCrimes

      public void onCrimes()
      Navigates to the crimes / reports screen. Routes to Police-crimes-view.fxml for police users, or crimes-view.fxml for regular users.
    • onProfile

      public void onProfile()
      Navigates to the user profile screen. Both user types share the same profile view.
    • setActiveTab

      public void setActiveTab(String tab)
      Marks the specified tab as active by applying the active label style and recolouring its FontIcon to the primary navy colour. Should be called from the host screen's initialize() 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"