public class SortedTable extends AbstractTable
Modifier and Type | Class and Description |
---|---|
protected static class |
SortedTable.AbstractRowComparator
Abstract class for sorting the table rows of a given table in a specific order
|
protected static class |
SortedTable.RowComparator
Compares the rows with each other in order to sort them in the correct order using the
data type and the Comparable implementation the current column has.
|
protected static class |
SortedTable.RowComparatorByString
Compares the rows with each other in order to sort them in the correct order using
the string value of both values for the comparison.
|
Constructor and Description |
---|
SortedTable(ITable table)
Sort the decorated table by its own columns order which is defined by
ITable.getTableMetaData() . |
SortedTable(ITable table,
Column[] columns)
Sort the decorated table by specified columns order.
|
SortedTable(ITable table,
ITableMetaData metaData)
Sort the decorated table by specified metadata columns order.
|
SortedTable(ITable table,
String[] columnNames)
Sort the decorated table by specified columns order.
|
Modifier and Type | Method and Description |
---|---|
int |
getRowCount()
Returns this table row count.
|
Column[] |
getSortColumns() |
ITableMetaData |
getTableMetaData()
Returns this table metadata.
|
Object |
getValue(int row,
String columnName)
Returns this table value for the specified row and column.
|
void |
setRowComparator(SortedTable.AbstractRowComparator comparator)
Sets the comparator to be used for sorting the table rows.
|
void |
setUseComparable(boolean useComparable)
Whether or not the comparable interface should be used of the compared columns
instead of the plain strings
Default value is
false for backwards compatibility
Set whether or not to use the Comparable implementation of the corresponding column
DataType for comparing values or not. |
assertValidColumn, assertValidRowIndex, assertValidRowIndex, getColumnIndex
public SortedTable(ITable table, Column[] columns) throws DataSetException
table
- decorated tablecolumns
- columns to be used for sortingDataSetException
public SortedTable(ITable table, String[] columnNames) throws DataSetException
table
- decorated tablecolumnNames
- names of columns to be used for sortingDataSetException
public SortedTable(ITable table, ITableMetaData metaData) throws DataSetException
table
- The decorated tablemetaData
- The metadata used to retrieve all columns which in turn are used
for sorting the tableDataSetException
public SortedTable(ITable table) throws DataSetException
ITable.getTableMetaData()
.
All table columns will be used.table
- The decorated tableDataSetException
public Column[] getSortColumns()
public void setUseComparable(boolean useComparable)
false
for backwards compatibility
Set whether or not to use the Comparable implementation of the corresponding column
DataType for comparing values or not. Default value is false
which means that the old string comparison is used.
useComparable
- public void setRowComparator(SortedTable.AbstractRowComparator comparator)
comparator
- sorts the table rowspublic ITableMetaData getTableMetaData()
ITable
public int getRowCount()
ITable
public Object getValue(int row, String columnName) throws DataSetException
ITable
row
- The row index, starting with 0columnName
- The name of the columnNoSuchColumnException
- if specified column name do not exist in
this tableRowOutOfBoundsException
- if specified row is less than zero or
equals or greater than getRowCount
DataSetException
Copyright © 2002-2012. All Rights Reserved.