open class PagedListHolder<E : Any> : Serializable
PagedListHolder is a simple state holder for handling lists of objects, separating them into pages. Page numbering starts with 0.
This is mainly targetted at usage in web UIs. Typically, an instance will be instantiated with a list of beans, put into the session, and exported as model. The properties can all be set/get programmatically, but the most common way will be data binding, i.e. populating the bean from request parameters. The getters will mainly be used by the view.
Supports sorting the underlying list via a SortDefinition implementation, available as property "sort". By default, a MutableSortDefinition instance will be used, toggling the ascending value on setting the same property again.
The data binding names have to be called "pageSize" and "sort.ascending", as expected by BeanWrapper. Note that the names and the nesting syntax match the respective JSTL EL expressions, like "myModelAttr.pageSize" and "myModelAttr.sort.ascending".
Author
Juergen Hoeller
Since
19.05.2003
See Also
#getPageList()org.springframework.beans.support.MutableSortDefinition
PagedListHolder()
Create a new holder instance. You'll need to set a source list to be able to use the holder. PagedListHolder(source: MutableList<E>)
Create a new holder instance with the given source list, starting with a default sort definition (with "toggleAscendingOnProperty" activated). PagedListHolder(source: MutableList<E>, sort: SortDefinition)
Create a new holder instance with the given source list. |
static val DEFAULT_MAX_LINKED_PAGES: Int |
|
static val DEFAULT_PAGE_SIZE: Int |
open fun getFirstElementOnPage(): Int
Return the element index of the first element on the current page. Element numbering starts with 0. |
|
open fun getFirstLinkedPage(): Int
Return the first page to which create a link around the current page. |
|
open fun getLastElementOnPage(): Int
Return the element index of the last element on the current page. Element numbering starts with 0. |
|
open fun getLastLinkedPage(): Int
Return the last page to which create a link around the current page. |
|
open fun getMaxLinkedPages(): Int
Return the maximum number of page links to a few pages around the current one. |
|
open fun getNrOfElements(): Int
Return the total number of elements in the source list. |
|
open fun getPage(): Int
Return the current page number. Page numbering starts with 0. |
|
open fun getPageCount(): Int
Return the number of pages for the current source list. |
|
open fun getPageList(): MutableList<E>
Return a sub-list representing the current page. |
|
open fun getPageSize(): Int
Return the current page size. |
|
open fun getRefreshDate(): Date
Return the last time the list has been fetched from the source provider. |
|
open fun getSort(): SortDefinition
Return the sort definition for this holder. |
|
open fun getSource(): MutableList<E>
Return the source list for this holder. |
|
open fun isFirstPage(): Boolean
Return if the current page is the first one. |
|
open fun isLastPage(): Boolean
Return if the current page is the last one. |
|
open fun nextPage(): Unit
Switch to next page. Will stay on last page if already on last page. |
|
open fun previousPage(): Unit
Switch to previous page. Will stay on first page if already on first page. |
|
open fun resort(): Unit
Resort the list if necessary, i.e. if the current Calls |
|
open fun setMaxLinkedPages(maxLinkedPages: Int): Unit
Set the maximum number of page links to a few pages around the current one. |
|
open fun setPage(page: Int): Unit
Set the current page number. Page numbering starts with 0. |
|
open fun setPageSize(pageSize: Int): Unit
Set the current page size. Resets the current page number if changed. Default value is 10. |
|
open fun setSort(sort: SortDefinition): Unit
Set the sort definition for this holder. Typically an instance of MutableSortDefinition. |
|
open fun setSource(source: MutableList<E>): Unit
Set the source list for this holder. |