All Implemented Interfaces:
ItemAddable<PaginatorGUIPane>, Sizeable

public class PaginatorGUIPane extends HorizontalSplitGUIPane implements ItemAddable<PaginatorGUIPane>
A Paginator is a GUIPane that can contain items. If there are too many items you can switch pages to see all items.
Builder: PaginatorBuilder
  • Constructor Details

    • PaginatorGUIPane

      public PaginatorGUIPane(GUI gui, Vector2d minSize, Vector2d maxSize, boolean repeat, int startPage, PaginatorControlsPosition defaultControlsPosition)
      Creates a new PaginatorGUIPane
      Parameters:
      gui - The GUI
      minSize - The minimum size of the Pane
      maxSize - The minimum size of the Pane
      repeat - Whether to jump back to the first page when reaching the last page (and via versa)
      startPage - The start page
      defaultControlsPosition - The default controls automatically appear if there is not enough space for all items. Set to null if you don't want automatic controls, or you want to handle them yourself. To add custom controls you can instantiate the PaginatorControlsPane
  • Method Details

    • updateSize

      public void updateSize(Sizeable parent)
      Updates the size of the Paginator based on how many Items are added.
      Overrides:
      updateSize in class HorizontalSplitGUIPane
      Parameters:
      parent - The parent Pane or GUI (Sizeable)
    • updateSizeRecursive

      public void updateSizeRecursive(Sizeable parent)
      Is called to recursively update the size of all GUIPanes
      Overrides:
      updateSizeRecursive in class HorizontalSplitGUIPane
      Parameters:
      parent - The parent Pane or GUI (Sizeable)
    • setItems

      public <I extends GUIItem> PaginatorGUIPane setItems(List<I> items)
      Sets all Items in the Paginator.
      Type Parameters:
      I - The type of the items
      Parameters:
      items - The new Items
      Returns:
      this
    • onItemAdd

      public void onItemAdd()
      Is called whenever Items are added to the Paginator. Resets Items in the content-pane
      Specified by:
      onItemAdd in interface ItemAddable<PaginatorGUIPane>
    • clearItems

      public PaginatorGUIPane clearItems()
      Clears all Items in this Paginator
      Returns:
      this
    • nextPage

      public PaginatorGUIPane nextPage()
      Skips to the next page.
      Returns:
      this
    • previousPage

      public PaginatorGUIPane previousPage()
      Returns to the previous page.
      Returns:
      this
    • setCurrentPage

      public PaginatorGUIPane setCurrentPage(int index)
      Sets the current page
      Parameters:
      index - The current page
      Returns:
      this
    • getPages

      public int getPages()
      Returns:
      the amount of pages
    • getContentPaneSize

      public Vector2d getContentPaneSize()
      Returns:
      The size of the content-pane according to the size of the Paginator