com.sun.data.provider.impl
Class NestedFilterCriteria

java.lang.Object
  extended bycom.sun.data.provider.FilterCriteria
      extended bycom.sun.data.provider.impl.NestedFilterCriteria
All Implemented Interfaces:
java.io.Serializable

public class NestedFilterCriteria
extends FilterCriteria

The NestedFilterCriteria class defines a set of nested filter criteria for a TableDataFilter.

See Also:
Serialized Form

Field Summary
protected  FilterCriteria[] filterCriteria
          storage for the nested filter criteria
protected  boolean matchAll
          storage for the matchAllCriteria property (default is true)
 
Constructor Summary
NestedFilterCriteria()
           
NestedFilterCriteria(java.lang.String displayName)
           
NestedFilterCriteria(java.lang.String displayName, boolean include)
           
NestedFilterCriteria(java.lang.String displayName, boolean include, FilterCriteria[] nested)
           
 
Method Summary
 FilterCriteria[] getFilterCriteria()
           
 boolean isMatchAllCriteria()
          Gets the matchAllCriteria property.
 boolean match(TableDataProvider provider, RowKey row)
          This method iterates the nested FilterCriteria and invokes the match() method on each.
 void setFilterCriteria(FilterCriteria[] filterCriteria)
           
 void setMatchAllCriteria(boolean matchAll)
          Sets the matchAllCriteria property.
 
Methods inherited from class com.sun.data.provider.FilterCriteria
getDisplayName, isInclude, setDisplayName, setInclude
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterCriteria

protected FilterCriteria[] filterCriteria
storage for the nested filter criteria


matchAll

protected boolean matchAll
storage for the matchAllCriteria property (default is true)

Constructor Detail

NestedFilterCriteria

public NestedFilterCriteria()

NestedFilterCriteria

public NestedFilterCriteria(java.lang.String displayName)
Parameters:
displayName - The desired display name for this nested filter criteria

NestedFilterCriteria

public NestedFilterCriteria(java.lang.String displayName,
                            boolean include)
Parameters:
displayName - The desired display name for this filter criteria
include - true matches for this criteria, or exclude false matches for this criteria.

NestedFilterCriteria

public NestedFilterCriteria(java.lang.String displayName,
                            boolean include,
                            FilterCriteria[] nested)
Parameters:
displayName - The desired display name for this filter criteria
include - true matches for this criteria, or exclude false matches for this criteria.
nested - An array of nested filter criteria
Method Detail

setFilterCriteria

public void setFilterCriteria(FilterCriteria[] filterCriteria)
Parameters:
filterCriteria - FilterCriteria[]

getFilterCriteria

public FilterCriteria[] getFilterCriteria()
Returns:
FilterCriteria[]

setMatchAllCriteria

public void setMatchAllCriteria(boolean matchAll)

Sets the matchAllCriteria property. When set to true, the match(...) method will only match rows that are matched by all nested include filter criteria and not mached by all nested exclude filter criteria. When set to false, the match(...) method will match a row if it is matched by any nested include filter criteria or not matched by any nested exclude filter criteria.

Parameters:
matchAll - The desired setting for the matchAllCriteria property

isMatchAllCriteria

public boolean isMatchAllCriteria()

Gets the matchAllCriteria property. When set to true, the match(...) method will only match rows that are matched by all nested include filter criteria and not mached by all nested exclude filter criteria. When set to false, the match(...) method will match a row if it is matched by any nested include filter criteria or not matched by any nested exclude filter criteria.

Returns:
The current setting for the matchAllCriteria property

match

public boolean match(TableDataProvider provider,
                     RowKey row)
              throws DataProviderException

This method iterates the nested FilterCriteria and invokes the match() method on each. If the matchAllCriteria property is set to true, then all of the nested include filter criteria must match a row, and all of the nested exclude filter criteria must not match a row for this method to return true. If the matchAllCriteria property is set to false (match any), then any nested include criteria that matches a row or nested exclude criteria that does not match a row will cause this method to return true. If there is no nested filter criteria defined, then this method returns true.

Determines wether or not a particular row matches this filter criteria. Implementations may perform whatever logic is desired to make this determination. The combination of a positive match and the state of the include property determines if a row is included or excluded from the filter.

Specified by:
match in class FilterCriteria
Parameters:
provider - TableDataProvider containing the data on display
row - The RowKey of the data to be checked for a match
Returns:
true if a match was detected, or false if not.
Throws:
DataProviderException - Implementations may wish to surface internal exceptions (nested in DataProviderException) rather than simply returning null. A DPE may also indicate that the passed TableDataProvider or RowKey is not valid. Consult the documentation of the specific FilterCriteria implementation for details on what exceptions might be wrapped by a DPE.