java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.internal.context.AbstractViewContext
tech.guilhermekaua.spigotboot.inventoryapi.internal.context.CloseContextImpl
All Implemented Interfaces:
CloseContext, ViewContext, StateBackedContext

@Internal public final class CloseContextImpl extends AbstractViewContext implements CloseContext
Context for View.onClose: the session is tearing down. update() and updateTitle(java.lang.String) throw, close() is a no-op, and openView(java.lang.Class<? extends tech.guilhermekaua.spigotboot.inventoryapi.View>) is dropped with a SEVERE log (ยง5.4).
  • Constructor Details

    • CloseContextImpl

      public CloseContextImpl(@NotNull @NotNull ViewSession session, @NotNull @NotNull ViewEngine engine, @NotNull @NotNull CloseReason reason)
      Creates the context for one teardown.
      Parameters:
      session - the closing session
      engine - the engine executing the close
      reason - why the session is closing
  • Method Details

    • reason

      @NotNull public @NotNull CloseReason reason()
      Description copied from interface: CloseContext
      Returns why this session is closing.
      Specified by:
      reason in interface CloseContext
      Returns:
      the close reason
    • update

      public void update()
      Description copied from interface: ViewContext
      Runs a full update pass (UpdateTrigger.EXPLICIT) synchronously: onUpdate followed by a component repaint. State written during the pass is coalesced into a single trailing flush. Main thread only.
      Specified by:
      update in interface ViewContext
      Overrides:
      update in class AbstractViewContext
    • close

      public void close()
      Description copied from interface: ViewContext
      Closes this session. When called during click dispatch the close is deferred to the end of the current tick and further clicks are swallowed. Outside click dispatch, the session closes synchronously before this method returns. Main thread only.
      Specified by:
      close in interface ViewContext
      Overrides:
      close in class AbstractViewContext
    • updateTitle

      public void updateTitle(@NotNull @NotNull String title)
      Description copied from interface: ViewContext
      Updates the container title in place (no reopen) via the title updater: placeholders are applied for ViewContext.player() when enabled by the view config, then legacy & color codes are translated. Main thread only.
      Specified by:
      updateTitle in interface ViewContext
      Overrides:
      updateTitle in class AbstractViewContext
      Parameters:
      title - the new title, legacy color codes supported
    • openView

      public void openView(@NotNull @NotNull Class<? extends View> target)
      Description copied from interface: ViewContext
      Navigates to another registered view: this session closes with CloseReason.REPLACED, then the target opens. Deferred to the end of the tick during click dispatch, or while the session is not yet active (opening/rendering). Calling this method from within onClose is illegal; the call is logged SEVERE and dropped to prevent navigation loops. Main thread only.
      Specified by:
      openView in interface ViewContext
      Overrides:
      openView in class AbstractViewContext
      Parameters:
      target - the registered view class to open
    • openView

      public void openView(@NotNull @NotNull Class<? extends View> target, @NotNull @NotNull ViewArguments arguments)
      Description copied from interface: ViewContext
      Same as ViewContext.openView(Class), passing arguments to the target view. Deferred to the end of the tick during click dispatch, or while the session is not yet active (opening/rendering). Calling this method from within onClose is illegal; the call is logged SEVERE and dropped to prevent navigation loops.
      Specified by:
      openView in interface ViewContext
      Overrides:
      openView in class AbstractViewContext
      Parameters:
      target - the registered view class to open
      arguments - the arguments handed to the target's contexts