org.jurvis.swing.table
Interface JvSortableTableModel

All Superinterfaces:
TableModel
All Known Implementing Classes:
JvDefaultSortableTableModel

public interface JvSortableTableModel
extends TableModel

A TableModel that supports sorting rows by their columns.


Method Summary
 TableModel getModel()
          Return the true model that contains the table data.
 int getSortColumn()
          Returns the table model index of the column the model is sorted on.
 boolean isAscending()
          Return whether the sort is ascending or descending.
 void setAscending(boolean ascending)
          Set whether the sort is ascending or descending.
 void setSortColumn(int columnIndex)
          Sort the rows by the column with the specified table model index.
 void sortByColumn(int columnIndex, boolean ascending)
          Set the column to sort by and whether the sort is ascending or descending in one swoop.
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, getValueAt, isCellEditable, removeTableModelListener, setValueAt
 

Method Detail

getModel

TableModel getModel()
Return the true model that contains the table data.

Returns:
the model actually containing the table data

setSortColumn

void setSortColumn(int columnIndex)
Sort the rows by the column with the specified table model index.

Parameters:
columnIndex - the index of the column, or -1 for no sorting

getSortColumn

int getSortColumn()
Returns the table model index of the column the model is sorted on.

Returns:
the index of the sort column, or -1 if not sorted

setAscending

void setAscending(boolean ascending)
Set whether the sort is ascending or descending.

Parameters:
ascending - true if the sort is ascending, false otherwise

isAscending

boolean isAscending()
Return whether the sort is ascending or descending.

Returns:
true if the sort is ascending, false otherwise

sortByColumn

void sortByColumn(int columnIndex,
                  boolean ascending)
Set the column to sort by and whether the sort is ascending or descending in one swoop. Using this method is equivalent to a call to setSortColumn(int) and a call to setAscending(boolean) but only causes a single sort of the data instead of two.

Parameters:
columnIndex - the index of the column, or -1 for no sorting
ascending - true if the sort is ascending, false otherwise


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.