com.sun.data.provider
Class SortCriteria

java.lang.Object
  extended bycom.sun.data.provider.SortCriteria
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
FieldIdSortCriteria, FieldKeySortCriteria

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

The abstract SortCriteria class defines a single sort criteria for a TableDataFilter. This includes a boolean to indicate an ascending (true) or descending (false) sort critiera. Subclasses override the getSortValue(TableDataProvider, RowKey) method to provide a sortable value for the particular row in the table. An array of these SortCriteria objects are used to define the sort order for a TableDataProvider.

See Also:
Serialized Form

Constructor Summary
SortCriteria()
          Constructs a new SortCriteria object with no display name and the default state for include (true).
SortCriteria(java.lang.String displayName)
          Constructs a new SortCriteria object with the specified display name and the default state for the include/exclude (true == include).
SortCriteria(java.lang.String displayName, boolean ascending)
          Constructs a new SortCriteria object with the specified display name and state for include/exclude (true == include).
 
Method Summary
abstract  java.lang.String getCriteriaKey()
          Returns a String uniquely identifying this sort criteria.
 java.lang.String getDisplayName()
          Returns the display name for this sort criteria.
abstract  java.lang.Object getSortValue(TableDataProvider provider, RowKey rowKey)
          Provides the data value to use while sorting a particular row.
 boolean isAscending()
          Returns the ascending sort state for this SortCriteria
 void setAscending(boolean ascending)
          Sets the ascending sort state for this SortCriteria
 void setDisplayName(java.lang.String displayName)
          Sets the display name for this filter criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortCriteria

public SortCriteria()

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


SortCriteria

public SortCriteria(java.lang.String displayName)

Constructs a new SortCriteria 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

SortCriteria

public SortCriteria(java.lang.String displayName,
                    boolean ascending)

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

Parameters:
displayName - The desired display name for this filter criteria
ascending - true for ascending sort, or false for descending.
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 sort criteria.

Returns:
The display name of this sort criteria

setAscending

public void setAscending(boolean ascending)
Sets the ascending sort state for this SortCriteria

Parameters:
ascending - true for ascending, false for desscending

isAscending

public boolean isAscending()
Returns the ascending sort state for this SortCriteria

Returns:
true for ascending, false for descending

getCriteriaKey

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

Returns:
A String that uniquely identifies this sort criteria

getSortValue

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

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.

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