Package space.maxus.flare.ui.page
Class DefaultPagination
java.lang.Object
space.maxus.flare.ui.page.DefaultPagination
- All Implemented Interfaces:
Pagination<Consumer<PageFrame>>
A default pagination implementation
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPagination(int defaultPage) Constructs a new default pagination with default page -
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.voidcomposeShared(@NotNull ComposableSpace space, @NotNull Composable composable) Adds shared component to this pagination.@NotNull FramecreatePage(int page, @Nullable String title, @NotNull Consumer<PageFrame> props) Creates a single page frameintGets the zero-based index of currently open pagevoidEnables pagination for current frame.getPage(int page) Gets the page with provided numberintIncrements 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 paginationvoidsetPage(int page) Sets current page numbervoidswitchPage(org.bukkit.entity.Player viewer, int to) Switches page for viewer to certain indexMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface space.maxus.flare.ui.page.Pagination
composeShared, createPage, createPage, nextPage, previousPage
-
Constructor Details
-
DefaultPagination
public DefaultPagination(int defaultPage) Constructs a new default pagination with default page- Parameters:
defaultPage- Default page
-
-
Method Details
-
createPage
@NotNull public @NotNull Frame createPage(int page, @Nullable @Nullable String title, @NotNull @NotNull Consumer<PageFrame> props) Description copied from interface:PaginationCreates a single page frame- Specified by:
createPagein interfacePagination<Consumer<PageFrame>>- Parameters:
page- Number of the pagetitle- Title of the pageprops- Props passed to the page- Returns:
- Constructed page
-
getPage
Description copied from interface:PaginationGets the page with provided number- Specified by:
getPagein interfacePagination<Consumer<PageFrame>>- Parameters:
page- Number of the page- Returns:
- Found page
-
setPage
public void setPage(int page) Description copied from interface:PaginationSets current page number- Specified by:
setPagein interfacePagination<Consumer<PageFrame>>- Parameters:
page- New page number
-
nextPageIdx
public int nextPageIdx()Description copied from interface:PaginationIncrements atomic counter and returns the index of the next page- Specified by:
nextPageIdxin interfacePagination<Consumer<PageFrame>>- Returns:
- Zero-based index of the next page
-
pageCount
public int pageCount()Description copied from interface:PaginationGets the current count of pages- Specified by:
pageCountin interfacePagination<Consumer<PageFrame>>- Returns:
- Current count of pages
-
currentPage
public int currentPage()Description copied from interface:PaginationGets the zero-based index of currently open page- Specified by:
currentPagein interfacePagination<Consumer<PageFrame>>- Returns:
- Zero-based index of currently open page
-
enable
Description copied from interface:PaginationEnables pagination for current frame. Partially internal method- Specified by:
enablein interfacePagination<Consumer<PageFrame>>- Parameters:
currentFrame- Frame to be used
-
switchPage
public void switchPage(org.bukkit.entity.Player viewer, int to) Description copied from interface:PaginationSwitches page for viewer to certain index- Specified by:
switchPagein interfacePagination<Consumer<PageFrame>>- Parameters:
viewer- Viewer of this paginationto- Zero-based index of page to change to
-
open
public void open(org.bukkit.entity.Player player) Description copied from interface:PaginationOpens this pagination to player- Specified by:
openin interfacePagination<Consumer<PageFrame>>- Parameters:
player- Player for whom to open this pagination
-
close
public void close()Description copied from interface:PaginationCloses this pagination- Specified by:
closein interfacePagination<Consumer<PageFrame>>
-
peekPrevious
Description copied from interface:PaginationPeeks the previous frame in this pagination- Specified by:
peekPreviousin interfacePagination<Consumer<PageFrame>>- Returns:
- Previous frame or null
-
commit
public void commit()Description copied from interface:PaginationFinishes the initialization of this pagination. After this method callPagination.composeShared(space.maxus.flare.ui.space.ComposableSpace, space.maxus.flare.ui.Composable), etc. will not have any effect.- Specified by:
commitin interfacePagination<Consumer<PageFrame>>
-