Interface StackNavigable

All Known Implementing Classes:
AdminDashboardController, AdminUsersManagmentController, LoginController, ResetPasswordController, RootController, UserHomeController

public interface StackNavigable
Provides stack-based navigation (push, replace, pop) for controllers that manage content within a StackPane.

Implementing controllers can use this interface to dynamically load and swap FXML views in a StackPane without tightly coupling to the root layout.

Example usage:

controller.setStackHost(rootStackPane);
controller.push("some-view.fxml");
controller.pop();
Since:
2026-02-21
Version:
1.0
Author:
@ZouariOmar (zouariomar20@gmail.com)
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.scene.layout.StackPane
    Returns the StackPane hosting dynamic views.
    default void
    pop()
    Pop the top view from the stack and restore the stage title of the view now on top (if it implements StageTitled).
    default <T> void
    push(String fxml)
    Pushes a new FXML view without a controller initializer.
    default <T> void
    push(String fxml, Consumer<T> controllerInitializer)
    Push a new FXML view onto the stack.
    default void
    Replace the current view with a new FXML.
    default <T> void
    replace(String fxml, Consumer<T> controllerInitializer)
    Replace the current view with a new FXML.
    default void
    setStackHost(javafx.scene.layout.StackPane host)
    Injects the StackPane host.
    default void
    Injects the status message provider.
  • Method Details

    • getStackHost

      javafx.scene.layout.StackPane getStackHost()
      Returns the StackPane hosting dynamic views.
      Returns:
      the stack host that contains dynamic views
    • setStackHost

      default void setStackHost(javafx.scene.layout.StackPane host)
      Injects the StackPane host.
      Parameters:
      host - stack host used for navigation
    • setStatusProvider

      default void setStatusProvider(StatusMessageProvider provider)
      Injects the status message provider.
      Parameters:
      provider - provider used to display status messages
    • push

      default <T> void push(String fxml, Consumer<T> controllerInitializer)
      Push a new FXML view onto the stack.
      Type Parameters:
      T - type of controller
      Parameters:
      fxml - path to FXML
      controllerInitializer - callback used to initialize controller state
    • push

      default <T> void push(String fxml)
      Pushes a new FXML view without a controller initializer.
      Type Parameters:
      T - type of controller
      Parameters:
      fxml - path to FXML
    • replace

      default void replace(String fxml)
      Replace the current view with a new FXML.
      Parameters:
      fxml - path to FXML
    • replace

      default <T> void replace(String fxml, Consumer<T> controllerInitializer)
      Replace the current view with a new FXML.
      Type Parameters:
      T - type of controller
      Parameters:
      fxml - path to FXML
      controllerInitializer - callback used to initialize controller state
    • pop

      default void pop()
      Pop the top view from the stack and restore the stage title of the view now on top (if it implements StageTitled).