Paginators

Factory for multiple pagination types.

Resource usage

Since paginators heavily rely on ephemeral components, they might consume more memory if not cleaned up.

In case the paginator is deleted, calling AbstractPaginator.cleanup allows cleaning up early. If this is not called, it will be done when the paginator expires.

By default, components used in a page are invalidated when a new page is requested. In case you want to reuse components, you can make the components be only invalidated once the pagination expires by disabling AbstractPaginationBuilder.cleanAfterRefresh.

Timeout

Paginators have a default timeout set to Components.defaultTimeout, which can be modified using AbstractPaginationBuilder.setTimeout.

You can also disable the timeout using AbstractPaginationBuilder.noTimeout, in which case you will need to clean up the components manually.

Constructors

Link copied to clipboard
constructor(context: BContext)

Functions

Link copied to clipboard
fun <E> buttonMenu(entries: List<E>, buttonContentSupplier: ButtonMenu.ButtonContentSupplier<E>, callback: SuspendingChoiceCallback<E>): ButtonMenuBuilder<E>

A paginator where each page is filled with a list of entries.

Link copied to clipboard
@JvmName(name = "buttonMenu")
fun <E> buttonMenuJava(entries: List<E>, buttonContentSupplier: ButtonMenu.ButtonContentSupplier<E>, callback: BlockingChoiceCallback<E>): ButtonMenuBuilder<E>

A paginator where each page is filled with a list of entries.

Link copied to clipboard

Classic paginator, where each page is generated by a CustomPageEditor.

Link copied to clipboard
fun <E> menu(entries: List<E>): MenuBuilder<E>

A paginator where each page is filled with a list of entries.

Link copied to clipboard

A paginator which wraps a paginator, with a select menu to switch between them.

Link copied to clipboard
fun paginator(maxPages: Int, pageEditor: PageEditor<Paginator>): PaginatorBuilder

Classic paginator, where each page is generated by a PageEditor.

Link copied to clipboard