public class DefaultPagingCalculator extends Object implements PagingCalculator
PagingCalculator implementation.PagingCalculator.SizeableDEFAULT_PAGE_SIZE| Constructor and Description |
|---|
DefaultPagingCalculator(PagingCalculator.Sizeable sizeable)
Creates a new
DefaultPagingCalculator, with the default page
size (PagingCalculator.DEFAULT_PAGE_SIZE), setting the current
page to the first one. |
DefaultPagingCalculator(PagingCalculator.Sizeable sizeable,
int maxPageSize)
Creates a new
DefaultPagingCalculator, setting the current page
to the first one. |
DefaultPagingCalculator(PagingCalculator.Sizeable sizeable,
int maxPageSize,
long currentPage)
Creates a new
DefaultPagingCalculator . |
| Modifier and Type | Method and Description |
|---|---|
long |
getCurrentPage()
Returns the number of the currently loaded page of data (zero
based).
|
int |
getCurrentPageSize()
Returns the number of elements of the current page.
|
long |
getInitialIndex()
Returns the index of the initial element of the current page into all the
elements.
|
protected long |
getLastIndex() |
int |
getMaxPageSize()
Returns the current maximum number of values per page.
|
long |
getNumPages()
Returns the number of pages available, calculated with the total number
of elements and the maximum number of elements per page.
|
long |
getTotalSize()
Returns the number of elements of the entire set of data.
|
void |
setCurrentPage(long currentPage)
Sets the current page number (zero based), and loads the elements for
that page.
|
void |
setMaxPageSize(int maxPageSize)
Sets the current maximum number of elements per page.
|
public DefaultPagingCalculator(PagingCalculator.Sizeable sizeable)
DefaultPagingCalculator, with the default page
size (PagingCalculator.DEFAULT_PAGE_SIZE), setting the current
page to the first one.public DefaultPagingCalculator(PagingCalculator.Sizeable sizeable, int maxPageSize)
DefaultPagingCalculator, setting the current page
to the first one.maxPageSize - the maximum page sizepublic DefaultPagingCalculator(PagingCalculator.Sizeable sizeable, int maxPageSize, long currentPage)
DefaultPagingCalculator .maxPageSize - the maximum page sizecurrentPage - the current pagepublic int getMaxPageSize()
PagingCalculatorgetMaxPageSize in interface PagingCalculatorpublic void setMaxPageSize(int maxPageSize)
PagingCalculatorsetMaxPageSize in interface PagingCalculatormaxPageSize - the maximum number of values per pagepublic long getCurrentPage()
PagingCalculatorgetCurrentPage in interface PagingCalculatorpublic void setCurrentPage(long currentPage)
PagingCalculatorsetCurrentPage in interface PagingCalculatorcurrentPage - the page to loadpublic long getInitialIndex()
PagingCalculatorgetInitialIndex in interface PagingCalculatorprotected long getLastIndex()
public long getNumPages()
PagingCalculatorgetNumPages in interface PagingCalculatorpublic int getCurrentPageSize()
PagingCalculatorgetCurrentPageSize in interface PagingCalculatorpublic long getTotalSize()
PagingCalculatorgetTotalSize in interface PagingCalculator