A page model is a helper class to apply a pages to a collection of
elements or an iterator of elements and supports creating URLs for
continued paging through the elements.
The page model is intended to be initialized with the collection or
iterator, than the paging position is applyed and than the elements are
extracted with getPageElements().
In case the page model is initialized with a collection the page model
can be reused multiple times.
Returns the index number of the current page. The page
counting starts with 0. The method also works with a miss-aligned
start. In that case the start is always treated as the start of
a page.
Returns the maximum possible page number. Counting for pages starts
with 0. The method also works with a miss-aligned start. In that case
the returned number might be higher than ((count-1) / pageSize).
Returns the total page count. The method also works
with a miss-aligned start. In that case the returned number might
be higher than (count / pageSize).
Returns an iterator that can be used to iterate through the elements of
the current page.
In case of a collection as the page models source, the method can be
called multiple times. Each time a fresh iterator is returned.
In case of an iterator as the page models source, the method must be
called only once. The method will always return the same iterator,
which means the method amy return an exhausted iterator.
Constructs the PagingModel using the specified iterator and count value.
Count must not be negative.
Note: A valid count must be provided. The PageModel class can not be used
if the number of elements is unknown. Without knowning the number of
elements it still would be possible to return the elements of a particular
page, but it would be not possible to calculate data like the total number
of pages or to construct an URL to jump to a particular page.
Parameters:
elements - the iterator containing the model elements.
Returns an URL containing the page size parameter appended to the
specified url. The name of the page size parameter is 'sz' (see
PAGE_SIZE_PARAMETER). The start position parameter is not appended to the
returned URL.
Parameters:
url - the URL to append the page size parameter to.
Returns an URL by appending the paging parameters for a desired
page start position and the current page size to the specified url. The name of
the page start position parameter is 'start' (see PAGING_START_PARAMETER)
and the page size parameter is 'sz' (see PAGE_SIZE_PARAMETER).
Returns the index number of the current page. The page
counting starts with 0. The method also works with a miss-aligned
start. In that case the start is always treated as the start of
a page.
Returns the maximum possible page number. Counting for pages starts
with 0. The method also works with a miss-aligned start. In that case
the returned number might be higher than ((count-1) / pageSize).
Returns the total page count. The method also works
with a miss-aligned start. In that case the returned number might
be higher than (count / pageSize).
Returns an iterator that can be used to iterate through the elements of
the current page.
In case of a collection as the page models source, the method can be
called multiple times. Each time a fresh iterator is returned.
In case of an iterator as the page models source, the method must be
called only once. The method will always return the same iterator,
which means the method amy return an exhausted iterator.
Returns:
an iterator that you use to iterate through
the elements of the current page.