Class 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 using AbstractSortedTableModel
    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
    • 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.table.TableModel

        addTableModelListener, removeTableModelListener
    • Field Detail

      • model

        protected javax.swing.table.TableModel model
        Deprecated.
    • Constructor Detail

      • DefaultSortedTableModel

        @Deprecated
        public DefaultSortedTableModel​(javax.swing.table.TableModel model)
        Deprecated.
        You should instead be using AbstractSortedTableModel
        Construct a new TableSorter using the given model.
    • Method Detail

      • setSort

        public void setSort​(int column,
                            boolean ascending)
        Deprecated.
      • 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 interface SortedTableModel
        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 interface javax.swing.event.TableModelListener
      • getValueAt

        public java.lang.Object getValueAt​(int aRow,
                                           int aColumn)
        Deprecated.
        Specified by:
        getValueAt in interface javax.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 interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.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 interface SortedTableModel
        Parameters:
        columnIndex - the column index
        Returns:
        true if the specified columnIndex is sortable
      • resort

        public void resort()
        Deprecated.
      • getRowCount

        public int getRowCount()
        Deprecated.
        Specified by:
        getRowCount in interface javax.swing.table.TableModel
        See Also:
        TableModel.getRowCount()
      • getColumnCount

        public int getColumnCount()
        Deprecated.
        Specified by:
        getColumnCount in interface javax.swing.table.TableModel
        See Also:
        TableModel.getColumnCount()
      • getColumnName

        public java.lang.String getColumnName​(int aColumn)
        Deprecated.
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
        See Also:
        TableModel.getColumnName(int)
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int aColumn)
        Deprecated.
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
        See Also:
        TableModel.getColumnClass(int)
      • isCellEditable

        public boolean isCellEditable​(int row,
                                      int column)
        Deprecated.
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
        See Also:
        TableModel.isCellEditable(int, int)