Class ScreenManager

java.lang.Object
megalodonte.base.route.ScreenManager

public final class ScreenManager extends Object
Screen lifecycle manager owned by megalodonte-base. Tracks the active screen per stage and the spawned windows, owning the shared mount/destroy logic so that both the router (navigation) and ScreenContextBase (window spawning) tear down screens the same way (scope cancel + onDestroy).
  • Constructor Details

    • ScreenManager

      public ScreenManager(RouteTable table)
  • Method Details

    • resolve

      public RouteTable.ResolvedRoute resolve(String path)
    • mount

      public RouteResult mount(javafx.stage.Stage stage, Route route, Map<String,String> params, RouterBase router)
      Mounts a screen on the given stage, destroying any previously active screen on that stage. Calls onMount() before returning.
      Parameters:
      stage - the stage to host the screen (may be a brand-new spawned window)
      Returns:
      the mounted view and its route props
    • registerSpawned

      public void registerSpawned(javafx.stage.Stage stage)
      Registers a window spawned via ScreenContextBase.spawnWindow(String).
    • destroy

      public void destroy(javafx.stage.Stage stage)
      Removes a spawned window from tracking and destroys its active screen. Does not close the stage (used when the user closes the window).
    • closeAllSpawned

      public void closeAllSpawned()
      Destroys every spawned window's screen and closes its stage.