java.lang.Object
stud.ntnu.idatt1005.pantrypal.utils.ViewManager

public class ViewManager extends Object
The ViewManager class is responsible for managing the views in the application. It keeps track of the views and provides methods for adding, removing, and setting views.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final javafx.stage.Stage
     
    private final EnumMap<Route,javafx.scene.Scene>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ViewManager(javafx.stage.Stage stage)
    Constructs a new ViewManager with a given stage.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addView(Route route, javafx.scene.Scene view)
    Adds a view to the view manager.
    Gets the current view of the application.
    void
    Initializes the controllers and views for the application.
    void
    Removes a view from the view manager.
    void
    setView(Route route)
    Sets the view of the application to a given route.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • stage

      private final javafx.stage.Stage stage
    • views

      private final EnumMap<Route,javafx.scene.Scene> views
  • Constructor Details

    • ViewManager

      public ViewManager(javafx.stage.Stage stage)
      Constructs a new ViewManager with a given stage.
      Parameters:
      stage - The stage for the application.
  • Method Details

    • init

      public void init()
      Initializes the controllers and views for the application.
    • addView

      public void addView(Route route, javafx.scene.Scene view)
      Adds a view to the view manager.
      Parameters:
      route - The route of the view.
      view - The view to add.
    • removeView

      public void removeView(Route route)
      Removes a view from the view manager.
      Parameters:
      route - The route of the view to remove.
    • setView

      public void setView(Route route)
      Sets the view of the application to a given route.
      Parameters:
      route - The route of the view to set.
    • getCurrentView

      public Route getCurrentView()
      Gets the current view of the application.
      Returns:
      The current view.