Class SortableTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
org.jfree.ui.SortableTableModel
- All Implemented Interfaces:
Serializable, TableModel
- Direct Known Subclasses:
SystemPropertiesTableModel
The base class for a sortable table model.
- Author:
- David Gilbert
- See Also:
-
Field Summary
Fields inherited from class AbstractTableModel
listenerList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the index of the sorting column, or -1 if the data is not sorted on any column.booleanReturnstrueif the data is sorted in ascending order, andfalseotherwise.booleanisSortable(int column) Returns a flag indicating whether or not a column is sortable.voidsetAscending(boolean flag) Sets the flag that determines whether the sort order is ascending or descending.voidsortByColumn(int column, boolean ascending) Sorts the table.Methods inherited from class AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAtMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TableModel
getColumnCount, getRowCount, getValueAt
-
Constructor Details
-
SortableTableModel
public SortableTableModel()Constructs a sortable table model.
-
-
Method Details
-
getSortingColumn
Returns the index of the sorting column, or -1 if the data is not sorted on any column.- Returns:
- the column used for sorting.
-
isAscending
Returnstrueif the data is sorted in ascending order, andfalseotherwise.- Returns:
trueif the data is sorted in ascending order, andfalseotherwise.
-
setAscending
Sets the flag that determines whether the sort order is ascending or descending.- Parameters:
flag- the flag.
-
sortByColumn
Sorts the table.- Parameters:
column- the column to sort on (zero-based index).ascending- a flag to indicate ascending order or descending order.
-
isSortable
Returns a flag indicating whether or not a column is sortable.- Parameters:
column- the column (zero-based index).- Returns:
- boolean.
-