Class ItemSlotArea.Builder

java.lang.Object
com.ultikits.ultitools.abstracts.gui.declarative.widgets.ItemSlotArea.Builder
All Implemented Interfaces:
WidgetBuilder<ItemSlotArea>
Enclosing class:
ItemSlotArea

public static class ItemSlotArea.Builder extends Object implements WidgetBuilder<ItemSlotArea>
A non-thread-safe range builder; defaults to all container indexes at slot zero, in VIEW mode.
Since:
7.0.0
  • Field Details

    • container

      private final SlotContainer container
    • firstIndex

      private int firstIndex
    • count

      private int count
    • startSlot

      private int startSlot
    • mode

      private BindingMode mode
    • key

      @Nullable private @Nullable SlotKey key
  • Constructor Details

  • Method Details

    • firstIndex

      public ItemSlotArea.Builder firstIndex(int firstIndex)
      Parameters:
      firstIndex - first visible index; negative indexes and indexes at/after a nonempty container's size are rejected by build, even for an empty area. An empty container accepts only zero.
      Returns:
      this builder
    • count

      public ItemSlotArea.Builder count(int count)
      Parameters:
      count - requested area size (zero is empty); its tail may exceed the container @return this builder
    • startSlot

      public ItemSlotArea.Builder startSlot(int startSlot)
      Parameters:
      startSlot - first row-major grid index @return this builder
    • mode

      public ItemSlotArea.Builder mode(BindingMode mode)
      Parameters:
      mode - edit/view mode; moving items requires explicit EDITABLE @return this builder
    • key

      public ItemSlotArea.Builder key(@Nullable @Nullable SlotKey key)
      Parameters:
      key - reconciliation key @return this builder
    • key

      public ItemSlotArea.Builder key(String key)
      Parameters:
      key - reconciliation key @return this builder
    • build

      @NotNull public @NotNull ItemSlotArea build()
      Description copied from interface: WidgetBuilder
      Builds the Widget instance.
      Specified by:
      build in interface WidgetBuilder<ItemSlotArea>
      Returns:
      the immutable range description; nonexistent tail indexes generate no bindings
      Throws:
      IllegalArgumentException - if firstIndex is invalid, count is negative, or the requested area is outside a six-row grid