com.sun.data.provider
Class FilterCriteria

java.lang.Object
  extended by com.sun.data.provider.FilterCriteria
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CompareFilterCriteria, NestedFilterCriteria, RegexFilterCriteria

public abstract class FilterCriteria
extends java.lang.Object
implements java.io.Serializable

The FilterCriteria class defines a single filter criteria for a TableDataFilter. This includes a boolean to indicate an include (true) or exclude (false) filter critiera. An array of these FilterCriteria objects are used to define the display filter for an TableDataProvider.

See Also:
Serialized Form

Constructor Summary
FilterCriteria()
          Constructs a new FilterCriteria object with no display name and the default state for include (true).
FilterCriteria(java.lang.String displayName)
          Constructs a new FilterCriteria object with the specified display name and the default state for the include/exclude (true == include).
FilterCriteria(java.lang.String displayName, boolean include)
          Constructs a new FilterCriteria object with the specified display name and state for include/exclude (true == include).
 
Method Summary
 java.lang.String getDisplayName()
          Returns the display name for this filter criteria.
 boolean isInclude()
          Returns the include/exclude setting for this FilterCriteria.
abstract  boolean match(TableDataProvider provider, RowKey rowKey)
          Determines wether or not a particular row matches this filter criteria.
 void setDisplayName(java.lang.String displayName)
          Sets the display name for this filter criteria.
 void setInclude(boolean include)
          Sets the include/exclude setting for this filter criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterCriteria

public FilterCriteria()

Constructs a new FilterCriteria object with no display name and the default state for include (true).


FilterCriteria

public FilterCriteria(java.lang.String displayName)

Constructs a new FilterCriteria object with the specified display name and the default state for the include/exclude (true == include).

Parameters:
displayName - The desired display name for this filter criteria

FilterCriteria

public FilterCriteria(java.lang.String displayName,
                      boolean include)

Constructs a new FilterCriteria object with the specified display name and state for include/exclude (true == include).

Parameters:
displayName - The desired display name for this filter criteria
include - true matches for this criteria, or exclude false matches for this criteria.
Method Detail

setDisplayName

public void setDisplayName(java.lang.String displayName)

Sets the display name for this filter criteria.

Parameters:
displayName - The desired display name for this filter criteria

getDisplayName

public java.lang.String getDisplayName()

Returns the display name for this filter criteria.

Returns:
The display name of this filter criteria

setInclude

public void setInclude(boolean include)

Sets the include/exclude setting for this filter criteria. true represents include (include filter matches in the row list), and false represents exclude (exclude filter matches in the row list).

Parameters:
include - true matches for this criteria, or exclude false matches for this criteria.

isInclude

public boolean isInclude()

Returns the include/exclude setting for this FilterCriteria. true represents include (include filter matches in the row list), and a false represents exclude (exclude filter matches in the row list).

Returns:
true represents include (include filter matches in the row list), and a false represents exclude (exclude filter matches in the row list).

match

public abstract boolean match(TableDataProvider provider,
                              RowKey rowKey)
                       throws DataProviderException

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.

Parameters:
provider - TableDataProvider containing the data on display
rowKey - 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.