public class

PagerPaginationSupport

extends Object
implements PaginationSupport<T>
java.lang.Object
   ↳ bucket.core.actions.PagerPaginationSupport

Class Overview

This class stores its items using a Pager - which cannot report the total size of the result. The getCurrentPage() returns a list of objects currently loaded in memory, which can return a size(). This number is imprecise, however, and is used as functional approximation. For various reasons explained in the {#link Pager} javadoc, the only way to gain an accurate total size from a {#link Pager} is by using its iterator and keeping count of each object. If you have a regular, average sized list of items then use PaginationSupport.

Summary

Fields
public static int DEFAULT_COUNT_ON_EACH_PAGE
public int[] nextStartIndexes
public List page
public Integer pagerSize
public int[] previousStartIndexes
Public Constructors
PagerPaginationSupport()
PagerPaginationSupport(int countOnEachPage)
Public Methods
int getCountOnEachPage()
int getEndIndex()
Pager getItems()
int getNextIndex()
int getNextStartIndex()
Returns the next start index.
int[] getNextStartIndexes()
Returns an array of start indexes for pages that appear after the current page If there are no further pages, null is returned
int getNiceEndIndex()
Returns an end index for use in the UI.
int getNiceStartIndex()
Returns a start index for use in the UI.
List getPage()
returns a subset of the list of items passed in, based on startIndex and the max result per page
int getPageSize()
Returns the number of items available on the current page.
int getPreviousIndex()
int getPreviousStartIndex()
Returns the previous start index.
int[] getPreviousStartIndexes()
Returns an array of start indexes for pages that appear before the current page If there are no preceding pages, null is returned
int getStartIndex()
Returns the start index.
int getStartIndexValue()
Always return the start index value, regardless of whether the pagination has any total.
int getTotal()
Returns the total number of items in the list
boolean isTryNext()
void setItems(Pager items)
void setStartIndex(int startIndex)
void setTryNext(boolean tryNext)
void skipTo(int indexPosition)
[Expand]
Inherited Methods
From class java.lang.Object
From interface bucket.core.PaginationSupport

Fields

public static int DEFAULT_COUNT_ON_EACH_PAGE

public int[] nextStartIndexes

public List page

public Integer pagerSize

public int[] previousStartIndexes

Public Constructors

public PagerPaginationSupport ()

public PagerPaginationSupport (int countOnEachPage)

Public Methods

public int getCountOnEachPage ()

public int getEndIndex ()

public Pager getItems ()

public int getNextIndex ()

public int getNextStartIndex ()

Returns the next start index. Returns -1 if we are on the last page (there is no next page).

Returns
  • the next start index. Returns -1 if we are on the last page (there is no next page).

public int[] getNextStartIndexes ()

Returns an array of start indexes for pages that appear after the current page If there are no further pages, null is returned

Returns
  • an array of start indexes for pages that appear after the current page

public int getNiceEndIndex ()

Returns an end index for use in the UI. It returns the end index - 1

Returns
  • a nice end index

public int getNiceStartIndex ()

Returns a start index for use in the UI. It returns the start index + 1

Returns
  • a nice start index

public List getPage ()

returns a subset of the list of items passed in, based on startIndex and the max result per page

Returns
  • a page of results

public int getPageSize ()

Returns the number of items available on the current page.

Returns
  • the number of items available on the current page.

public int getPreviousIndex ()

public int getPreviousStartIndex ()

Returns the previous start index. Returns -1 if we are on the first page (there is no previous page).

Returns
  • the previous start index. Returns -1 if we are on the first page (there is no previous page).

public int[] getPreviousStartIndexes ()

Returns an array of start indexes for pages that appear before the current page If there are no preceding pages, null is returned

Returns
  • an array of start indexes for pages that appear before the current page

public int getStartIndex ()

Returns the start index. If the start index exceeds the index of the last element, the index of the last element is returned. If the start index is less than 0, 0 is returned.

Returns
  • the start index.

public int getStartIndexValue ()

Always return the start index value, regardless of whether the pagination has any total.

Returns
  • the start index value, regardless of whether the pagination has any total.

public int getTotal ()

Returns the total number of items in the list

Returns
  • total number of items in the list

public boolean isTryNext ()

public void setItems (Pager items)

public void setStartIndex (int startIndex)

public void setTryNext (boolean tryNext)

public void skipTo (int indexPosition)