Class TableSorter

All Implemented Interfaces:
Serializable, EventListener, TableModelListener, TableModel

public class TableSorter
extends TableMap
A sorter for TableModels. The sorter has a model (conforming to TableModel) and itself implements TableModel. TableSorter does not store or copy the data in the TableModel, instead it maintains an array of integers which it keeps the same size as the number of rows in its model. When the model changes it notifies the sorter that something has changed eg. "rowsAdded" so that its internal array of integers can be reallocated. As requests are made of the sorter (like getValueAt(row, col) it redirects them to its model via the mapping array. That way the TableSorter appears to hold another copy of the table with the rows in a different order. The sorting algorithm used is stable which means that it does not move around rows when its comparison function returns 0 to denote that they are equivalent.
LM addition
The headers now respond by Ctrl+click by adapting their size to the minimal size necessary to fully display the String rendering of each component in that column.
Note that this functionality hinges on the fact that resize mode of the table should be set to OFF (yourTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF)).
Version:
1.6 21/02/2003
Author:
Philip Milne, Lennart Martens
See Also:
Serialized Form