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 usingAbstractSortedTableModelA 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.TableModelmodelDeprecated.-
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 voidaddSortListener(SortListener l)Deprecated.Adds a listener to be notified when the sort state of this model changes.voiddeRegisterComparator(int column)Deprecated.voidenableSorter(boolean enable)Deprecated.Enable the sorter according to the enable parameter.java.lang.Class<?>getColumnClass(int aColumn)Deprecated.intgetColumnCount()Deprecated.java.lang.StringgetColumnName(int aColumn)Deprecated.javax.swing.table.TableModelgetModel()Deprecated.intgetPrimarySortColumnIndex()Deprecated.intgetRowCount()Deprecated.intgetSortedIndex(int aRow)Deprecated.Converts a sorted index into an unsorted index.TableSortStategetTableSortState()Deprecated.java.lang.ObjectgetValueAt(int aRow, int aColumn)Deprecated.booleanisAscending()Deprecated.booleanisCellEditable(int row, int column)Deprecated.booleanisSortable(int columnIndex)Deprecated.Returns true if the specified columnIndex is sortable.voidregisterComparator(java.util.Comparator<?> comparator, int column)Deprecated.voidresort()Deprecated.voidsetModel(javax.swing.table.TableModel model)Deprecated.voidsetSort(int column, boolean ascending)Deprecated.voidsetTableSortState(TableSortState sortStates)Deprecated.voidsetValueAt(java.lang.Object aValue, int aRow, int aColumn)Deprecated.voidsortByColumn(int column)Deprecated.Sorts the model in ascending order by the specified columnIndex.voidtableChanged(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 usingAbstractSortedTableModelConstruct 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:
getPrimarySortColumnIndexin 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:SortedTableModelAdds 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:
addSortListenerin 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:
tableChangedin interfacejavax.swing.event.TableModelListener
-
getValueAt
public java.lang.Object getValueAt(int aRow, int aColumn)Deprecated.- Specified by:
getValueAtin 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:
setValueAtin interfacejavax.swing.table.TableModel- Overrides:
setValueAtin 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:SortedTableModelReturns true if the specified columnIndex is sortable.- Specified by:
isSortablein 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:
getTableSortStatein interfaceSortedTableModel
-
setTableSortState
public void setTableSortState(TableSortState sortStates)
Deprecated.- Specified by:
setTableSortStatein interfaceSortedTableModel
-
getRowCount
public int getRowCount()
Deprecated.- Specified by:
getRowCountin interfacejavax.swing.table.TableModel- See Also:
TableModel.getRowCount()
-
getColumnCount
public int getColumnCount()
Deprecated.- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel- See Also:
TableModel.getColumnCount()
-
getColumnName
public java.lang.String getColumnName(int aColumn)
Deprecated.- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classjavax.swing.table.AbstractTableModel- See Also:
TableModel.getColumnName(int)
-
getColumnClass
public java.lang.Class<?> getColumnClass(int aColumn)
Deprecated.- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel- See Also:
TableModel.getColumnClass(int)
-
isCellEditable
public boolean isCellEditable(int row, int column)Deprecated.- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classjavax.swing.table.AbstractTableModel- See Also:
TableModel.isCellEditable(int, int)
-
-