Class PagingButtons
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.component.PagingButtons
An interface for interacting with
PaginatedPane
s. This gives two buttons for navigating backwards and
forwards through the pages of the PaginatedPane
. The backward button will be displayed at (0, 0) of this pane
and the forward button will be displayed at (length - 1, 0) of this pane. If the paginated pane is at the first page
or the last page, the backwards respectively the forward button will not show. This does not display the
PaginatedPane
itself, but is merely an interface for interacting with it.- Since:
- 0.10.14
-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
Pane.Priority
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPagingButtons
(int length, @NotNull PaginatedPane pages) Creates a new PagingButtons instance, which controls the providedPaginatedPane
.PagingButtons
(int length, @NotNull PaginatedPane pages, @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
.PagingButtons
(int length, @NotNull Pane.Priority priority, @NotNull PaginatedPane pages) Creates a new PagingButtons instance, which controls the providedPaginatedPane
.PagingButtons
(int length, @NotNull Pane.Priority priority, @NotNull PaginatedPane pages, @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
.PagingButtons
(@NotNull Slot slot, int length, @NotNull PaginatedPane pages) Creates a new PagingButtons instance, which controls the providedPaginatedPane
.PagingButtons
(@NotNull Slot slot, int length, @NotNull PaginatedPane pages, @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
.PagingButtons
(@NotNull Slot slot, int length, @NotNull Pane.Priority priority, @NotNull PaginatedPane pages) Creates a new PagingButtons instance, which controls the providedPaginatedPane
.PagingButtons
(@NotNull Slot slot, int length, @NotNull Pane.Priority priority, @NotNull PaginatedPane pages, @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
This is a no-op.boolean
click
(@NotNull Gui gui, @NotNull InventoryComponent inventoryComponent, @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Called whenever there is being clicked on this pane@NotNull PagingButtons
copy()
Makes a copy of this pane and returns it.void
display
(@NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Has to set all the items in the right spot inside the inventory@NotNull Collection
<GuiItem> getItems()
Gets all the items in this pane and all underlying panes.@NotNull Collection
<Pane> getPanes()
Gets all the panes in this panes, including any child panes from other panes.static @NotNull PagingButtons
Loads a paging buttons pane from an XML element.void
setBackwardButton
(@NotNull GuiItem item) Sets the item to be used for navigating backwards.void
setForwardButton
(@NotNull GuiItem item) Sets the item to be used for navigating forwards.Methods inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
callOnClick, createBorder, createBorder, findMatchingItem, getHeight, getLength, getPriority, getSlot, getUUID, getX, getY, isVisible, load, loadItem, loadItem, matchesItem, registerProperty, setHeight, setLength, setOnClick, setPriority, setSlot, setVisible, setX, setY
-
Constructor Details
-
PagingButtons
public PagingButtons(@NotNull @NotNull Slot slot, int length, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull PaginatedPane pages, @NotNull @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
slot
- the position of this interfacelength
- the length of this interfacepriority
- the priority of this interfacepages
- the pages to interact withplugin
- the plugin that will be the owner of this interface's items- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
PagingButtons
public PagingButtons(@NotNull @NotNull Slot slot, int length, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull PaginatedPane pages) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
slot
- the position of this interfacelength
- the length of this interfacepriority
- the priority of this interfacepages
- the pages to interact with- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
PagingButtons
public PagingButtons(@NotNull @NotNull Slot slot, int length, @NotNull @NotNull PaginatedPane pages, @NotNull @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
slot
- the position of this interfacelength
- the length of this interfacepages
- the pages to interact withplugin
- the plugin that will be the owner of this interface's items- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
PagingButtons
public PagingButtons(@NotNull @NotNull Slot slot, int length, @NotNull @NotNull PaginatedPane pages) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
slot
- the position of this interfacelength
- the length of this interfacepages
- the pages to interact with- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
PagingButtons
public PagingButtons(int length, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull PaginatedPane pages, @NotNull @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
length
- the length of this interfacepriority
- the priority of this interfacepages
- the pages to interact withplugin
- the plugin that will be the owner of this interface's items- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
PagingButtons
public PagingButtons(int length, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull PaginatedPane pages) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
length
- the length of this interfacepriority
- the priority of this interfacepages
- the pages to interact with- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
PagingButtons
public PagingButtons(int length, @NotNull @NotNull PaginatedPane pages, @NotNull @NotNull Plugin plugin) Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
length
- the length of this interfacepages
- the pages to interact withplugin
- the plugin that will be the owner of this interface's items- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
PagingButtons
Creates a new PagingButtons instance, which controls the providedPaginatedPane
. The backward and forward item will be an arrow. If the length provided is less than 2, this will throw anIllegalArgumentException
.- Parameters:
length
- the length of this interfacepages
- the pages to interact with- Throws:
IllegalArgumentException
- if the length is less than 2- Since:
- 0.10.14
-
-
Method Details
-
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull InventoryComponent inventoryComponent, @NotNull @NotNull InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:Pane
Called whenever there is being clicked on this pane- Specified by:
click
in classPane
- Parameters:
gui
- the gui in which was clickedinventoryComponent
- the inventory component in which this pane residesevent
- the event that occurred while clicking on this itemslot
- the slot that was clicked inpaneOffsetX
- the pane's offset on the x axispaneOffsetY
- the pane's offset on the y axismaxLength
- the maximum length of the panemaxHeight
- the maximum height of the pane- Returns:
- whether the item was found or not
-
display
public void display(@NotNull @NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:Pane
Has to set all the items in the right spot inside the inventory- Specified by:
display
in classPane
- Parameters:
inventoryComponent
- the inventory component in which the items should be displayedpaneOffsetX
- the pane's offset on the x axispaneOffsetY
- the pane's offset on the y axismaxLength
- the maximum length of the panemaxHeight
- the maximum height of the pane
-
copy
Makes a copy of this pane and returns it. This makes a deep copy of the pane. This entails that the underlying panes and/or items will be copied as well. The returned pane will never be reference equal to the current pane. This does not make a copy of thePaginatedPane
that is being controlled by this interface. -
getItems
Description copied from class:Pane
Gets all the items in this pane and all underlying panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.) -
setBackwardButton
Sets the item to be used for navigating backwards. If an event is attached to the item, this event will be called after the page has been changed.- Parameters:
item
- the new backward item- Since:
- 0.10.14
-
setForwardButton
Sets the item to be used for navigating forwards. If an event is attached to the item, this event will be called after the page has been changed.- Parameters:
item
- the new forward item- Since:
- 0.10.14
-
getPanes
Description copied from class:Pane
Gets all the panes in this panes, including any child panes from other panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.) -
clear
public void clear()This is a no-op. -
load
@NotNull @Contract(pure=true) public static @NotNull PagingButtons load(@NotNull @NotNull Object instance, @NotNull @NotNull Element element, @NotNull @NotNull Plugin plugin) Loads a paging buttons pane from an XML element.- Parameters:
instance
- the instance classelement
- the elementplugin
- the plugin that will be the owner of the underlying items- Returns:
- the paging buttons pane
- Since:
- 0.10.14
-