com.sencha.gxt.widget.core.client.grid.filters
Class AbstractGridFilters<M>

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.grid.filters.AbstractGridFilters<M>
Type Parameters:
M - the model type
All Implemented Interfaces:
ComponentPlugin<Grid<M>>
Direct Known Subclasses:
GridFilters

public abstract class AbstractGridFilters<M>
extends java.lang.Object
implements ComponentPlugin<Grid<M>>

Provides an abstract base class that applies filters to the rows in a grid.

A filter is applied to a grid to reduce the amount of information that is displayed, thus highlighting the information of interest to the user. A filter is generally invoked from a header menu.

The filters can be applied locally using Store filtering or passed to a remote data source using a FilterPagingLoadConfig. To enable local filtering, use setLocal(true). To enable remote filtering, use the AbstractGridFilters(Loader) form of the constructor.

To add a filter to a Grid column, create an instance of a concrete subclass of Filter, passing to the constructor the ValueProvider for the column, then add the filter to a GridFilters using addFilter(Filter) and invoke initPlugin(Grid). The filter then appears in the grid header menu item for any column that uses the supplied value provider.

Derived classes must provide an implementation of getStore().


Nested Class Summary
 class AbstractGridFilters.DefaultGridFilterMessages
          The default locale-sensitive messages used by this class.
static interface AbstractGridFilters.GridFilterMessages
          The locale-sensitive messages used by this class.
 
Constructor Summary
AbstractGridFilters()
          Creates grid filters that are applied locally.
AbstractGridFilters(Loader<FilterPagingLoadConfig,?> loader)
          Creates grid filters to be applied remotely.
 
Method Summary
 void addFilter(Filter<M,?> filter)
          Adds a filter.
 java.util.List<FilterConfig> buildQuery(java.util.List<Filter<M,?>> filters)
          Builds a query consisting of a list of loader filter configurations from a list of grid filters.
 void cleanParams(FilterPagingLoadConfig config)
          Removes filter related query parameters from the provided object.
 void clearFilters()
          Turns all filters off.
 Filter<M,?> getFilter(java.lang.String path)
          Returns the filter based on the value provider path.
 java.util.List<Filter<M,?>> getFilterData()
          Returns a list of the currently active filters.
 AbstractGridFilters.GridFilterMessages getMessages()
          Returns the locale-sensitive messages used by this class.
 void initPlugin(Grid<M> component)
          Initializes the plugin.
 boolean isAutoReload()
          Returns true if auto load is enabled.
 void removeAll()
          Removes all filters.
 void removeFilter(Filter<M,?> filter)
          Removes the given filter.
 void setAutoReload(boolean autoLoad)
          Tree to reload the datasource when a filter change happens (defaults to true).
 void setUpdateBuffer(int updateBuffer)
          Number of milliseconds to defer store updates since the last filter change (defaults to 500).
 void updateColumnHeadings()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGridFilters

public AbstractGridFilters()
Creates grid filters that are applied locally. Caller must also invoke setLocal(true).


AbstractGridFilters

public AbstractGridFilters(Loader<FilterPagingLoadConfig,?> loader)
Creates grid filters to be applied remotely. The grid filters are automatically added to the FilterPagingLoadConfig during the loading processing and passed by the Loader to the DataProxy so that they are available for the remote data source to use as needed.

Parameters:
loader - the remote loader
Method Detail

addFilter

public void addFilter(Filter<M,?> filter)
Adds a filter.

Parameters:
filter - the filter

buildQuery

public java.util.List<FilterConfig> buildQuery(java.util.List<Filter<M,?>> filters)
Builds a query consisting of a list of loader filter configurations from a list of grid filters.

Parameters:
filters -
Returns:
a query consisting of a list of loader filter configurations

cleanParams

public void cleanParams(FilterPagingLoadConfig config)
Removes filter related query parameters from the provided object.

Parameters:
config - the load config

clearFilters

public void clearFilters()
Turns all filters off. This does not clear the configuration information (see removeAll()).


getFilter

public Filter<M,?> getFilter(java.lang.String path)
Returns the filter based on the value provider path.

Parameters:
path - the path
Returns:
the matching filter or null

getFilterData

public java.util.List<Filter<M,?>> getFilterData()
Returns a list of the currently active filters.

Returns:
the list of active filters

getMessages

public AbstractGridFilters.GridFilterMessages getMessages()
Returns the locale-sensitive messages used by this class.

Returns:
the locale-sensitive messages used by this class

initPlugin

public void initPlugin(Grid<M> component)
Description copied from interface: ComponentPlugin
Initializes the plugin.

Specified by:
initPlugin in interface ComponentPlugin<Grid<M>>
Parameters:
component - the target component

isAutoReload

public boolean isAutoReload()
Returns true if auto load is enabled.

Returns:
the auto load state

removeAll

public void removeAll()
Removes all filters.


removeFilter

public void removeFilter(Filter<M,?> filter)
Removes the given filter.

Parameters:
filter - the filter to be removed

setAutoReload

public void setAutoReload(boolean autoLoad)
Tree to reload the datasource when a filter change happens (defaults to true). Set this to false to prevent the datastore from being reloaded if there are changes to the filters.

Parameters:
autoLoad - true to enable auto reload

setUpdateBuffer

public void setUpdateBuffer(int updateBuffer)
Number of milliseconds to defer store updates since the last filter change (defaults to 500).

Parameters:
updateBuffer - the buffer in milliseconds

updateColumnHeadings

public void updateColumnHeadings()


Copyright © 2012. All Rights Reserved.