com.sptci.rwt.webui
Class SortableRowTableModel
java.lang.Object
nextapp.echo2.app.table.AbstractTableModel
com.sptci.echo2.table.AbstractTableModel<D>
com.sptci.echo2.table.TableModel<D>
com.sptci.echo2.table.DefaultPageableTableModel<Row>
com.sptci.rwt.webui.RowTableModel
com.sptci.rwt.webui.SortableRowTableModel
- All Implemented Interfaces:
- com.sptci.echo2.table.PageableTableModel, com.sptci.echo2.table.SortableTableModel, Serializable, TableModel
public class SortableRowTableModel
- extends RowTableModel
- implements com.sptci.echo2.table.SortableTableModel
A custom table model used to display Row objects.
© Copyright 2007 Sans Pareil Technologies, Inc.
- Since:
- Version 1.3
- Version:
- $Id: SortableRowTableModel.java 4123 2008-05-25 21:49:01Z rakesh $
- Author:
- Rakesh Vidyadharan 2007-11-13
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface com.sptci.echo2.table.SortableTableModel |
com.sptci.echo2.table.SortableTableModel.Direction |
|
Field Summary |
protected String |
orderBy
The name of the column to use in a SQL order by clause. |
| Fields inherited from class com.sptci.echo2.table.DefaultPageableTableModel |
page, pageSize, totalRows |
| Fields inherited from class com.sptci.echo2.table.TableModel |
columns, data |
| Fields inherited from class com.sptci.echo2.table.AbstractTableModel |
sortDirection, sortIndex |
|
Method Summary |
String |
getQuery()
Returns RowTableModel.query. |
void |
sort(int column)
Sort the data displayed in the table by the specified column. |
void |
sort(int column,
com.sptci.echo2.table.SortableTableModel.Direction direction)
Sort the data displayed in the table by the specified column. |
| Methods inherited from class com.sptci.echo2.table.DefaultPageableTableModel |
getPage, getPageSize, getTotalPages |
| Methods inherited from class com.sptci.echo2.table.TableModel |
addRow, deleteRow, deleteRow, getColumnAnnotations, getColumnClass, getColumnCount, getObjectAt, getRowCount, init, insertRow, processColumnAnnotations, processColumnsAnnotation, processFields, updateRow |
| Methods inherited from class com.sptci.echo2.table.AbstractTableModel |
getSortDirection |
| 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 |
orderBy
protected String orderBy
- The name of the column to use in a SQL order by clause.
SortableRowTableModel
public SortableRowTableModel(String query,
int maxRows,
int maxColumnLength,
ConnectionManager manager)
throws QueryException
- Create a new instance of the table model using the specified collection
of
Row objects.
- Parameters:
query - The sql statement that is to be executed to fetch any
additional pages of data.maxRows - The maximum number of rows to fetch from the
result set.maxColumnLength - The maximum number of characters to display in
a column.manager - The manager to use to fetch database connections.
- Throws:
QueryException - If errors are encountered while executing
the RowTableModel.query.- See Also:
RowTableModel.fetchData(),
RowTableModel.processColumns()
sort
public void sort(int column)
throws RuntimeException
- Sort the data displayed in the table by the specified column.
Re-fetch the data from the
RowTableModel.query ordered by the specified
column.
- Specified by:
sort in interface com.sptci.echo2.table.SortableTableModel
- Parameters:
column - The index of the column in TableModel.columns by which
to order the results.
- Throws:
RuntimeException - If errors are encountered while fetching
the data.- See Also:
SortableTableModel.sort( int ),
AbstractTableModel.getSortDirection(int),
SortableTableModel.sort( int, Direction )
sort
public void sort(int column,
com.sptci.echo2.table.SortableTableModel.Direction direction)
throws RuntimeException
- Sort the data displayed in the table by the specified column.
Re-fetch the data from the
RowTableModel.query ordered by the specified
column. The DefaultPageableTableModel.page is set to point to the first page of
data since the re-sorted data will usually have no reference to the
original data.
- Specified by:
sort in interface com.sptci.echo2.table.SortableTableModel
- Parameters:
column - The index of the column in TableModel.columns by which
to order the results.direction - The direction in which to sort the data.
- Throws:
RuntimeException - If errors are encountered while fetching
the data.
getQuery
public String getQuery()
- Returns
RowTableModel.query. Over-ridden to tag on an order by clause
if orderBy is not null.
- Overrides:
getQuery in class RowTableModel
- Returns:
- The value/reference of/to query.