com.sptci.echo.table
Class DefaultSortableTableModel<D>
java.lang.Object
nextapp.echo.app.table.AbstractTableModel
com.sptci.echo.table.AbstractTableModel<D>
com.sptci.echo.table.TableModel<D>
com.sptci.echo.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 4865 2009-08-18 20:12:40Z rakesh $
- Author:
- Rakesh Vidyadharan 2007-11-12
- See Also:
- Serialized Form
|
Field Summary |
protected boolean |
lockLastRow
A flag that indicates that the last row is to be kept locked in position. |
|
Method Summary |
boolean |
isLockLastRow()
Return whether sorting keeps the last row locked in position or not. |
void |
setLockLastRow(boolean lockLastRow)
Specify whether the last row should be locked in position. |
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.echo.table.TableModel |
addRow, deleteRow, deleteRow, getColumnAnnotations, getColumnClass, getColumnCount, getColumnName, getObjectAt, getRowCount, getValueAt, init, insertRow, processColumnAnnotations, processColumns, processColumnsAnnotation, processFields, updateRow |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lockLastRow
protected boolean lockLastRow
- A flag that indicates that the last row is to be kept locked in position.
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()
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()
isLockLastRow
public boolean isLockLastRow()
- Return whether sorting keeps the last row locked in position or not.
This is useful when the last row in the model represents summary
information.
- Returns:
- Whether the last row is locked or not. Default value is
false.
setLockLastRow
public void setLockLastRow(boolean lockLastRow)
- Specify whether the last row should be locked in position. Note that
the flag must be set before any sorting operations have taken place
to ensure proper functioning.
- Parameters:
lockLastRow - The value to set.