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

@Internal public final class RenderContextImpl extends AbstractViewContext implements RenderContext
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 Details

    • RenderContextImpl

      public RenderContextImpl(@NotNull @NotNull ViewSession session, @NotNull @NotNull ViewEngine engine)
      Creates the context for one first render.
      Parameters:
      session - the session being rendered
      engine - the engine executing the render
  • Method Details

    • slot

      @NotNull public @NotNull ItemComponentBuilder slot(int slot)
      Description copied from interface: RenderContext
      Starts a component bound to a single slot.
      Specified by:
      slot in interface RenderContext
      Parameters:
      slot - the 0-based raw slot, less than rows * 9
      Returns:
      the component builder for fluent configuration
    • slot

      @NotNull public @NotNull ItemComponentBuilder slot(int row, int column)
      Description copied from interface: RenderContext
      Starts a component bound to a single slot addressed by grid position.
      Specified by:
      slot in interface RenderContext
      Parameters:
      row - the 1-based row, 1 to 6
      column - 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: RenderContext
      Starts a single-slot component with a static item already set.
      Specified by:
      slot in interface RenderContext
      Parameters:
      slot - the 0-based raw slot
      item - the static item to display
      Returns:
      the component builder
    • layoutSlot

      @NotNull public @NotNull ItemComponentBuilder layoutSlot(char character)
      Description copied from interface: RenderContext
      Starts one component applied to every slot bound to the given layout character.
      Specified by:
      layoutSlot in interface RenderContext
      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: RenderContext
      Starts a layout-character component with a static item already set.
      Specified by:
      layoutSlot in interface RenderContext
      Parameters:
      character - a character present in the configured layout
      item - 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

      @NotNull public @NotNull Set<Character> boundLayoutChars()
      Returns the layout characters successfully bound through layoutSlot(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