|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectSortModel
public class SortModel
The SortModel class groups a set of Sort objects. This class also provides a set of methods
for interacting with a group of Sort objects.
The list of Sort objects in a SortModel are ordered. The first sort in group is known as the
"primary" sort and subsequent Sorts are "secondary". The interpretation of using Sorts into
to order a data set is left to implementations of sort algoritms. For example, one possible
sort implementation could order the sorts such that the secondary sort occurs inside the
data ordered by the primary sort and so on.
In addition to accessing the Sort objects, the SortModel provides a the ability to plug a simple state
machine that controls how to change a sort direction when cycling through the set of sort directions.
For example, when using a data grid to sort columns of data, a column may start off unsorted,
change to SortDirection.ASCENDING, to SortDirection.DESCENDING, and finally back to
SortDirection.NONE. The SortStrategy allows this strategy to be changed so that the
sorts can change from SortDirection.NONE to SortDirection.DESCENDING, to
SortDirection.ASCENDING, and finally back to SortDirection.NONE.
| Constructor Summary | |
|---|---|
SortModel(List sorts)
Construct the SortModel with a List of sorts. |
|
| Method Summary | |
|---|---|
SortDirection |
getSortDirection(String sortExpression)
Get the SortDirection for a Sort given a sort expression. |
List |
getSorts()
|
SortStrategy |
getSortStrategy()
Get the SortStrategy used to cycle these Sort objects through various
SortDirections. |
boolean |
isPrimarySort(String sortExpression)
Check to see if a sort expression is the first Sort in the SortModel. |
boolean |
isSorted(String sortExpression)
Check to see if the SortModel contains a Sort whose sort expression matches the given
sortExpression. |
Sort |
lookupSort(String sortExpression)
Lookup a Sort object whose Sort.getSortExpression() matches
the given sortExpression. |
void |
setSortStrategy(SortStrategy sortStrategy)
Set the SortStrategy. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SortModel(List sorts)
List of sorts.
sorts - the sorts| Method Detail |
|---|
public SortStrategy getSortStrategy()
SortStrategy used to cycle these Sort objects through various
SortDirections.
SortStrategypublic void setSortStrategy(SortStrategy sortStrategy)
SortStrategy.
sortStrategy - the new SortStrategypublic List getSorts()
public boolean isPrimarySort(String sortExpression)
Sort in the SortModel. If the
first Sort in the SortModel has a Sort.getSortExpression() that matches the
sortExpression parameter, the method returns true. Otherwise, it
returns false.
sortExpression - the sort expression to use when checking the SortModel's first Sort
true if the first Sort has a sortExpression that matches the
sortExpression parameter. false otherwise.public boolean isSorted(String sortExpression)
Sort whose sort expression matches the given
sortExpression.
sortExpression - the sortExpression used to locate a Sort
true if a Sort is found whose Sort.getSortExpression() matches
the given sortExpression. false otherwise.public SortDirection getSortDirection(String sortExpression)
SortDirection for a Sort given a sort expression.
sortExpression - the sort expression used to locate a Sort object.
Sort's SortDirection if one is found whose sortExpression
property matches the given sortExpression. null otherwise.public Sort lookupSort(String sortExpression)
Sort object whose Sort.getSortExpression() matches
the given sortExpression.
sortExpression - the sortExpression used to locate a Sort
Sort if one is found whose sortExpression property matches
the given sortExpression. null otherwise.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||