java.lang.Object
de.placeblock.betterinventories.content.GUISection
de.placeblock.betterinventories.content.pane.GUIPane
All Implemented Interfaces:
Sizeable
Direct Known Subclasses:
BaseSimpleGUIPane, HorizontalSplitGUIPane

public abstract class GUIPane extends GUISection
A GUISection that can contain other GUISections. Renders to a List.
How the own size is updated can be implemented by the different GUIPanes.
  • Constructor Details

    • GUIPane

      public GUIPane(GUI gui, Vector2d minSize, Vector2d maxSize)
      Creates a new GUIPane
      Parameters:
      gui - The GUI
      minSize - The minimum size of the Pane
      maxSize - The maximum size of the Pane
  • Method Details

    • setSize

      public void setSize(Vector2d size)
      Sets the size and calls onSizeChange() if changed.
      Overrides:
      setSize in class GUISection
      Parameters:
      size - The new size
    • setHeight

      public void setHeight(int height)
      Sets the new height by using setSize(Vector2d)
      Parameters:
      height - The new height
    • setWidth

      public void setWidth(int width)
      Sets the new width by using setSize(Vector2d)
      Parameters:
      width - The new width
    • updateSizeRecursive

      public abstract void updateSizeRecursive(Sizeable parent)
      Is called to recursively update the size of all GUIPanes
      Parameters:
      parent - The parent Pane or GUI (Sizeable)
    • updateSize

      public abstract void updateSize(Sizeable parent)
      Recalculates the size of the Pane when implemented
      Parameters:
      parent - The parent Pane or GUI (Sizeable)
    • updateChildrenRecursive

      protected void updateChildrenRecursive(Sizeable parent)
      Updates the size of all children recursive
      Parameters:
      parent - The parent Pane or GUI (Sizeable)
    • onSizeChange

      public void onSizeChange()
      Can be overridden and is only called when the size of this GUIPane really changes.
    • getChildren

      public abstract Set<GUISection> getChildren()
      Implemented by GUIPanes Should return all children sections
      Returns:
      All child sections
    • renderOnList

      protected void renderOnList(GUISection section, Vector2d position, List<org.bukkit.inventory.ItemStack> content)
      Renders a child section at a specific position on a list
      Parameters:
      section - The child section
      position - The child position the child is at
      content - The list on which the section should be rendered. Has to have the size of this GUIPane, otherwise it can lead to exceptions.
    • onItemClick

      public void onItemClick(ClickData data)
      Description copied from class: GUISection
      Called when a user clicks on an item. Usually after this method one of the add/remove/amount methods is called.
      Specified by:
      onItemClick in class GUISection
      Parameters:
      data - The clickdata
    • onItemAdd

      public boolean onItemAdd(Vector2d position, org.bukkit.inventory.ItemStack itemStack)
      Description copied from class: GUISection
      Called when an item is added to an empty slot
      Specified by:
      onItemAdd in class GUISection
      Parameters:
      position - The relative position of the slot
      itemStack - The itemstack that was added
      Returns:
      Whether this action is allowed.
    • onItemRemove

      public boolean onItemRemove(Vector2d position)
      Description copied from class: GUISection
      Called when an item is removed from an empty slot
      Specified by:
      onItemRemove in class GUISection
      Parameters:
      position - The relative position of the slot
      Returns:
      Whether this action is allowed.
    • onItemAmount

      public boolean onItemAmount(Vector2d position, int amount)
      Description copied from class: GUISection
      Called when the amount of an item in a slot changes
      Specified by:
      onItemAmount in class GUISection
      Parameters:
      position - The relative position of the slot
      amount - The new amount of the item
      Returns:
      Whether this action is allowed.
    • onItemProvide

      public abstract void onItemProvide(org.bukkit.inventory.ItemStack itemStack)
      Called when an item is provided by an inventory MOVE_TO_OTHER_INVENTORY event
      Parameters:
      itemStack - The provided item. Method reduces the amount of the item by the number that got accepted.
    • provideItem

      public void provideItem(org.bukkit.inventory.ItemStack itemStack)
      Used to provide items recursively
      Parameters:
      itemStack - The provided item. Method reduces the amount of the item by the number that got accepted.