SPT Core API

com.sptci.echo2.table
Class DefaultSortableTableModel<D>

java.lang.Object
  extended by nextapp.echo2.app.table.AbstractTableModel
      extended by com.sptci.echo2.table.AbstractTableModel<D>
          extended by com.sptci.echo2.table.TableModel<D>
              extended by com.sptci.echo2.table.DefaultSortableTableModel<D>
Type Parameters:
D - The class of the model object displayed in the table.
All Implemented Interfaces:
SortableTableModel, Serializable, TableModel

public class DefaultSortableTableModel<D>
extends TableModel<D>
implements SortableTableModel

A genericised TableModel used to hold instances of objects of the type specified. Contains additional methods to sort the contents of the model.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: DefaultSortableTableModel.java 4120 2008-05-25 20:49:48Z rakesh $
Author:
Rakesh Vidyadharan 2007-11-12
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sptci.echo2.table.SortableTableModel
SortableTableModel.Direction
 
Field Summary
 
Fields inherited from class com.sptci.echo2.table.TableModel
columns, data
 
Fields inherited from class com.sptci.echo2.table.AbstractTableModel
sortDirection, sortIndex
 
Constructor Summary
protected DefaultSortableTableModel()
          Default constructor.
  DefaultSortableTableModel(Collection<D> collection)
          Create a new instance of the model using the specified collection of data objects.
 
Method Summary
 void sort(int column)
          Sort the data by the values in the specified column index.
 void sort(int column, SortableTableModel.Direction direction)
          Sort the data by the values in the specified column index.
 
Methods inherited from class com.sptci.echo2.table.TableModel
addRow, deleteRow, deleteRow, getColumnAnnotations, getColumnClass, getColumnCount, getColumnName, getObjectAt, getRowCount, getValueAt, init, insertRow, processColumnAnnotations, processColumns, processColumnsAnnotation, processFields, updateRow
 
Methods inherited from class com.sptci.echo2.table.AbstractTableModel
getSortDirection
 
Methods inherited from class nextapp.echo2.app.table.AbstractTableModel
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getEventListenerList, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sptci.echo2.table.SortableTableModel
getSortDirection
 

Constructor Detail

DefaultSortableTableModel

protected DefaultSortableTableModel()
Default constructor.


DefaultSortableTableModel

public DefaultSortableTableModel(Collection<D> collection)
Create a new instance of the model using the specified collection of data objects.

Parameters:
collection - The collection of data objects to display in the Table.
See Also:
TableModel.processColumns()
Method Detail

sort

public void sort(int column)
Sort the data by the values in the specified column index. Default implemented uses a TreeMap to sort the value in the specified column index.

Specified by:
sort in interface SortableTableModel
Parameters:
column - The index of the column by which the data is to be sorted.
See Also:
AbstractTableModel.getSortDirection(int), SortableTableModel.sort( int, Direction )

sort

public void sort(int column,
                 SortableTableModel.Direction direction)
Sort the data by the values in the specified column index. Default implemented uses a TreeMap to sort the value in the specified column index.

Specified by:
sort in interface SortableTableModel
Parameters:
column - The index of the column by which the data is to be sorted.
direction - The direction of sorting to be applied.
See Also:
AbstractTableModel.fireTableDataChanged()

SPT Core API