Class ScreenContextBase

java.lang.Object
megalodonte.base.route.v2.ScreenContextBase
All Implemented Interfaces:
ScreenContextInterface

public class ScreenContextBase extends Object implements ScreenContextInterface
Screen-level context owned by megalodonte-base. Exposes navigation, route parameters, scope, the current JavaFX scene and window spawning. Screens on the router receive an instance of this via their ScreenFactory.
  • Constructor Details

    • ScreenContextBase

      public ScreenContextBase(javafx.stage.Stage selfStage, RouterBase router, ScreenManager screenManager)
  • Method Details

    • scope

      public Scope scope()
      Description copied from interface: ScreenContextInterface
      Escopo de cancelamento vinculado a esta navegação: cancelado automaticamente pelo RouterBase assim que a tela associada é destruída (antes de onDestroy() rodar). Trabalho assíncrono iniciado via scope().run(...) não fica pendurado depois que o usuário navega pra outro lugar.
      Specified by:
      scope in interface ScreenContextInterface
    • spawnWindow

      public void spawnWindow(String path)
      Description copied from interface: ScreenContextInterface
      Spawns a new window for the given route.
      Specified by:
      spawnWindow in interface ScreenContextInterface
      Parameters:
      path - route identification to spawn
    • spawnWindow

      public void spawnWindow(String path, Consumer<Exception> errorHandler)
      Description copied from interface: ScreenContextInterface
      Spawns a new window for the given route.
      Specified by:
      spawnWindow in interface ScreenContextInterface
      Parameters:
      path - route identification to spawn
      errorHandler - callback invoked if spawning fails
    • setParams

      public void setParams(Map<String,String> params)
    • selfStage

      public javafx.stage.Stage selfStage()
      Description copied from interface: ScreenContextInterface
      The JavaFX Stage this screen is currently attached to.
      Specified by:
      selfStage in interface ScreenContextInterface
    • isFullScreen

      public boolean isFullScreen()
      Description copied from interface: ScreenContextInterface
      Returns whether this screen's window is currently in full-screen mode.
      Specified by:
      isFullScreen in interface ScreenContextInterface
    • setFullScreen

      public void setFullScreen(boolean fullScreen)
      Description copied from interface: ScreenContextInterface
      Changes this screen's window full-screen mode without exposing JavaFX stage manipulation to application code.
      Specified by:
      setFullScreen in interface ScreenContextInterface
    • router

      public RouterBase router()
    • getParams

      public Map<String,String> getParams()
      Description copied from interface: ScreenContextInterface
      Route parameters for the current navigation, resolved from dynamic segments (${param}) — e.g. for path "product/${id}": { "id" = "123" }.
      Specified by:
      getParams in interface ScreenContextInterface
    • getJavaFXScene

      public javafx.scene.Scene getJavaFXScene()
      Description copied from interface: ScreenContextInterface
      Get current JavaFX scene of this screen
      Specified by:
      getJavaFXScene in interface ScreenContextInterface
      Returns:
      Scene
    • whenReady

      public void whenReady(RunnableThrowing runnableThrowing)
      Description copied from interface: ScreenContextInterface
      Executa o callback quando a Scene estiver pronta na Stage. Cobre tanto o caso onde ela ainda não existe (aguarda) quanto o caso onde já está disponível (executa imediatamente).
      Specified by:
      whenReady in interface ScreenContextInterface