Package space.maxus.flare.ui.page
Interface Pagination<P>
- Type Parameters:
P- Type of the underlying page props
- All Known Implementing Classes:
DefaultPagination
public interface Pagination<P>
A pagination is used to include multiple sub-frames (pages) inside a single frame
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddSharedData(Map<ComposableSpace, Composable> packed) Adds shared data to this pagination.voidclose()Closes this paginationvoidcommit()Finishes the initialization of this pagination.voidcomposePrioritizedShared(@NotNull Callable<PackedComposable> packed) Adds prioritized shared components to this pagination.default voidcomposeShared(@NotNull PackedComposable packed) Composes shared packed composable data for this pagination.voidcomposeShared(@NotNull ComposableSpace space, @NotNull Composable composable) Adds shared component to this pagination.createPage(int page, @Nullable String title, P props) Creates a single page framedefault FramecreatePage(@Nullable String title, P props) Creates a frame with props and titledefault FramecreatePage(P props) Creates a frame with propsintGets the zero-based index of currently open pagevoidEnables pagination for current frame.getPage(int page) Gets the page with provided numberdefault voidnextPage(org.bukkit.entity.Player viewer) Switches to the next page for the viewerintIncrements atomic counter and returns the index of the next pagevoidopen(org.bukkit.entity.Player player) Opens this pagination to playerintGets the current count of pages@Nullable FramePeeks the previous frame in this paginationdefault voidpreviousPage(org.bukkit.entity.Player viewer) Switches to the previous page for the viewervoidsetPage(int page) Sets current page numbervoidswitchPage(org.bukkit.entity.Player viewer, int to) Switches page for viewer to certain index
-
Method Details
-
createPage
Creates a single page frame- Parameters:
page- Number of the pagetitle- Title of the pageprops- Props passed to the page- Returns:
- Constructed page
-
getPage
Gets the page with provided number- Parameters:
page- Number of the page- Returns:
- Found page
-
setPage
void setPage(int page) Sets current page number- Parameters:
page- New page number
-
nextPageIdx
int nextPageIdx()Increments atomic counter and returns the index of the next page- Returns:
- Zero-based index of the next page
-
pageCount
int pageCount()Gets the current count of pages- Returns:
- Current count of pages
-
currentPage
int currentPage()Gets the zero-based index of currently open page- Returns:
- Zero-based index of currently open page
-
enable
Enables pagination for current frame. Partially internal method- Parameters:
currentFrame- Frame to be used
-
switchPage
void switchPage(org.bukkit.entity.Player viewer, int to) Switches page for viewer to certain index- Parameters:
viewer- Viewer of this paginationto- Zero-based index of page to change to
-
open
void open(org.bukkit.entity.Player player) Opens this pagination to player- Parameters:
player- Player for whom to open this pagination
-
close
void close()Closes this pagination -
peekPrevious
Peeks the previous frame in this pagination- Returns:
- Previous frame or null
-
commit
void commit()Finishes the initialization of this pagination. After this method callcomposeShared(space.maxus.flare.ui.space.ComposableSpace, space.maxus.flare.ui.Composable), etc. will not have any effect. -
createPage
Creates a frame with props- Parameters:
props- Props for the frame- Returns:
- Constructed page frame
-
createPage
Creates a frame with props and title- Parameters:
props- Props for the frametitle- Title of the frame- Returns:
- Constructed page frame
-
nextPage
default void nextPage(org.bukkit.entity.Player viewer) Switches to the next page for the viewer- Parameters:
viewer- Viewer observing this pagination
-
previousPage
default void previousPage(org.bukkit.entity.Player viewer) Switches to the previous page for the viewer- Parameters:
viewer- Viewer observing this pagination
-