public abstract class SortableTableModel extends javax.swing.table.AbstractTableModel
Constructor and Description |
---|
SortableTableModel()
Constructs a sortable table model.
|
Modifier and Type | Method and Description |
---|---|
int |
getSortingColumn()
Returns the index of the sorting column, or -1 if the data is not sorted
on any column.
|
boolean |
isAscending()
Returns
true if the data is sorted in ascending order, and
false otherwise. |
boolean |
isSortable(int column)
Returns a flag indicating whether or not a column is sortable.
|
void |
setAscending(boolean flag)
Sets the flag that determines whether the sort order is ascending or
descending.
|
void |
sortByColumn(int column,
boolean ascending)
Sorts the table.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
public SortableTableModel()
public int getSortingColumn()
public boolean isAscending()
true
if the data is sorted in ascending order, and
false
otherwise.true
if the data is sorted in ascending order, and
false
otherwise.public void setAscending(boolean flag)
flag
- the flag.public void sortByColumn(int column, boolean ascending)
column
- the column to sort on (zero-based index).ascending
- a flag to indicate ascending order or descending order.public boolean isSortable(int column)
column
- the column (zero-based index).