com.extjs.gxt.ui.client.data
Class BasePagingLoader<D extends PagingLoadResult<?>>

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.data.BaseLoader<D>
          extended by com.extjs.gxt.ui.client.data.BaseListLoader<D>
              extended by com.extjs.gxt.ui.client.data.BasePagingLoader<D>
Type Parameters:
D - the PagingLoadResult type being returned by this loader
All Implemented Interfaces:
ListLoader<D>, Loader<D>, PagingLoader<D>, Observable

public class BasePagingLoader<D extends PagingLoadResult<?>>
extends BaseListLoader<D>
implements PagingLoader<D>

Default implementation of the PagingLoader interface.


Field Summary
protected  int limit
           
protected  int offset
           
protected  int totalCount
           
 
Fields inherited from class com.extjs.gxt.ui.client.data.BaseLoader
lastConfig, proxy, reader, reuseConfig
 
Fields inherited from interface com.extjs.gxt.ui.client.data.Loader
BeforeLoad, Load, LoadException
 
Constructor Summary
BasePagingLoader(DataProxy proxy)
          Creates a new paging loader instance.
BasePagingLoader(DataProxy proxy, DataReader reader)
          Creates a new paging loader instance.
 
Method Summary
 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  java.lang.Object newLoadConfig()
          Template method to allow custom BaseLoader subclasses to provide their own implementation of LoadConfig
protected  void onLoadSuccess(java.lang.Object loadConfig, D result)
          Called when the remote data has been received.
protected  java.lang.Object prepareLoadConfig(java.lang.Object 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(java.lang.Object loadConfig)
          Use the specified LoadConfig for all load calls.
 
Methods inherited from class com.extjs.gxt.ui.client.data.BaseListLoader
getSortDir, getSortField, isRemoteSort, setRemoteSort, setSortDir, setSortField
 
Methods inherited from class com.extjs.gxt.ui.client.data.BaseLoader
addLoadListener, getLastConfig, getProxy, isReuseLoadConfig, load, load, loadData, loadData, onLoadFailure, removeLoadListener, setReuseLoadConfig
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.extjs.gxt.ui.client.data.ListLoader
getSortDir, getSortField, isRemoteSort, setRemoteSort, setSortDir, setSortField
 
Methods inherited from interface com.extjs.gxt.ui.client.data.Loader
addLoadListener, load, load, removeLoadListener
 
Methods inherited from interface com.extjs.gxt.ui.client.event.Observable
addListener, fireEvent, getListeners, hasListeners, hasListeners, removeAllListeners, removeListener
 

Field Detail

offset

protected int offset

limit

protected int limit

totalCount

protected int totalCount
Constructor Detail

BasePagingLoader

public BasePagingLoader(DataProxy proxy)
Creates a new paging loader instance.

Parameters:
proxy - the data proxy

BasePagingLoader

public BasePagingLoader(DataProxy proxy,
                        DataReader reader)
Creates a new paging loader instance.

Parameters:
proxy - the data proxy
reader - the data reader
Method Detail

getLimit

public int getLimit()
Description copied from interface: PagingLoader
Returns the current limit.

Specified by:
getLimit in interface PagingLoader<D extends PagingLoadResult<?>>
Returns:
the current limit

getOffset

public int getOffset()
Description copied from interface: PagingLoader
Returns the offset of the first record.

Specified by:
getOffset in interface PagingLoader<D extends PagingLoadResult<?>>
Returns:
the current offset

getTotalCount

public int getTotalCount()
Description copied from interface: PagingLoader
Returns the total number of models in the dataset as returned by the server.

Specified by:
getTotalCount in interface PagingLoader<D extends PagingLoadResult<?>>
Returns:
the number of models as passed from the server

load

public void load(int offset,
                 int limit)
Description copied from interface: PagingLoader
Loads the data using the specified configuration.

Specified by:
load in interface PagingLoader<D extends PagingLoadResult<?>>
Parameters:
offset - the offset of the first record to return
limit - the page size

setLimit

public void setLimit(int limit)
Description copied from interface: PagingLoader
Sets the limit size.

Specified by:
setLimit in interface PagingLoader<D extends PagingLoadResult<?>>
Parameters:
limit - the limit

setOffset

public void setOffset(int offset)
Description copied from interface: PagingLoader
Sets the offset.

Specified by:
setOffset in interface PagingLoader<D extends PagingLoadResult<?>>
Parameters:
offset - the offset

useLoadConfig

public void useLoadConfig(java.lang.Object loadConfig)
Use the specified LoadConfig for all load calls. The BaseLoader.reuseConfig will be set to true.

Overrides:
useLoadConfig in class BaseListLoader<D extends PagingLoadResult<?>>

newLoadConfig

protected java.lang.Object newLoadConfig()
Description copied from class: BaseListLoader
Template method to allow custom BaseLoader subclasses to provide their own implementation of LoadConfig

Overrides:
newLoadConfig in class BaseListLoader<D extends PagingLoadResult<?>>

onLoadSuccess

protected void onLoadSuccess(java.lang.Object loadConfig,
                             D result)
Description copied from class: BaseLoader
Called when the remote data has been received.

Overrides:
onLoadSuccess in class BaseLoader<D extends PagingLoadResult<?>>
Parameters:
loadConfig - the load config
result - data

prepareLoadConfig

protected java.lang.Object prepareLoadConfig(java.lang.Object config)
Description copied from class: BaseListLoader
Template method to allow custom subclasses to prepare the load config prior to loading data

Overrides:
prepareLoadConfig in class BaseListLoader<D extends PagingLoadResult<?>>