Class NavigationService

java.lang.Object
no.ntnu.principes.service.NavigationService

public class NavigationService extends Object
Provides application-wide navigation capabilities using an event-based approach. Centralizes screen transitions, modal dialogs, and navigation history management without requiring direct references to UI controllers.
  • Method Details

    • closeScreen

      public static void closeScreen(String route)
      Closes a specific screen by its route name. Removes the screen from the navigation stack.
      Parameters:
      route - The route name of the screen to close
    • openModal

      public static void openModal(String route, String callBackId)
      Opens a modal dialog over the current screen.
      Parameters:
      route - The route name of the modal to open
      callBackId - An identifier to associate with modal results
    • closeModal

      public static void closeModal(String modalId, ModalResult result)
      Closes a modal dialog with a result. The result can be processed by screens that are waiting for modal feedback.
      Parameters:
      modalId - The ID of the modal to close
      result - The result to return from the modal
    • clear

      public static void clear(UUID stageId)
      Clears the entire navigation stack for a stage. Removes all screens and returns to the initial state.
      Parameters:
      stageId - The ID of the stage to clear
    • back

      public static void back()
      Navigates back to the previous screen. Removes the current screen from the navigation stack.