org.jdesktop.swingx.decorator
Class Sorter

java.lang.Object
  extended by org.jdesktop.swingx.decorator.Filter
      extended by org.jdesktop.swingx.decorator.Sorter
Direct Known Subclasses:
ShuttleSorter

public abstract class Sorter
extends Filter

Pluggable sorting filter.

Author:
Ramesh Gupta

Constructor Summary
Sorter()
           
Sorter(int col, boolean ascending)
           
Sorter(int col, boolean ascending, java.util.Comparator comparator)
           
 
Method Summary
 java.util.Comparator getComparator()
           
 SortKey getSortKey()
           
 SortOrder getSortOrder()
           
 boolean isAscending()
           
 void setAscending(boolean ascending)
           
 void setComparator(java.util.Comparator comparator)
          set the Comparator to use when comparing values.
 void setSortKey(SortKey sortKey)
          Updates itself according to the SortKey's properties.
 void toggle()
           
 
Methods inherited from class org.jdesktop.swingx.decorator.Filter
convertRowIndexToModel, convertRowIndexToView, getColumnIndex, getColumnName, getSize, getStringAt, getValueAt, isCellEditable, refresh, setColumnIndex, setValueAt
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sorter

public Sorter()

Sorter

public Sorter(int col,
              boolean ascending)

Sorter

public Sorter(int col,
              boolean ascending,
              java.util.Comparator comparator)
Method Detail

setComparator

public void setComparator(java.util.Comparator comparator)
set the Comparator to use when comparing values. If not null every compare will be delegated to it. If null the compare will follow the internal compare (no contract, but implemented here as: first check if the values are Comparable, if so delegate, then compare the String representation)

Parameters:
comparator -

getComparator

public java.util.Comparator getComparator()

isAscending

public boolean isAscending()

setAscending

public void setAscending(boolean ascending)

getSortOrder

public SortOrder getSortOrder()

setSortKey

public void setSortKey(SortKey sortKey)
Updates itself according to the SortKey's properties.

Parameters:
sortKey -
Throws:
java.lang.IllegalArgumentException - if sortKey = null
java.lang.IllegalArgumentException - if !sortKey.sortOrder().isSorted

getSortKey

public SortKey getSortKey()

toggle

public void toggle()