Class PagingButtons
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.component.PagingButtons
An interface for interacting with
PaginatedPanes. 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 Pane
Pane.Priority -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPagingButtons(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. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()This is a no-op.booleanclick(@NotNull Gui gui, @NotNull GuiComponent guiComponent, @NotNull InventoryClickEvent event, @NotNull Slot slot) Called whenever there is being clicked on this pane@NotNull PagingButtonscopy()Makes a copy of this pane and returns it.@NotNull GuiItemContainerdisplay()Returns aGuiItemContainerwith all the items that should be displayed of this pane.@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 PagingButtonsLoads a paging buttons pane from an XML element.voidsetBackwardButton(@NotNull GuiItem item) Sets the item to be used for navigating backwards.voidsetButtonsAlwaysVisible(boolean visible) Allow to always keep the backward and forward buttons visible when on the first and last pagevoidsetForwardButton(@NotNull GuiItem item) Sets the item to be used for navigating forwards.Methods inherited from class Pane
callOnClick, createBorder, findMatchingItem, getHeight, getLength, getPriority, getUUID, isVisible, load, matchesItem, setHeight, setLength, setOnClick, setPriority, setVisible
-
Constructor Details
-
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.12.0
-
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.12.0
-
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.12.0
-
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.12.0
-
-
Method Details
-
click
public boolean click(@NotNull @NotNull Gui gui, @NotNull @NotNull GuiComponent guiComponent, @NotNull @NotNull InventoryClickEvent event, @NotNull @NotNull Slot slot) Description copied from class:PaneCalled whenever there is being clicked on this pane -
display
Description copied from class:PaneReturns aGuiItemContainerwith all the items that should be displayed of this 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 thePaginatedPanethat is being controlled by this interface. -
getItems
Description copied from class:PaneGets 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
-
setButtonsAlwaysVisible
public void setButtonsAlwaysVisible(boolean visible) Allow to always keep the backward and forward buttons visible when on the first and last page- Parameters:
visible- Whether to keep the buttons visible- Since:
- 0.11.6
-
getPanes
Description copied from class:PaneGets 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
-
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
-