Interface Pagination
public interface Pagination
Paginates a list of items across a region of slots. Obtain via
ViewContents.pagination(), configure the region and items, then navigate;
every change re-renders the region automatically.
contents.pagination()
.slots(layout, 'p')
.items(shopEntries);
-
Method Summary
Modifier and TypeMethodDescriptionfirst()Jumps to the first page.booleanisFirst()True when on the first page.booleanisLast()True when on the last page.Sets (or replaces) the items to paginate.intNumber of slots per page (the size of the configured region).last()Jumps to the last page.next()Advances one page if possible.open(int page) Jumps to a page (clamped to the valid range) and re-renders.intpage()Current zero-based page.intTotal number of pages (at least 1, even with no items).previous()Goes back one page if possible.voidrender()Re-renders the current page into the region (e.g. after external changes).slots(int... slots) Sets the unique slots the items flow into, in the given order.Sets the region to all slots marked withcharacterinlayout.
-
Method Details
-
slots
Sets the unique slots the items flow into, in the given order. Resets to page 0.- Throws:
IllegalArgumentException- if a slot is out of range or duplicated
-
slots
Sets the region to all slots marked withcharacterinlayout. -
items
Sets (or replaces) the items to paginate. Re-renders and clamps the current page. -
page
int page()Current zero-based page. -
pageCount
int pageCount()Total number of pages (at least 1, even with no items). -
itemsPerPage
int itemsPerPage()Number of slots per page (the size of the configured region). -
isFirst
boolean isFirst()True when on the first page. -
isLast
boolean isLast()True when on the last page. -
open
Jumps to a page (clamped to the valid range) and re-renders. -
next
Pagination next()Advances one page if possible. -
previous
Pagination previous()Goes back one page if possible. -
first
Pagination first()Jumps to the first page. -
last
Pagination last()Jumps to the last page. -
render
void render()Re-renders the current page into the region (e.g. after external changes).
-