Class RenderContextImpl
java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.internal.context.AbstractViewContext
tech.guilhermekaua.spigotboot.inventoryapi.internal.context.RenderContextImpl
- All Implemented Interfaces:
RenderContext,ViewContext,StateBackedContext
Context for
View.onFirstRender: collects component declarations in order and
freezes them into the session's component table via materializeAll(), called by
the first-render phase after the handler returns.-
Constructor Summary
ConstructorsConstructorDescriptionRenderContextImpl(@NotNull ViewSession session, @NotNull ViewEngine engine) Creates the context for one first render. -
Method Summary
Modifier and TypeMethodDescriptionReturns the layout characters successfully bound throughlayoutSlot(char)during this render, in declaration order; the first-render phase subtracts them when warning about layout characters bound to neither a component nor pagination.@NotNull ItemComponentBuilderlayoutSlot(char character) Starts one component applied to every slot bound to the given layout character.@NotNull ItemComponentBuilderlayoutSlot(char character, @NotNull org.bukkit.inventory.ItemStack item) Starts a layout-character component with a static item already set.voidMaterializes every collected declaration into the session's component table, in declaration order; the table validates slot overlaps and missing item sources.@NotNull ItemComponentBuilderslot(int slot) Starts a component bound to a single slot.@NotNull ItemComponentBuilderslot(int row, int column) Starts a component bound to a single slot addressed by grid position.@NotNull ItemComponentBuilderslot(int slot, @NotNull org.bukkit.inventory.ItemStack item) Starts a single-slot component with a static item already set.Methods inherited from class tech.guilhermekaua.spigotboot.inventoryapi.internal.context.AbstractViewContext
arguments, close, config, contextActive, engine, inventory, isActive, openView, openView, owner, player, playerId, plugin, session, stateStore, update, updateTitle, view
-
Constructor Details
-
RenderContextImpl
public RenderContextImpl(@NotNull @NotNull ViewSession session, @NotNull @NotNull ViewEngine engine) Creates the context for one first render.- Parameters:
session- the session being renderedengine- the engine executing the render
-
-
Method Details
-
slot
Description copied from interface:RenderContextStarts a component bound to a single slot.- Specified by:
slotin interfaceRenderContext- Parameters:
slot- the 0-based raw slot, less thanrows * 9- Returns:
- the component builder for fluent configuration
-
slot
Description copied from interface:RenderContextStarts a component bound to a single slot addressed by grid position.- Specified by:
slotin interfaceRenderContext- Parameters:
row- the 1-based row, 1 to 6column- the 1-based column, 1 to 9- Returns:
- the component builder
-
slot
@NotNull public @NotNull ItemComponentBuilder slot(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack item) Description copied from interface:RenderContextStarts a single-slot component with a static item already set.- Specified by:
slotin interfaceRenderContext- Parameters:
slot- the 0-based raw slotitem- the static item to display- Returns:
- the component builder
-
layoutSlot
Description copied from interface:RenderContextStarts one component applied to every slot bound to the given layout character.- Specified by:
layoutSlotin interfaceRenderContext- Parameters:
character- a character present in the configured layout- Returns:
- the component builder
-
layoutSlot
@NotNull public @NotNull ItemComponentBuilder layoutSlot(char character, @NotNull @NotNull org.bukkit.inventory.ItemStack item) Description copied from interface:RenderContextStarts a layout-character component with a static item already set.- Specified by:
layoutSlotin interfaceRenderContext- Parameters:
character- a character present in the configured layoutitem- the static item displayed on every bound slot- Returns:
- the component builder
-
materializeAll
public void materializeAll()Materializes every collected declaration into the session's component table, in declaration order; the table validates slot overlaps and missing item sources. idempotent: a second call is a no-op.- Throws:
ViewConfigurationException- when a declaration overlaps slots or has no item source
-
boundLayoutChars
Returns the layout characters successfully bound throughlayoutSlot(char)during this render, in declaration order; the first-render phase subtracts them when warning about layout characters bound to neither a component nor pagination.- Returns:
- an unmodifiable view of the bound layout characters
-