dsto.dfc.databeans.views
Class AbstractPropertyFilterSet

java.lang.Object
  extended by dsto.dfc.databeans.AbstractDataObject
      extended by dsto.dfc.databeans.AbstractDataBean
          extended by dsto.dfc.databeans.DataBean
              extended by dsto.dfc.databeans.views.AbstractPropertyFilterSet
All Implemented Interfaces:
IDataBean, IDataObject, IDataObjectChildListener, PropertyListener, Disposable, Cloneable, EventListener
Direct Known Subclasses:
MultiValuePropertyFilterSet, PropertyFilterSet

public abstract class AbstractPropertyFilterSet
extends DataBean
implements PropertyListener, Disposable

Base class for automatically-generated sets of IFilter's for filtering against values of a IDataObject property. Typically, for each distinct value of the property, a filter will appear in this set that selects that value, but this may be customised by subclasses. This can be useful as the underlying model for filtering views.

Author:
Matthew Phillips
See Also:
PropertyFilterSet, MultiValuePropertyFilterSet

Field Summary
protected  Map<Object,Integer> counts
           
protected  String property
           
protected  IDataObject source
           
 
Fields inherited from class dsto.dfc.databeans.DataBean
alwaysTransient, transientProperties, typeInfo, values
 
Fields inherited from class dsto.dfc.databeans.AbstractDataObject
listeners
 
Fields inherited from interface dsto.dfc.databeans.IDataObject
OVERRIDE, PERSISTENT, PERSISTENT_OVERRIDE, TRANSIENT, TRANSIENT_OVERRIDE
 
Constructor Summary
AbstractPropertyFilterSet(IDataObject source, String property)
           
 
Method Summary
protected  void addFilter(Object value, IFilter<IDataObject> filter)
          Add a filter for a value.
protected abstract  void addFiltersFor(Object value)
          Add filters for a given property value.
protected  void addItem(IDataObject item)
          Add the filters for a given item in the source set.
 void dispose()
          Dispose of the object (unregister listeners, close open resources etc).
 IFilter<IDataObject> filterFor(Object value)
          Get the filter for a given value.
 boolean hasFilterFor(Object value)
          True if a filter exists for a given value.
 void propertyValueChanged(PropertyEvent e)
           
protected  void removeFilter(Object value)
          Remove a filter for a value.
protected abstract  void removeFiltersFor(Object value)
          Remove filters for a given property value.
protected  void removeItem(IDataObject item)
          Remove the filters for a given item in the source set.
protected abstract  void updateFilters(PropertyPath path, Object oldValue, Object newValue)
          Update filters for a given property value when the value itself has changed (i.e.
 
Methods inherited from class dsto.dfc.databeans.DataBean
childPropertyChanged, getPropertyNames, getTypeInfo, getValue, isTransient, propertyIterator, setAlwaysTransient, setTypeInfo, setValue, shallowClone
 
Methods inherited from class dsto.dfc.databeans.AbstractDataBean
setValue, setValue, setValue, setValue, setValue, setValue, setValue
 
Methods inherited from class dsto.dfc.databeans.AbstractDataObject
addFirstPropertyListener, addPropertyListener, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, firePropertyChangedEvent, getBeanValue, getBooleanValue, getBooleanValue, getCharValue, getCharValue, getDoubleValue, getDoubleValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getObjectValue, getPropertyListeners, getShortValue, getStringValue, registerValue, removePropertyListener, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, toString, unregisterValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface dsto.dfc.databeans.IDataBean
getBeanValue, getBooleanValue, getCharValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getObjectValue, getStringValue, setValue, setValue, setValue, setValue, setValue, setValue
 
Methods inherited from interface dsto.dfc.databeans.IDataObject
addPropertyListener, getPropertyListeners, removePropertyListener, setValue
 

Field Detail

property

protected String property

source

protected IDataObject source

counts

protected Map<Object,Integer> counts
Constructor Detail

AbstractPropertyFilterSet

public AbstractPropertyFilterSet(IDataObject source,
                                 String property)
Method Detail

hasFilterFor

public boolean hasFilterFor(Object value)
True if a filter exists for a given value.

See Also:
filterFor(Object)

filterFor

public IFilter<IDataObject> filterFor(Object value)
                               throws IllegalArgumentException
Get the filter for a given value.

Parameters:
value - The value.
Returns:
The filter.
Throws:
IllegalArgumentException - if no filter exists for the value.

addItem

protected void addItem(IDataObject item)
Add the filters for a given item in the source set.


removeItem

protected void removeItem(IDataObject item)
Remove the filters for a given item in the source set.


addFiltersFor

protected abstract void addFiltersFor(Object value)
Add filters for a given property value.


removeFiltersFor

protected abstract void removeFiltersFor(Object value)
Remove filters for a given property value.


updateFilters

protected abstract void updateFilters(PropertyPath path,
                                      Object oldValue,
                                      Object newValue)
Update filters for a given property value when the value itself has changed (i.e. generated a property change event).

Parameters:
path - The propery path that changed.
oldValue - The old value at path.
newValue - The new value at path.

addFilter

protected void addFilter(Object value,
                         IFilter<IDataObject> filter)
Add a filter for a value.


removeFilter

protected void removeFilter(Object value)
Remove a filter for a value.


dispose

public void dispose()
Description copied from interface: Disposable
Dispose of the object (unregister listeners, close open resources etc). It should be safe to call this method more than once. Note for beans that support client event listeners: if there are listeners registered when this is called, this method should do nothing.

Specified by:
dispose in interface Disposable

propertyValueChanged

public void propertyValueChanged(PropertyEvent e)
Specified by:
propertyValueChanged in interface PropertyListener


Copyright © 2008 Commonwealth of Australia