com.sencha.gxt.data.shared.loader
Class PagingLoader<C extends PagingLoadConfig,D extends PagingLoadResult<?>>

java.lang.Object
  extended by com.sencha.gxt.data.shared.loader.Loader<C,D>
      extended by com.sencha.gxt.data.shared.loader.ListLoader<C,D>
          extended by com.sencha.gxt.data.shared.loader.PagingLoader<C,D>
Type Parameters:
C - the type of data for the input object
D - the type of data to be returned by the loader
All Implemented Interfaces:
BeforeLoadEvent.HasBeforeLoadHandlers<C>, LoaderHandler.HasLoaderHandlers<C,D>, LoadExceptionEvent.HasLoadExceptionHandlers<C>, LoadHandler.HasLoadHandlers<C,D>

public class PagingLoader<C extends PagingLoadConfig,D extends PagingLoadResult<?>>
extends ListLoader<C,D>

A ListLoader subclass which adds support for paged data (offset, limit, and total count).


Constructor Summary
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.
 
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.
 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.
 
Methods inherited from class com.sencha.gxt.data.shared.loader.ListLoader
addSortInfo, addSortInfo, clearSortInfo, getSortInfo, isRemoteSort, removeSortInfo, setRemoteSort
 
Methods inherited from class com.sencha.gxt.data.shared.loader.Loader
addBeforeLoadHandler, addLoaderHandler, addLoadExceptionHandler, addLoadHandler, getLastLoadConfig, getProxy, isReuseLoadConfig, load, load, setReuseLoadConfig
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagingLoader

public PagingLoader(DataProxy<C,D> proxy)
Creates a new paging loader instance.

Parameters:
proxy - the data proxy

PagingLoader

public PagingLoader(DataProxy<C,T> proxy,
                    DataReader<D,T> reader)
Creates a new paging loader instance.

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

getLimit

public int getLimit()
Returns the current limit.

Returns:
the current limit

getOffset

public int getOffset()
Returns the offset of the first record.

Returns:
the current offset

getTotalCount

public int getTotalCount()
Returns the total number of models in the dataset as returned by the server.

Returns:
the number of models as passed from the server

load

public void load(int offset,
                 int limit)
Loads the data using the specified configuration.

Parameters:
offset - the offset of the first record to return
limit - the page size

setLimit

public void setLimit(int limit)
Sets the limit size.

Parameters:
limit - the limit

setOffset

public void setOffset(int offset)
Sets the offset.

Parameters:
offset - the offset

useLoadConfig

public void useLoadConfig(C loadConfig)
Use the specified LoadConfig for all load calls, Loader.setReuseLoadConfig(boolean) will be set to true.

Overrides:
useLoadConfig in class ListLoader<C extends PagingLoadConfig,D extends PagingLoadResult<?>>


Copyright © 2012. All Rights Reserved.