Package docking.widgets.table
Class DefaultSortedTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- docking.widgets.table.DefaultSortedTableModel
-
- All Implemented Interfaces:
SortedTableModel
,java.io.Serializable
,java.util.EventListener
,javax.swing.event.TableModelListener
,javax.swing.table.TableModel
@Deprecated public class DefaultSortedTableModel extends javax.swing.table.AbstractTableModel implements SortedTableModel, javax.swing.event.TableModelListener
Deprecated.You should instead be usingAbstractSortedTableModel
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 (e.g., "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.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface docking.widgets.table.SortedTableModel
SortedTableModel.DefaultComparator
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.table.TableModel
model
Deprecated.-
Fields inherited from interface docking.widgets.table.SortedTableModel
ASCENDING_ORDER, DEFAULT_COMPARATOR, DESCENDING_ORDER
-
-
Constructor Summary
Constructors Constructor Description DefaultSortedTableModel(javax.swing.table.TableModel model)
Deprecated.You should instead be usingAbstractSortedTableModel
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addSortListener(SortListener l)
Deprecated.Adds a listener to be notified when the sort state of this model changes.void
deRegisterComparator(int column)
Deprecated.void
enableSorter(boolean enable)
Deprecated.Enable the sorter according to the enable parameter.java.lang.Class<?>
getColumnClass(int aColumn)
Deprecated.int
getColumnCount()
Deprecated.java.lang.String
getColumnName(int aColumn)
Deprecated.javax.swing.table.TableModel
getModel()
Deprecated.int
getPrimarySortColumnIndex()
Deprecated.int
getRowCount()
Deprecated.int
getSortedIndex(int aRow)
Deprecated.Converts a sorted index into an unsorted index.TableSortState
getTableSortState()
Deprecated.java.lang.Object
getValueAt(int aRow, int aColumn)
Deprecated.boolean
isAscending()
Deprecated.boolean
isCellEditable(int row, int column)
Deprecated.boolean
isSortable(int columnIndex)
Deprecated.Returns true if the specified columnIndex is sortable.void
registerComparator(java.util.Comparator<?> comparator, int column)
Deprecated.void
resort()
Deprecated.void
setModel(javax.swing.table.TableModel model)
Deprecated.void
setSort(int column, boolean ascending)
Deprecated.void
setTableSortState(TableSortState sortStates)
Deprecated.void
setValueAt(java.lang.Object aValue, int aRow, int aColumn)
Deprecated.void
sortByColumn(int column)
Deprecated.Sorts the model in ascending order by the specified columnIndex.void
tableChanged(javax.swing.event.TableModelEvent e)
Deprecated.-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Constructor Detail
-
DefaultSortedTableModel
@Deprecated public DefaultSortedTableModel(javax.swing.table.TableModel model)
Deprecated.You should instead be usingAbstractSortedTableModel
Construct a new TableSorter using the given model.
-
-
Method Detail
-
setSort
public void setSort(int column, boolean ascending)
Deprecated.
-
getPrimarySortColumnIndex
public int getPrimarySortColumnIndex()
Deprecated.- Specified by:
getPrimarySortColumnIndex
in interfaceSortedTableModel
-
isAscending
public boolean isAscending()
Deprecated.
-
setModel
public void setModel(javax.swing.table.TableModel model)
Deprecated.
-
getModel
public javax.swing.table.TableModel getModel()
Deprecated.
-
enableSorter
public void enableSorter(boolean enable)
Deprecated.Enable the sorter according to the enable parameter. This method should be called with enable set to false before the table model is populated or else a sort will be done after each row is inserted, and that would not be good.- Parameters:
enable
- true means to enable the sorting.
-
addSortListener
public void addSortListener(SortListener l)
Deprecated.Description copied from interface:SortedTableModel
Adds a listener to be notified when the sort state of this model changes.
Note: the listener may be stored in a weak collection, which means you have to maintain a handle to the listener so that it does not get garbage collected.- Specified by:
addSortListener
in interfaceSortedTableModel
- Parameters:
l
- the listener
-
registerComparator
public void registerComparator(java.util.Comparator<?> comparator, int column)
Deprecated.
-
deRegisterComparator
public void deRegisterComparator(int column)
Deprecated.
-
tableChanged
public void tableChanged(javax.swing.event.TableModelEvent e)
Deprecated.- Specified by:
tableChanged
in interfacejavax.swing.event.TableModelListener
-
getValueAt
public java.lang.Object getValueAt(int aRow, int aColumn)
Deprecated.- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- See Also:
TableModel.getValueAt(int, int)
-
getSortedIndex
public int getSortedIndex(int aRow)
Deprecated.Converts a sorted index into an unsorted index. This is good if you need to access the underlying table directly by the unsorted index.
-
setValueAt
public void setValueAt(java.lang.Object aValue, int aRow, int aColumn)
Deprecated.- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Overrides:
setValueAt
in classjavax.swing.table.AbstractTableModel
- See Also:
TableModel.setValueAt(java.lang.Object, int, int)
-
sortByColumn
public void sortByColumn(int column)
Deprecated.Sorts the model in ascending order by the specified columnIndex.- Parameters:
column
- the index of the column to sort
-
isSortable
public boolean isSortable(int columnIndex)
Deprecated.Description copied from interface:SortedTableModel
Returns true if the specified columnIndex is sortable.- Specified by:
isSortable
in interfaceSortedTableModel
- Parameters:
columnIndex
- the column index- Returns:
- true if the specified columnIndex is sortable
-
resort
public void resort()
Deprecated.
-
getTableSortState
public TableSortState getTableSortState()
Deprecated.- Specified by:
getTableSortState
in interfaceSortedTableModel
-
setTableSortState
public void setTableSortState(TableSortState sortStates)
Deprecated.- Specified by:
setTableSortState
in interfaceSortedTableModel
-
getRowCount
public int getRowCount()
Deprecated.- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
- See Also:
TableModel.getRowCount()
-
getColumnCount
public int getColumnCount()
Deprecated.- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- See Also:
TableModel.getColumnCount()
-
getColumnName
public java.lang.String getColumnName(int aColumn)
Deprecated.- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in classjavax.swing.table.AbstractTableModel
- See Also:
TableModel.getColumnName(int)
-
getColumnClass
public java.lang.Class<?> getColumnClass(int aColumn)
Deprecated.- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
- See Also:
TableModel.getColumnClass(int)
-
isCellEditable
public boolean isCellEditable(int row, int column)
Deprecated.- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Overrides:
isCellEditable
in classjavax.swing.table.AbstractTableModel
- See Also:
TableModel.isCellEditable(int, int)
-
-