public class

PaginationSupport

extends Object
java.lang.Object
   ↳ bucket.core.actions.PaginationSupport
Known Direct Subclasses

Class Overview

Where there are a _very_ large number of items to paginate (in othe order of 10,000's), loading them all up in memory from the db and then handing them out to the user in a .subList fashion is not very efficient In this scenario we only want to use this bean to compute our next and previous indexes. Hence please use this bean in one of two ways (a) set _items_ on this bean and have the bean slice and dice up the uber collection for you and serve it to you with getPage() OR (b) set the total on this bean _only_ and leave the items _alone_. this is recommended for really large collections where its not ideal to load them all up.

Summary

Fields
public static int DEFAULT_COUNT_ON_EACH_PAGE
public static int DEFAULT_PAGE_SIZE
Public Constructors
PaginationSupport()
PaginationSupport(int pageSize)
Public Methods
int getCountOnEachPage()
This method is deprecated. since 3.0 (at least). Please use getPageSize()
int getEndIndex()
This method is deprecated. since 3.0 (at least). Please use getNiceEndIndex()
List getItems()
int getNextIndex()
This method is deprecated. since 3.0 (at least). Please use getNextStartIndex()
int getNextStartIndex()
Returns the next start index.
int[] getNextStartIndexes()
int getNiceEndIndex()
int getNiceStartIndex()
List getPage()
Returns a subset of the list of items passed in, based on startIndex and the page size
int getPageSize()
int getPreviousIndex()
This method is deprecated. since 3.0 (at least). Please use getPreviousStartIndex()
int getPreviousStartIndex()
Returns the previous start index.
int[] getPreviousStartIndexes()
int getStartIndex()
Returns the start index.
int getStartIndexValue()
Always return the start index value, regardless of whether the pagination has any total.
int getTotal()
void setItems(List items)
void setPageSize(int pageSize)
void setStartIndex(int startIndex)
void setTotal(int total)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static int DEFAULT_COUNT_ON_EACH_PAGE

public static int DEFAULT_PAGE_SIZE

Public Constructors

public PaginationSupport ()

public PaginationSupport (int pageSize)

Public Methods

public int getCountOnEachPage ()

This method is deprecated.
since 3.0 (at least). Please use getPageSize()

public int getEndIndex ()

This method is deprecated.
since 3.0 (at least). Please use getNiceEndIndex()

This implementation always returned the nice end index. The correct end index would have been one less. Deprecating this and introduce a new method that has a more accurate name.

public List getItems ()

public int getNextIndex ()

This method is deprecated.
since 3.0 (at least). Please use getNextStartIndex()

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 ()

public int getNiceEndIndex ()

public int getNiceStartIndex ()

public List getPage ()

Returns a subset of the list of items passed in, based on startIndex and the page size

Returns
  • a subset of the list of items passed in, based on startIndex and the page size

public int getPageSize ()

public int getPreviousIndex ()

This method is deprecated.
since 3.0 (at least). Please use getPreviousStartIndex()

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 ()

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.

public int getTotal ()

public void setItems (List items)

public void setPageSize (int pageSize)

public void setStartIndex (int startIndex)

public void setTotal (int total)