C
- the type of data for the input objectD
- the type of data to be returned by the loaderpublic class PagingLoader<C extends PagingLoadConfig,D extends PagingLoadResult<?>> extends ListLoader<C,D>
ListLoader
subclass which adds support for paged data (offset,
limit, and total count).Constructor and Description |
---|
PagingLoader(DataProxy<C,D> proxy)
Creates a new paging loader instance.
|
PagingLoader(DataProxy<C,T> proxy,
DataReader<D,T> reader)
Creates a new paging loader instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getLimit()
Returns the current limit.
|
int |
getOffset()
Returns the offset of the first record.
|
int |
getTotalCount()
Returns the total number of models in the dataset as returned by the
server.
|
void |
load(int offset,
int limit)
Loads the data using the specified configuration.
|
protected C |
newLoadConfig()
Template method to allow custom BaseLoader subclasses to provide their own
implementation of LoadConfig
|
protected void |
onLoadSuccess(C loadConfig,
D result)
Called when the remote data has been received.
|
protected C |
prepareLoadConfig(C config)
Template method to allow custom subclasses to prepare the load config prior
to loading data
|
void |
setLimit(int limit)
Sets the limit size.
|
void |
setOffset(int offset)
Sets the offset.
|
void |
useLoadConfig(C loadConfig)
Use the specified LoadConfig for all load calls,
Loader.setReuseLoadConfig(boolean) will be set to true. |
addSortInfo, addSortInfo, clearSortInfo, getSortInfo, isRemoteSort, removeSortInfo, setRemoteSort
addBeforeLoadHandler, addHandler, addLoaderHandler, addLoadExceptionHandler, addLoadHandler, fireEvent, getLastLoadConfig, getProxy, isReuseLoadConfig, load, load, loadData, loadData, onLoadFailure, setLastLoadConfig, setReuseLoadConfig
public PagingLoader(DataProxy<C,D> proxy)
proxy
- the data proxypublic PagingLoader(DataProxy<C,T> proxy, DataReader<D,T> reader)
proxy
- the data proxyreader
- the data readerpublic int getLimit()
public int getOffset()
public int getTotalCount()
public void load(int offset, int limit)
offset
- the offset of the first record to returnlimit
- the page sizepublic void setLimit(int limit)
limit
- the limitpublic void setOffset(int offset)
offset
- the offsetpublic void useLoadConfig(C loadConfig)
Loader.setReuseLoadConfig(boolean)
will be set to true.useLoadConfig
in class ListLoader<C extends PagingLoadConfig,D extends PagingLoadResult<?>>
protected C newLoadConfig()
ListLoader
newLoadConfig
in class ListLoader<C extends PagingLoadConfig,D extends PagingLoadResult<?>>
protected void onLoadSuccess(C loadConfig, D result)
onLoadSuccess
should call
super.onLoadSuccess
with the result to make sure the loader
and the result have consistent data.onLoadSuccess
in class Loader<C extends PagingLoadConfig,D extends PagingLoadResult<?>>
loadConfig
- the load configresult
- dataprotected C prepareLoadConfig(C config)
ListLoader
prepareLoadConfig
in class ListLoader<C extends PagingLoadConfig,D extends PagingLoadResult<?>>
Copyright © 2018. All rights reserved.