qflib 0.98.0

de.qfs.lib.gui
Interface TableModelSorter

All Known Implementing Classes:
DefaultTableModelSorter

public interface TableModelSorter

Interface for sorters used by FilteredAndSortedTableModel. The compare method will be called with the original TableModel and two row indices into the model.

Version:
$Revision: 1.6 $
Author:
Gregor Schmid

Method Summary
 void addTableModelSorterListener(TableModelSorterListener listener)
          Add a TableModelSorterListener to the TableModelSorter.
 int compare(javax.swing.table.TableModel model, int idx1, int idx2)
          Compare two rows of the table.
 int getSortColumn()
          Get the column being sorted on.
 boolean isSortAscending()
          Query whether the rows are sorted in ascending order.
 void removeTableModelSorterListener(TableModelSorterListener listener)
          Remove a TableModelSorterListener from the TableModelSorter.
 void setSortAscending(boolean ascending)
          Tell the TableSorter whether the sort order is ascending.
 void setSortColumn(int column)
          Tell the TableSorter the column to sort on.
 

Method Detail

compare

public int compare(javax.swing.table.TableModel model,
                   int idx1,
                   int idx2)
Compare two rows of the table.
Parameters:
model - The original TableModel.
idx1 - Index of the first row.
idx2 - Index of the second row.
Returns:
0 if the rows are equal, -1 if the first row's value is less than the second row's, 1 if it is greater.

addTableModelSorterListener

public void addTableModelSorterListener(TableModelSorterListener listener)
Add a TableModelSorterListener to the TableModelSorter.
Parameters:
listener - The TableModelSorterListener to add.

removeTableModelSorterListener

public void removeTableModelSorterListener(TableModelSorterListener listener)
Remove a TableModelSorterListener from the TableModelSorter.
Parameters:
listener - The TableModelSorterListener to remove.

setSortColumn

public void setSortColumn(int column)
Tell the TableSorter the column to sort on.
Parameters:
column - The column to sort on.

getSortColumn

public int getSortColumn()
Get the column being sorted on.
Returns:
The column being sorted on.

setSortAscending

public void setSortAscending(boolean ascending)
Tell the TableSorter whether the sort order is ascending.
Parameters:
ascending - True for ascending sort order.

isSortAscending

public boolean isSortAscending()
Query whether the rows are sorted in ascending order.
Returns:
True for ascending sort order.

qflib 0.98.0