public class DefaultDynObjectPagingHelper extends AbstractDisposable implements DynObjectPagingHelper
DynObjectPagingHelper
implementation.PagingCalculator.Sizeable
DEFAULT_PAGE_SIZE
Constructor and Description |
---|
DefaultDynObjectPagingHelper() |
DefaultDynObjectPagingHelper(DynObjectSet set) |
DefaultDynObjectPagingHelper(DynObjectSet set,
int pageSize) |
Modifier and Type | Method and Description |
---|---|
protected void |
doDispose()
Internal implementation for the
AbstractDisposable.dispose() method, to be
implemented by child classes. |
protected PagingCalculator |
getCalculator() |
long |
getCurrentPage()
Returns the number of the currently loaded page of data (zero
based).
|
DynObject[] |
getCurrentPageDynObjects()
Returns all the values of the current loaded page.
|
int |
getCurrentPageSize()
Returns the number of elements of the current page.
|
DynObject |
getDynObjectAt(long index)
Returns the
DynObject located at the index position. |
DynObjectSet |
getDynObjectSet()
Returns the
DynObjectSet used to fetch the data. |
long |
getInitialIndex()
Returns the index of the initial element of the current page into all the
elements.
|
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.
|
protected void |
loadCurrentPageData() |
void |
reload()
Reloads everything.
|
void |
reloadCurrentPage()
Reloads the current page of data from the set.
|
protected void |
setCalculator(PagingCalculator calculator) |
void |
setCurrentPage(long page)
Sets the current page number (zero based), and loads the elements for
that page.
|
protected void |
setDefaultCalculator(PagingCalculator.Sizeable sizeable,
int pageSize) |
protected void |
setDynObjectSet(DynObjectSet set,
int pageSize) |
void |
setMaxPageSize(int pageSize)
Sets the current maximum number of elements per page.
|
dispose, dispose
public DefaultDynObjectPagingHelper()
public DefaultDynObjectPagingHelper(DynObjectSet set) throws BaseException
BaseException
public DefaultDynObjectPagingHelper(DynObjectSet set, int pageSize) throws BaseException
BaseException
protected void setDynObjectSet(DynObjectSet set, int pageSize) throws BaseException
BaseException
public DynObject getDynObjectAt(long index) throws BaseException
DynObjectPagingHelper
DynObject
located at the index position.getDynObjectAt
in interface DynObjectPagingHelper
index
- to locate the DynObject in the setBaseException
- if there is an error getting the DynObjectpublic DynObject[] getCurrentPageDynObjects()
DynObjectPagingHelper
getCurrentPageDynObjects
in interface DynObjectPagingHelper
public DynObjectSet getDynObjectSet()
DynObjectPagingHelper
DynObjectSet
used to fetch the data.getDynObjectSet
in interface DynObjectPagingHelper
public void reloadCurrentPage() throws BaseException
DynObjectPagingHelper
reloadCurrentPage
in interface DynObjectPagingHelper
BaseException
- if there is an error reloading the current pageprotected void loadCurrentPageData() throws BaseException
BaseException
public void reload() throws BaseException
DynObjectPagingHelper
reload
in interface DynObjectPagingHelper
BaseException
protected void doDispose() throws BaseException
AbstractDisposable
AbstractDisposable.dispose()
method, to be
implemented by child classes.doDispose
in class AbstractDisposable
BaseException
AbstractDisposable.dispose()
protected PagingCalculator getCalculator()
protected void setCalculator(PagingCalculator calculator) throws BaseException
BaseException
protected void setDefaultCalculator(PagingCalculator.Sizeable sizeable, int pageSize) throws BaseException
BaseException
public int getMaxPageSize()
PagingCalculator
getMaxPageSize
in interface PagingCalculator
public void setMaxPageSize(int pageSize) throws BaseException
PagingCalculator
setMaxPageSize
in interface PagingCalculator
pageSize
- the maximum number of values per pageBaseException
- if there is an error reloading the current pagepublic long getCurrentPage()
PagingCalculator
getCurrentPage
in interface PagingCalculator
public void setCurrentPage(long page) throws BaseException
PagingCalculator
setCurrentPage
in interface PagingCalculator
page
- the page to loadBaseException
- if there is an error setting the current pagepublic long getInitialIndex()
PagingCalculator
getInitialIndex
in interface PagingCalculator
public long getNumPages()
PagingCalculator
getNumPages
in interface PagingCalculator
public long getTotalSize()
PagingCalculator
getTotalSize
in interface PagingCalculator
public int getCurrentPageSize()
PagingCalculator
getCurrentPageSize
in interface PagingCalculator