Usage example:
// Create a pagination component
BasePagination pagination = new BasePagination() {
// Override the moveToPage method to implement navigation logic
protected void moveToPage(int page, boolean silent) {
// Your implementation here
}
};
// Add pagination to a container element
container.appendChild(pagination.element());
// Update the pagination with total count and page size
pagination.updatePagesByTotalCount(100);
T
The concrete type of the pagination component.
See also :
public void BasePagination()
public T showFirstLastPage(boolean visible)
visible
true to show, false to hide.
The BasePagination instance.
public T showNextPrevPage(boolean visible)
visible
true to show, false to hide.
The BasePagination instance.
public T updatePagesByTotalCount(int totalCount)
totalCount
The total count of items.
The BasePagination instance.
public T updatePagesByTotalCount(int totalCount, boolean silent)
totalCount
The total count of items.
silent
true to update silently (without triggering listeners), false otherwise.
The BasePagination instance.
public T updatePagesByTotalCount(int totalCount, int pageSize)
totalCount
The total count of items.
pageSize
The custom page size.
The BasePagination instance.
public T updatePagesByTotalCount(int totalCount, int pageSize, boolean silent)
totalCount
The total count of items.
pageSize
The custom page size.
silent
true to update silently (without triggering listeners), false otherwise.
The BasePagination instance.
public T updatePages(int pages)
pages
The number of pages.
The BasePagination instance.
public T updatePages(int pages, int pageSize)
pages
The number of pages.
pageSize
The custom page size.
The BasePagination instance.
public T gotoPage(int page)
page
The page number to navigate to.
The BasePagination instance.
public T gotoPage(int page, boolean silent)
page
The page number to navigate to.
silent
true to navigate silently (without triggering listeners), false otherwise.
The BasePagination instance.
public T nextPage()
The BasePagination instance.
public T previousPage()
The BasePagination instance.
public T nextPage(boolean silent)
silent
true to navigate silently (without triggering listeners), false otherwise.
The BasePagination instance.
public T previousPage(boolean silent)
silent
true to navigate silently (without triggering listeners), false otherwise.
The BasePagination instance.
public T gotoFirst()
The BasePagination instance.
public T gotoLast()
The BasePagination instance.
public T gotoFirst(boolean silent)
silent
true to navigate silently (without triggering listeners), false otherwise.
The BasePagination instance.
public T gotoLast(boolean silent)
silent
true to navigate silently (without triggering listeners), false otherwise.
The BasePagination instance.
public T markActivePage()
true , this method is automatically called when navigating between pages.
The BasePagination instance.
public T setMarkActivePage(boolean markActivePage)
markActivePage
true to mark the active page as active, false to remove the "active" class.
The BasePagination instance.
public T gotoPageByRecordIndex(int index)
index
The zero-based index of the record for which the page should be navigated.
The current instance of the class, allowing method chaining.
public T gotoPageByRecordIndex(int index, boolean silent)
index
the zero-based index of the record to navigate to
silent
if true, suppresses side effects or notifications resulting from the navigation
the current instance after performing the navigation
public int getTotalCount()
The total count of items.
public T setPageSize(int pageSize)
pageSize
The page size.
The BasePagination instance.
public int getPageSize()
The page size.
public int activePage()
The active page index.
public int getPagesCount()
The total number of pages.
public T withNavElement(ChildHandler<T, NavElement> handler)
handler
A ChildHandler to configure the navigation element.
The BasePagination instance.
public T withPageList(ChildHandler<T, UListElement> handler)
handler
A ChildHandler to configure the page list element.
The BasePagination instance.
public T withPrevPageNav(ChildHandler<T, PagerNavItem> handler)
handler
A ChildHandler to configure the previous page navigation element.
The BasePagination instance.
public T withNextPageNav(ChildHandler<T, PagerNavItem> handler)
handler
A ChildHandler to configure the next page navigation element.
The BasePagination instance.
public T withFirstPageNav(ChildHandler<T, PagerNavItem> handler)
handler
A ChildHandler to configure the first page navigation element.
The BasePagination instance.
public T withLastPageNav(ChildHandler<T, PagerNavItem> handler)
handler
A ChildHandler to configure the last page navigation element.
The BasePagination instance.
public T pauseChangeListeners()
The BasePagination instance.
public T resumeChangeListeners()
The BasePagination instance.
public T togglePauseChangeListeners(boolean toggle)
toggle
If true, change listeners will be paused; otherwise, they will be resumed.
The BasePagination instance.
public Set<ChangeListener<? super Integer>> getChangeListeners()
A set of ChangeListener objects.
public boolean isChangeListenersPaused()
True if change listeners are paused, false otherwise.
public T triggerChangeListeners(Integer oldValue, Integer newValue)
oldValue
The old value before the change.
newValue
The new value after the change.
The BasePagination instance.