com.levigo.util.swing.table
Class TableSorter

java.lang.Object
  extended by com.levigo.util.swing.table.TableSorter

public class TableSorter
extends Object

Allows to sort tables. The following features are supported:

Author:
Lumir Boureanu, o.suck@levigo.de (modifications)

Constructor Summary
TableSorter(SortableTableModel model)
          Instantiate a TableSorter with a given table model.
 
Method Summary
 void addCriterium(int columnIndex, boolean isAscent, boolean clearExisting)
          Adds the given criteria to the vector of criteria and sorts the whole model.
 int getInsertionIndex(Comparable[] columnValues)
           
 int getSortDirection(int column)
          Return the sort direction for the given column: 0: the column is not considered for sorting 1: the column is sorted in ascending order -1: the column is sorted in descending order.
 int getSortPriority(int column)
          Get the sort priority for a given column.
 void resort()
          Resort table by using the stored criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableSorter

public TableSorter(SortableTableModel model)
Instantiate a TableSorter with a given table model.

Parameters:
model -
Method Detail

addCriterium

public void addCriterium(int columnIndex,
                         boolean isAscent,
                         boolean clearExisting)
Adds the given criteria to the vector of criteria and sorts the whole model.

Parameters:
columnIndex - column index to sort after
isAscent - true- ascendant; false descendant
clearExisting - true: remove previous criteria; false: add to existing criteria

getSortPriority

public int getSortPriority(int column)
Get the sort priority for a given column. Returns the 0-based priority or -1 if the column is not considered for sorting.

Parameters:
column -

getSortDirection

public int getSortDirection(int column)
Return the sort direction for the given column:

Parameters:
column -

resort

public void resort()
Resort table by using the stored criteria.

Please note: the indexes array of the model will be changed by this method!


getInsertionIndex

public int getInsertionIndex(Comparable[] columnValues)
Parameters:
columnValues -


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.