com.sencha.gxt.data.shared.loader
Class ListLoader<C extends ListLoadConfig,D extends ListLoadResult<?>>

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>
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>
Direct Known Subclasses:
PagingLoader

public class ListLoader<C extends ListLoadConfig,D extends ListLoadResult<?>>
extends Loader<C,D>

A Loader subclass which return a list of data. Adds support for sort field, sort direction, and remote sorting.

Events:
BeforeLoadEvent
LoadEvent
LoadExceptionEvent


Constructor Summary
ListLoader(DataProxy<C,D> proxy)
          Creates a new loader instance with the given proxy.
ListLoader(DataProxy<C,T> proxy, DataReader<D,T> reader)
          Creates a new loader instance.
 
Method Summary
 void addSortInfo(int index, SortInfo sortInfo)
          Adds a new SortInfo object to the next ListLoadConfig in the indicated position in the list.
 void addSortInfo(SortInfo sortInfo)
          Adds a new SortInfo object to the next ListLoadConfig to the end of the list.
 void clearSortInfo()
          Clears all of the currently set sort info objects
 java.util.List<? extends SortInfo> getSortInfo()
          Gets the current set of SortInfo objects to be sent to the server.
 boolean isRemoteSort()
          Returns true if remote sorting is enabled.
 void removeSortInfo(SortInfo lastSort)
          Removes the indicated SortInfo object from the list to send to the server, if it was present in the list.
 void setRemoteSort(boolean remoteSort)
          Sets the remote sort state (defaults to false).
 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.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

ListLoader

public ListLoader(DataProxy<C,D> proxy)
Creates a new loader instance with the given proxy. A reader is not specified and will not be passed to the proxy at load time.

Parameters:
proxy - the data proxy

ListLoader

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

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

addSortInfo

public void addSortInfo(int index,
                        SortInfo sortInfo)
Adds a new SortInfo object to the next ListLoadConfig in the indicated position in the list. Can be useful to set the new sort as the first sort to use by setting the index to 0.

Parameters:
index - the position of the sort info in the list of sort info
sortInfo - the sort info to add

addSortInfo

public void addSortInfo(SortInfo sortInfo)
Adds a new SortInfo object to the next ListLoadConfig to the end of the list.

Parameters:
sortInfo - the sort info to add

clearSortInfo

public void clearSortInfo()
Clears all of the currently set sort info objects


getSortInfo

public java.util.List<? extends SortInfo> getSortInfo()
Gets the current set of SortInfo objects to be sent to the server. This list should not be modified. This method can be useful to override to modify the objects in the list to a format that can go over the wire, such as for RequestFactory.

Returns:
an immutable collection of the current sort settings

isRemoteSort

public boolean isRemoteSort()
Returns true if remote sorting is enabled.

Returns:
the remote sort state

removeSortInfo

public void removeSortInfo(SortInfo lastSort)
Removes the indicated SortInfo object from the list to send to the server, if it was present in the list.

Parameters:
lastSort - the sort info to remove

setRemoteSort

public void setRemoteSort(boolean remoteSort)
Sets the remote sort state (defaults to false). When true, the loader will make a new load request when the data needs to be sorted.

Parameters:
remoteSort - true for remote sort, false for local sorting

useLoadConfig

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



Copyright © 2012. All Rights Reserved.