org.jdesktop.swingx.decorator
Class SortKey

java.lang.Object
  extended by org.jdesktop.swingx.decorator.SortKey

public class SortKey
extends java.lang.Object

A column and how its sorted.


Constructor Summary
SortKey(SortOrder sortOrder, int column)
           
SortKey(SortOrder sortOrder, int column, java.util.Comparator comparator)
           
 
Method Summary
 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()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortKey

public SortKey(SortOrder sortOrder,
               int column)
Parameters:
sortOrder - one of SortOrder.ASCENDING, SortOrder.DESCENDING or SortOrder.UNSORTED.
column - a column in terms of model index.

SortKey

public SortKey(SortOrder sortOrder,
               int column,
               java.util.Comparator comparator)
Parameters:
sortOrder - one of SortOrder.ASCENDING, SortOrder.DESCENDING or SortOrder.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 class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.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 search
modelColumn - the column index in model coordinates
Returns:
the first SortKey for the given column or null if none is found.