com.sun.data.provider.impl
Class FieldIdSortCriteria

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

public class FieldIdSortCriteria
extends SortCriteria

The FieldIdSortCriteria class is an implementation of SortCriteria that simply retrieves the sort value from the TableDataProvider for the current RowKey using the specified fieldId, which is used to dynamically retrieve a FieldKey.

Author:
Joe Nuxoll
See Also:
Serialized Form

Constructor Summary
FieldIdSortCriteria()
          Constructs a FieldIdSortCriteria with no associated FieldKey.
FieldIdSortCriteria(java.lang.String fieldId)
          Constructs a FieldIdSortCriteria with the specified fieldId to use to fetch a FieldKey.
FieldIdSortCriteria(java.lang.String fieldId, boolean ascending)
          Constructs a FieldIdSortCriteria with the specified fieldId and ascending state.
 
Method Summary
 java.lang.String getCriteriaKey()
          Returns the fieldId.
 java.lang.String getDisplayName()
          If no display name is set, this returns the fieldId.
 java.lang.String getFieldId()
          Returns the fieldId to use to retrieve a FieldKey for this sort criteria.
 java.lang.Object getSortValue(TableDataProvider provider, RowKey row)
          Returns the value from the TableDataProvider stored under the FieldKey (retrieved using the fieldId) and RowKey.
 void setFieldId(java.lang.String fieldId)
          Sets the fieldId to use to fetch a 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

FieldIdSortCriteria

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


FieldIdSortCriteria

public FieldIdSortCriteria(java.lang.String fieldId)
Constructs a FieldIdSortCriteria with the specified fieldId to use to fetch a FieldKey.

Parameters:
fieldId - The desired fieldId to use to fetch a FieldKey

FieldIdSortCriteria

public FieldIdSortCriteria(java.lang.String fieldId,
                           boolean ascending)
Constructs a FieldIdSortCriteria with the specified fieldId and ascending state.

Parameters:
fieldId - The desired fieldId to use to retrieve a FieldKey
ascending - The desired boolean state for the ascending property
Method Detail

getFieldId

public java.lang.String getFieldId()
Returns the fieldId to use to retrieve a FieldKey for this sort criteria.

Returns:
The currently set fieldId for this sort criteria

setFieldId

public void setFieldId(java.lang.String fieldId)
Sets the fieldId to use to fetch a FieldKey for this sort criteria.

Parameters:
fieldId - The desired fieldId for this sort criteria

getDisplayName

public java.lang.String getDisplayName()

If no display name is set, this returns the fieldId.

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 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 (retrieved using the fieldId) 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.