Class DeclarativeGui
java.lang.Object
com.ultikits.ultitools.abstracts.gui.declarative.engine.DeclarativeGui
- Direct Known Subclasses:
StatefulDeclarativeGui
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Gridprotected final Stringprivate booleanprivate static final Loggerprivate final GuiRendererprivate final intprivate GridSessionprivate final UiServiceprivate final org.bukkit.entity.Player -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDeclarativeGui(UiService ui, Scheduler scheduler, org.bukkit.entity.Player viewer, String id, Text title, int rows) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidacceptGrid(Grid grid) abstract @NotNull Widgetbuild(@NotNull BuildContext context) private voidprotected @NotNull GuiRendererbooleanprivate voidlogCloseFailure(String phase, Throwable failure) protected voidRequests a later frame while this page is mounted.protected voidonGuiClose(@NotNull UiResult<Ack> result) final GridSessionopen()Synchronously builds the first complete frame, then shows it.protected void@NotNull org.bukkit.entity.Playerviewer()
-
Field Details
-
LOGGER
-
id
-
ui
-
viewer
private final org.bukkit.entity.Player viewer -
rows
private final int rows -
renderer
-
firstGrid
-
session
-
initialized
private boolean initialized
-
-
Constructor Details
-
DeclarativeGui
protected DeclarativeGui(UiService ui, Scheduler scheduler, org.bukkit.entity.Player viewer, String id, Text title, int rows) - Parameters:
ui- the screen owner's UI servicescheduler- the module's own injected schedulerviewer- the viewerid- the build-context identifiertitle- deferred screen titlerows- fixed row count, 1..6
-
-
Method Details
-
build
- Parameters:
context- the root build context @return a widget tree derived from current state
-
open
Synchronously builds the first complete frame, then shows it. Later frames update the same session. Calling this while the page is open returns that session; after its result arrives the page may reopen.- Returns:
- the grid session
- Throws:
IllegalStateException- if not on the viewer's owning thread, or called re-entrantly during opening
-
acceptGrid
-
finished
-
logCloseFailure
-
markNeedsBuild
protected void markNeedsBuild()Requests a later frame while this page is mounted. -
setState
- Parameters:
action- modifies state before requesting a later frame
-
onGuiClose
-
getRenderer
- Returns:
- the renderer owning this page's elements
-
isInitialized
public boolean isInitialized()- Returns:
- whether the page is mounted and awaiting its session result
-
viewer
@NotNull public @NotNull org.bukkit.entity.Player viewer()- Returns:
- the viewer
-