java.lang.Object
stud.ntnu.idatt1005.pantrypal.controllers.Controller
Direct Known Subclasses:
AddRecipeController, CookbookController, HomeController, LogInController, PantryController, ShoppingListController

public class Controller extends Object
The Root controller class for the application. This class is responsible for handling the logic for that all controllers use. This is logIn and logOut functionality and navigation between different views.
  • Field Details

    • viewManager

      public final ViewManager viewManager
      The view manager for the application.
  • Constructor Details

    • Controller

      public Controller(ViewManager viewManager)
      Creates an instance of the controller, and sets the viewManager.
      Parameters:
      viewManager - The view manager for the application
  • Method Details

    • onNavLinkPress

      public void onNavLinkPress(Route route)
      Navigates to the view the given route represents.
      Parameters:
      route - The route to navigate to
    • isLoggedIn

      public boolean isLoggedIn()
      Checks if the user is logged in.
      Returns:
      true if the user is logged in, false otherwise
    • logOut

      public void logOut()
      Logs out the user and navigates to the reloads the initial application, without login.