Class GuiRenderer
java.lang.Object
com.ultikits.ultitools.abstracts.gui.declarative.engine.GuiRenderer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classCollects valid slots without letting one invalid node reject a complete frame.private static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final Runnableprivate static final Loggerprivate booleanprivate @Nullable BuildContextprivate @Nullable Elementprivate final intprivate final GuiSchedulerprivate final Textprivate final Map<GuiRenderer.WarningKind, Set<Integer>> -
Constructor Summary
ConstructorsConstructorDescriptionGuiRenderer(Text title, int rows, GuiScheduler scheduler, Consumer<Grid> sink) Creates a snapshot renderer; the caller supplies the first frame to UiService and later frames to its session. -
Method Summary
Modifier and TypeMethodDescriptionprivate List<RenderNode> collectRenderNodes(Element element) private voidcollectRenderNodesRecursive(Element element, List<RenderNode> nodes) voiddispose()Cancels submitted work, detaches build notifications and releases every owned element.@NotNull GuiSchedulervoidinitialize(@NotNull Supplier<Widget> widgetSupplier, @NotNull BuildContext context) Builds the first frame now on the owning thread, or submits it to that thread.private voidprivate voidprivate voidrebuildElement(Element element) voidRequests one later frame; requests during a build are replayed after it exits, never re-entrantly.private voidwarnOnce(GuiRenderer.WarningKind kind, int slot, String message)
-
Field Details
-
LOGGER
-
title
-
rows
private final int rows -
scheduler
-
sink
-
frameTask
-
warnedSlots
-
rootElement
-
widgetSupplier
-
rootContext
-
buildInProgress
private boolean buildInProgress -
rebuildRequestedDuringBuild
private boolean rebuildRequestedDuringBuild
-
-
Constructor Details
-
GuiRenderer
Creates a snapshot renderer; the caller supplies the first frame to UiService and later frames to its session.- Parameters:
title- deferred screen titlerows- the fixed row count, 1..6scheduler- the viewer's frame schedulersink- receiver of complete frames
-
-
Method Details
-
initialize
public void initialize(@NotNull @NotNull Supplier<Widget> widgetSupplier, @NotNull @NotNull BuildContext context) Builds the first frame now on the owning thread, or submits it to that thread. The supplier is evaluated exactly once per frame, including the first.- Parameters:
widgetSupplier- the current widget treecontext- root build context, reused after remounts
-
scheduleBuild
public void scheduleBuild()Requests one later frame; requests during a build are replayed after it exits, never re-entrantly. -
performBuild
private void performBuild() -
mountRoot
-
rebuildElement
-
collectRenderNodes
-
collectRenderNodesRecursive
-
dispose
public void dispose()Cancels submitted work, detaches build notifications and releases every owned element. -
getScheduler
- Returns:
- the viewer's frame scheduler
-
warnOnce
-