com.sun.data.provider.impl
Class FieldKeySortCriteria

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

public class FieldKeySortCriteria
extends SortCriteria

The FieldKeySortCriteria class is an implementation of SortCriteria that simply retrieves the sort value from the TableDataProvider for the current RowKey using the specified FieldKey.

Author:
Joe Nuxoll
See Also:
Serialized Form

Constructor Summary
FieldKeySortCriteria()
          Constructs a FieldKeySortCriteria with no associated FieldKey.
FieldKeySortCriteria(FieldKey fieldKey)
          Constructs a FieldKeySortCriteria with the specified FieldKey.
FieldKeySortCriteria(FieldKey fieldKey, boolean ascending)
          Constructs a FieldKeySortCriteria with the specified FieldKey and ascending state.
 
Method Summary
 java.lang.String getCriteriaKey()
          Returns the FieldKey's fieldId.
 java.lang.String getDisplayName()
          If no display name is set, this returns the FieldKey's display name.
 FieldKey getFieldKey()
          Returns the FieldKey to use for this sort criteria.
 java.lang.Object getSortValue(TableDataProvider provider, RowKey row)
          Returns the value from the TableDataProvider stored under the FieldKey and RowKey.
 void setFieldKey(FieldKey fieldKey)
          Sets the FieldKey for this sort criteria.
 
Methods inherited from class com.sun.data.provider.SortCriteria
isAscending, setAscending, setDisplayName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldKeySortCriteria

public FieldKeySortCriteria()
Constructs a FieldKeySortCriteria with no associated FieldKey.


FieldKeySortCriteria

public FieldKeySortCriteria(FieldKey fieldKey)
Constructs a FieldKeySortCriteria with the specified FieldKey.

Parameters:
fieldKey - The desired FieldKey

FieldKeySortCriteria

public FieldKeySortCriteria(FieldKey fieldKey,
                            boolean ascending)
Constructs a FieldKeySortCriteria with the specified FieldKey and ascending state.

Parameters:
fieldKey - The desired FieldKey
ascending - The desired boolean state for the ascending property
Method Detail

getFieldKey

public FieldKey getFieldKey()
Returns the FieldKey to use for this sort criteria.

Returns:
The currently set FieldKey for this sort criteria

setFieldKey

public void setFieldKey(FieldKey fieldKey)
Sets the FieldKey for this sort criteria.

Parameters:
fieldKey - The desired FieldKey for this sort criteria

getDisplayName

public java.lang.String getDisplayName()

If no display name is set, this returns the FieldKey's display name.

Returns the display name for this sort criteria.

Overrides:
getDisplayName in class SortCriteria
Returns:
The display name of this sort criteria

getCriteriaKey

public java.lang.String getCriteriaKey()
Returns the FieldKey's fieldId. Returns a String uniquely identifying this sort criteria. This is used to match up a sort criteria object with a user gesture in UI.

Specified by:
getCriteriaKey in class SortCriteria
Returns:
A String that uniquely identifies this sort criteria

getSortValue

public java.lang.Object getSortValue(TableDataProvider provider,
                                     RowKey row)
                              throws DataProviderException

Returns the value from the TableDataProvider stored under the FieldKey and RowKey.

Provides the data value to use while sorting a particular row. Implementations may perform whatever logic is desired to provide the data object to represent this row in a sort.

Specified by:
getSortValue in class SortCriteria
Parameters:
provider - TableDataProvider containing the data on display
row - The RowKey of the row to be sorted
Returns:
the data object representing this row for this sort criteria
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 SortCriteria implementation for details on what exceptions might be wrapped by a DPE.