com.extjs.gxt.ui.client.widget.grid.filters
Class Filter

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.grid.filters.Filter
All Implemented Interfaces:
Observable
Direct Known Subclasses:
BooleanFilter, DateFilter, ListFilter, NumericFilter, StringFilter

public abstract class Filter
extends BaseObservable

Abstract base class for filter implementations.


Nested Class Summary
static class Filter.FilterMessages
           
 
Field Summary
protected  java.lang.String dataIndex
           
protected  Menu menu
           
 
Constructor Summary
Filter(java.lang.String dataIndex)
          Creates a new filter instance.
 
Method Summary
protected  void fireUpdate()
           
 java.lang.String getDataIndex()
          Returns the filter's data index.
 Menu getMenu()
          Returns the filter's menu.
 Filter.FilterMessages getMessages()
           
protected
<X> X
getModelValue(ModelData model)
           
abstract  java.util.List<FilterConfig> getSerialArgs()
          Template method to be implemented by all subclasses that is to get and return serialized filter data for transmission to the server.
 int getUpdateBuffer()
          Returns the update buffer.
abstract  java.lang.Object getValue()
          Template method to be implemented by all subclasses that is to get and return the value of the filter.
 boolean isActivatable()
          Template method to be implemented by all subclasses that is to return true if the filter has enough configuration information to be activated.
 boolean isActive()
          Returns true if the filter is active.
 java.util.List<FilterConfig> serialize()
          Returns the serialized filter data for transmission to the server and fires the 'Serialize' event.
 void setActive(boolean active, boolean supressEvent)
          Sets the status of the filter and fires the appropriate events.
 void setMessages(Filter.FilterMessages messages)
           
 void setUpdateBuffer(int updateBuffer)
          Number of milliseconds to wait after user interaction to fire an update (defaults to 500).
abstract  void setValue(java.lang.Object value)
          Template method to be implemented by all subclasses that is to set the value of the filter and fire the 'Update' event.
 boolean validateModel(ModelData model)
          Template method to be implemented by all subclasses that is to validates the provided Model against the filters configuration.
 
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
 

Field Detail

dataIndex

protected java.lang.String dataIndex

menu

protected Menu menu
Constructor Detail

Filter

public Filter(java.lang.String dataIndex)
Creates a new filter instance.

Parameters:
dataIndex - the data index the filter is mapped to
Method Detail

getDataIndex

public java.lang.String getDataIndex()
Returns the filter's data index.

Returns:
the data index

getMenu

public Menu getMenu()
Returns the filter's menu.

Returns:
the menu

getMessages

public Filter.FilterMessages getMessages()

getSerialArgs

public abstract java.util.List<FilterConfig> getSerialArgs()
Template method to be implemented by all subclasses that is to get and return serialized filter data for transmission to the server.


getUpdateBuffer

public int getUpdateBuffer()
Returns the update buffer.

Returns:
the update buffer in milliseconds

getValue

public abstract java.lang.Object getValue()
Template method to be implemented by all subclasses that is to get and return the value of the filter.


isActivatable

public boolean isActivatable()
Template method to be implemented by all subclasses that is to return true if the filter has enough configuration information to be activated.

Returns:
true if if the filter has enough configuration information to be activated

isActive

public boolean isActive()
Returns true if the filter is active.

Returns:
the active state

serialize

public java.util.List<FilterConfig> serialize()
Returns the serialized filter data for transmission to the server and fires the 'Serialize' event.

Returns:
the key value pairs representing the current configuration of the filter

setActive

public void setActive(boolean active,
                      boolean supressEvent)
Sets the status of the filter and fires the appropriate events. You can only set it to active if the filter is activatable.

Parameters:
active - the new filter state
supressEvent - true to prevent events from being fired

setMessages

public void setMessages(Filter.FilterMessages messages)

setUpdateBuffer

public void setUpdateBuffer(int updateBuffer)
Number of milliseconds to wait after user interaction to fire an update (defaults to 500).

Parameters:
updateBuffer - the update buffer in milliseconds

setValue

public abstract void setValue(java.lang.Object value)
Template method to be implemented by all subclasses that is to set the value of the filter and fire the 'Update' event.

Parameters:
value - the filter value

validateModel

public boolean validateModel(ModelData model)
Template method to be implemented by all subclasses that is to validates the provided Model against the filters configuration. Defaults to return true.

Parameters:
model - the model
Returns:
true if valid

fireUpdate

protected void fireUpdate()

getModelValue

protected <X> X getModelValue(ModelData model)