Package xyz.xenondevs.invui.gui
Class AbstractTabGui
java.lang.Object
xyz.xenondevs.invui.gui.AbstractGui
xyz.xenondevs.invui.gui.AbstractTabGui
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
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface xyz.xenondevs.invui.gui.Gui
Gui.Builder<G extends Gui,
S extends Gui.Builder<G, S>> Nested classes/interfaces inherited from interface xyz.xenondevs.invui.gui.TabGui
TabGui.Builder
-
Constructor Summary
ConstructorDescriptionAbstractTabGui
(int width, int height, int tabAmount, int... listSlots) Creates a newAbstractTabGui
.AbstractTabGui
(int width, int height, int tabAmount, Structure structure) Creates a newAbstractTabGui
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTabChangeHandler
(@NotNull BiConsumer<Integer, Integer> tabChangeHandler) Registers a page change handler.int
Gets the current tab index.int
protected abstract List
<SlotElement> getSlotElements
(int tab) @Nullable List
<@NotNull BiConsumer<Integer, Integer>> Gets the registered tab change handlers.abstract boolean
isTabAvailable
(int tab) Checks if the given tab is available.void
removeTabChangeHandler
(@NotNull BiConsumer<Integer, Integer> tabChangeHandler) Unregisters a page change handler.void
setTab
(int tab) Sets the current tab.void
setTabChangeHandlers
(@Nullable List<@NotNull BiConsumer<Integer, Integer>> tabChangeHandlers) Replaces the currently registered tab change handlers with the given list.protected void
update()
Methods inherited from class xyz.xenondevs.invui.gui.AbstractGui
addItems, addParent, addSlotElements, applyStructure, cancelAnimation, closeForAllViewers, fill, fill, fillBorders, fillColumn, fillRectangle, fillRectangle, fillRectangle, fillRectangle, fillRow, findAllCurrentViewers, findAllWindows, getAllInventories, getAllInventorySlots, getBackground, getHeight, getItem, getItem, getParents, getSize, getSlotElement, getSlotElement, getSlotElements, getWidth, handleClick, handleInvDoubleClick, handleInvDrop, handleInvItemShift, handleInvLeftClick, handleInvMiddleClick, handleInvNumberKey, handleInvOffHandKey, handleInvRightClick, handleInvSlotElementClick, handleItemDrag, handleItemShift, handleSlotElementUpdate, hasSlotElement, hasSlotElement, isFrozen, isIgnoreObscuredInventorySlots, playAnimation, putIntoFirstInventory, remove, remove, removeParent, setBackground, setFrozen, setIgnoreObscuredInventorySlots, setItem, setItem, setSlotElement, setSlotElement, updateControlItems
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface xyz.xenondevs.invui.gui.Gui
addItems, addSlotElements, applyStructure, cancelAnimation, closeForAllViewers, fill, fill, fillBorders, fillColumn, fillRectangle, fillRectangle, fillRectangle, fillRectangle, fillRow, findAllCurrentViewers, findAllWindows, getBackground, getHeight, getItem, getItem, getSize, getSlotElement, getSlotElement, getSlotElements, getWidth, hasSlotElement, hasSlotElement, isFrozen, isIgnoreObscuredInventorySlots, playAnimation, remove, remove, setBackground, setFrozen, setIgnoreObscuredInventorySlots, setItem, setItem, setSlotElement, setSlotElement
-
Constructor Details
-
AbstractTabGui
public AbstractTabGui(int width, int height, int tabAmount, int... listSlots) Creates a newAbstractTabGui
.- 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
Creates a newAbstractTabGui
.- 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. -
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 interfaceTabGui
- Returns:
- The current tab index.
-
getTabChangeHandlers
Description copied from interface:TabGui
Gets the registered tab change handlers.- Specified by:
getTabChangeHandlers
in interfaceTabGui
- 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 interfaceTabGui
- Parameters:
tabChangeHandlers
- The new page change handlers.
-
addTabChangeHandler
Description copied from interface:TabGui
Registers a page change handler.- Specified by:
addTabChangeHandler
in interfaceTabGui
- Parameters:
tabChangeHandler
- The handler to register.
-
removeTabChangeHandler
Description copied from interface:TabGui
Unregisters a page change handler.- Specified by:
removeTabChangeHandler
in interfaceTabGui
- 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 interfaceTabGui
- Parameters:
tab
- The index of the tab to check.- Returns:
- Whether the given tab is available.
-
getSlotElements
-