Package org.jdesktop.swingx.decorator
Class SortKey
- java.lang.Object
-
- org.jdesktop.swingx.decorator.SortKey
-
public class SortKey extends java.lang.Object
A column and how its sorted.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
getColumn()
The sorting column in terms of model index.java.util.Comparator
getComparator()
The comparator to use, might be null.static SortKey
getFirstSortingKey(java.util.List<? extends SortKey> keys)
Returns the first SortKey in the list which is sorted.static SortKey
getFirstSortKeyForColumn(java.util.List<? extends SortKey> keys, int modelColumn)
Returns the first SortKey in the list for the given column, or null if the column has no SortKey.SortOrder
getSortOrder()
The sort order, ascending, descending or unsorted.int
hashCode()
-
-
-
Constructor Detail
-
SortKey
public SortKey(SortOrder sortOrder, int column)
- Parameters:
sortOrder
- one ofSortOrder.ASCENDING
,SortOrder.DESCENDING
orSortOrder.UNSORTED
.column
- a column in terms of model index.
-
SortKey
public SortKey(SortOrder sortOrder, int column, java.util.Comparator comparator)
- Parameters:
sortOrder
- one ofSortOrder.ASCENDING
,SortOrder.DESCENDING
orSortOrder.UNSORTED
.column
- a column in terms of model index.comparator
- the comparator to use with this sort.
-
-
Method Detail
-
getSortOrder
public SortOrder getSortOrder()
The sort order, ascending, descending or unsorted.
-
getColumn
public int getColumn()
The sorting column in terms of model index.
-
getComparator
public java.util.Comparator getComparator()
The comparator to use, might be null.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getFirstSortingKey
public static SortKey getFirstSortingKey(java.util.List<? extends SortKey> keys)
Returns the first SortKey in the list which is sorted. If none is sorted, null is returned.- Parameters:
keys
- a list of SortKeys to search- Returns:
- the first SortKey which is sorted or null, if no is found.
-
getFirstSortKeyForColumn
public static SortKey getFirstSortKeyForColumn(java.util.List<? extends SortKey> keys, int modelColumn)
Returns the first SortKey in the list for the given column, or null if the column has no SortKey.- Parameters:
keys
- a list of SortKeys to searchmodelColumn
- the column index in model coordinates- Returns:
- the first SortKey for the given column or null if none is found.
-
-