Class CloseContextImpl
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.internal.context.AbstractViewContext
tech.guilhermekaua.spigotboot.inventoryapi.internal.context.CloseContextImpl
- All Implemented Interfaces:
CloseContext,ViewContext,StateBackedContext
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 Summary
ConstructorsConstructorDescriptionCloseContextImpl(@NotNull ViewSession session, @NotNull ViewEngine engine, @NotNull CloseReason reason) Creates the context for one teardown. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this session.voidNavigates to another registered view: this session closes withCloseReason.REPLACED, then the target opens.voidopenView(@NotNull Class<? extends View> target, @NotNull ViewArguments arguments) Same asViewContext.openView(Class), passing arguments to the target view.@NotNull CloseReasonreason()Returns why this session is closing.voidupdate()Runs a full update pass (UpdateTrigger.EXPLICIT) synchronously:onUpdatefollowed by a component repaint.voidupdateTitle(@NotNull String title) Updates the container title in place (no reopen) via the title updater: placeholders are applied forViewContext.player()when enabled by the view config, then legacy&color codes are translated.Methods inherited from class tech.guilhermekaua.spigotboot.inventoryapi.internal.context.AbstractViewContext
arguments, config, contextActive, engine, inventory, isActive, owner, player, playerId, plugin, session, stateStore, view
-
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 sessionengine- the engine executing the closereason- why the session is closing
-
-
Method Details
-
reason
Description copied from interface:CloseContextReturns why this session is closing.- Specified by:
reasonin interfaceCloseContext- Returns:
- the close reason
-
update
public void update()Description copied from interface:ViewContextRuns a full update pass (UpdateTrigger.EXPLICIT) synchronously:onUpdatefollowed by a component repaint. State written during the pass is coalesced into a single trailing flush. Main thread only.- Specified by:
updatein interfaceViewContext- Overrides:
updatein classAbstractViewContext
-
close
public void close()Description copied from interface:ViewContextCloses 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:
closein interfaceViewContext- Overrides:
closein classAbstractViewContext
-
updateTitle
Description copied from interface:ViewContextUpdates the container title in place (no reopen) via the title updater: placeholders are applied forViewContext.player()when enabled by the view config, then legacy&color codes are translated. Main thread only.- Specified by:
updateTitlein interfaceViewContext- Overrides:
updateTitlein classAbstractViewContext- Parameters:
title- the new title, legacy color codes supported
-
openView
Description copied from interface:ViewContextNavigates to another registered view: this session closes withCloseReason.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 withinonCloseis illegal; the call is logged SEVERE and dropped to prevent navigation loops. Main thread only.- Specified by:
openViewin interfaceViewContext- Overrides:
openViewin classAbstractViewContext- 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:ViewContextSame asViewContext.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 withinonCloseis illegal; the call is logged SEVERE and dropped to prevent navigation loops.- Specified by:
openViewin interfaceViewContext- Overrides:
openViewin classAbstractViewContext- Parameters:
target- the registered view class to openarguments- the arguments handed to the target's contexts
-