public class SortedTable extends AbstractTable
Modifier and Type | Class and Description |
---|---|
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,
Column[] columns,
boolean useSpecifiedColumns)
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,
java.lang.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.
|
java.lang.Object |
getValue(int row,
java.lang.String columnName)
Returns this table value for the specified row and column.
|
void |
setRowComparator(java.util.Comparator 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. |
java.lang.String |
toString() |
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, Column[] columns, boolean useSpecifiedColumns) throws DataSetException
table
- decorated tablecolumns
- columns to be used for sortinguseSpecifiedColumns
- true to use the column definitions specified by the columns
parameter, false to use the column definitions from the
specified table's metadata.DataSetException
public SortedTable(ITable table, java.lang.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(java.util.Comparator comparator)
comparator
- that sorts the table rowspublic ITableMetaData getTableMetaData()
ITable
public int getRowCount()
ITable
public java.lang.Object getValue(int row, java.lang.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
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2002-2020. All Rights Reserved.