|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.data.provider.FilterCriteria
com.sun.data.provider.impl.CompareFilterCriteria
public class CompareFilterCriteria
The CompareFilterCriteria is an implementation of FilterCriteria
that compares the value of a FieldKey
in a
TableDataProvider
with a predefined
compareValue
. A user may specify matches to include less than
(<), equal to (==), or greater than (>) the compareValue
Object,
or any combination of the above.
TableDataProvider
,
TableDataFilter
,
Serialized FormField Summary | |
---|---|
protected java.util.Locale |
compareLocale
Storage for the compare locale |
protected boolean |
matchEqualTo
|
protected boolean |
matchGreaterThan
|
protected boolean |
matchLessThan
|
Constructor Summary | |
---|---|
CompareFilterCriteria()
|
|
CompareFilterCriteria(FieldKey fieldKey)
|
|
CompareFilterCriteria(FieldKey fieldKey,
java.lang.Object compareValue)
|
|
CompareFilterCriteria(FieldKey fieldKey,
java.lang.Object compareValue,
boolean matchLessThan,
boolean matchEqualTo,
boolean matchGreaterThan)
|
|
CompareFilterCriteria(java.lang.Object compareValue)
|
Method Summary | |
---|---|
static int |
compare(java.lang.Object o1,
java.lang.Object o2,
java.util.Locale compareLocale)
|
java.util.Locale |
getCompareLocale()
|
java.lang.Object |
getCompareValue()
|
java.lang.String |
getDisplayName()
Returns the display name for this filter criteria. |
FieldKey |
getFieldKey()
|
boolean |
isMatchEqualTo()
|
boolean |
isMatchGreaterThan()
|
boolean |
isMatchLessThan()
|
boolean |
match(TableDataProvider provider,
RowKey row)
This method tests a match by comparing the compareValue
and the data value stored under the FieldKey at the specified
row. |
void |
setCompareLocale(java.util.Locale compareLocale)
|
void |
setCompareValue(java.lang.Object value)
|
void |
setFieldKey(FieldKey fieldKey)
|
void |
setMatchEqualTo(boolean matchEqualTo)
|
void |
setMatchGreaterThan(boolean matchGreaterThan)
|
void |
setMatchLessThan(boolean matchLessThan)
|
Methods inherited from class com.sun.data.provider.FilterCriteria |
---|
isInclude, setDisplayName, setInclude |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Locale compareLocale
protected boolean matchEqualTo
protected boolean matchLessThan
protected boolean matchGreaterThan
Constructor Detail |
---|
public CompareFilterCriteria()
public CompareFilterCriteria(FieldKey fieldKey)
fieldKey
- FieldKeypublic CompareFilterCriteria(java.lang.Object compareValue)
compareValue
- The desired compare valuepublic CompareFilterCriteria(FieldKey fieldKey, java.lang.Object compareValue)
fieldKey
- FieldKeycompareValue
- The desired compare valuepublic CompareFilterCriteria(FieldKey fieldKey, java.lang.Object compareValue, boolean matchLessThan, boolean matchEqualTo, boolean matchGreaterThan)
fieldKey
- FieldKeycompareValue
- ObjectmatchLessThan
- booleanmatchEqualTo
- booleanmatchGreaterThan
- booleanMethod Detail |
---|
public java.lang.String getDisplayName()
FilterCriteria
Returns the display name for this filter criteria.
getDisplayName
in class FilterCriteria
public void setFieldKey(FieldKey fieldKey)
fieldKey
- FieldKeypublic FieldKey getFieldKey()
public void setCompareValue(java.lang.Object value)
value
- Objectpublic java.lang.Object getCompareValue()
public void setCompareLocale(java.util.Locale compareLocale)
compareLocale
- Localepublic java.util.Locale getCompareLocale()
public void setMatchEqualTo(boolean matchEqualTo)
matchEqualTo
- booleanpublic boolean isMatchEqualTo()
public void setMatchLessThan(boolean matchLessThan)
matchLessThan
- booleanpublic boolean isMatchLessThan()
public void setMatchGreaterThan(boolean matchGreaterThan)
matchGreaterThan
- booleanpublic boolean isMatchGreaterThan()
public boolean match(TableDataProvider provider, RowKey row) throws DataProviderException
This method tests a match by comparing the compareValue
and the data value stored under the FieldKey
at the specified
row. The matchLessThan
, matchEqualTo
, and
matchGreaterThan
properties are used to determine if a
match was found. The compareLocale
is used for String
comparisons.
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.
match
in class FilterCriteria
provider
- TableDataProvider
containing the data on
displayrow
- The RowKey
of the data to be checked for a match
true
if a match was detected, or
false
if not.
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.public static int compare(java.lang.Object o1, java.lang.Object o2, java.util.Locale compareLocale)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |