Class AbstractTabGui

java.lang.Object
xyz.xenondevs.invui.gui.AbstractGui
xyz.xenondevs.invui.gui.AbstractTabGui
All Implemented Interfaces:
Gui, GuiParent, TabGui

public abstract class AbstractTabGui extends AbstractGui implements TabGui
A Gui with tabs.

Only in very rare circumstances should this class be used directly. Instead, use the static factory or builder functions from the TabGui interface, such as TabGui.normal() to create a new TabGui.

  • Constructor Details

    • AbstractTabGui

      public AbstractTabGui(int width, int height, int tabAmount, int... listSlots)
      Creates a new AbstractTabGui.
      Parameters:
      width - The width of the gui.
      height - The height of the gui.
      tabAmount - The amount of tabs.
      listSlots - The slots to be used for the content.
    • AbstractTabGui

      public AbstractTabGui(int width, int height, int tabAmount, Structure structure)
      Creates a new AbstractTabGui.
      Parameters:
      width - The width of the gui.
      height - The height of the gui.
      tabAmount - The amount of tabs.
      structure - The structure of the gui.
  • Method Details

    • setTab

      public void setTab(int tab)
      Description copied from interface: TabGui
      Sets the current tab.
      Specified by:
      setTab in interface TabGui
      Parameters:
      tab - The index of the tab to show.
    • update

      protected void update()
    • getFirstAvailableTab

      public int getFirstAvailableTab()
    • getCurrentTab

      public int getCurrentTab()
      Description copied from interface: TabGui
      Gets the current tab index.
      Specified by:
      getCurrentTab in interface TabGui
      Returns:
      The current tab index.
    • getTabChangeHandlers

      @Nullable public @Nullable List<@NotNull BiConsumer<Integer,Integer>> getTabChangeHandlers()
      Description copied from interface: TabGui
      Gets the registered tab change handlers.
      Specified by:
      getTabChangeHandlers in interface TabGui
      Returns:
      The registered tab change handlers.
    • setTabChangeHandlers

      public void setTabChangeHandlers(@Nullable @Nullable List<@NotNull BiConsumer<Integer,Integer>> tabChangeHandlers)
      Description copied from interface: TabGui
      Replaces the currently registered tab change handlers with the given list.
      Specified by:
      setTabChangeHandlers in interface TabGui
      Parameters:
      tabChangeHandlers - The new page change handlers.
    • addTabChangeHandler

      public void addTabChangeHandler(@NotNull @NotNull BiConsumer<Integer,Integer> tabChangeHandler)
      Description copied from interface: TabGui
      Registers a page change handler.
      Specified by:
      addTabChangeHandler in interface TabGui
      Parameters:
      tabChangeHandler - The handler to register.
    • removeTabChangeHandler

      public void removeTabChangeHandler(@NotNull @NotNull BiConsumer<Integer,Integer> tabChangeHandler)
      Description copied from interface: TabGui
      Unregisters a page change handler.
      Specified by:
      removeTabChangeHandler in interface TabGui
      Parameters:
      tabChangeHandler - The handler to unregister.
    • isTabAvailable

      public abstract boolean isTabAvailable(int tab)
      Description copied from interface: TabGui
      Checks if the given tab is available.
      Specified by:
      isTabAvailable in interface TabGui
      Parameters:
      tab - The index of the tab to check.
      Returns:
      Whether the given tab is available.
    • getSlotElements

      protected abstract List<SlotElement> getSlotElements(int tab)