|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<T>
com.google.gwt.visualization.client.DataColumn<T>
public abstract class DataColumn<T>
Represents a list view of a data column in an AbstractDataTable.
For example:
int columnIndex = ...;
DataColumn<Integer> intColumn =
DataColumn.integers(data, columnIndex);
for (int value : intColumn) {
...
}
DataColumn<String> stringColumn =
DataColumn.strings(data, stringColumnIndex);
...
Or if the column type is unknown: DataColumn<?> column = DataColumn.of(data, columnIndex);
This is useful for looping through a single column with the Java enhanced for
loop. It also allows utilities provided in Java collection framework to be
used. For example, Collections.min(java.util.Collection),
Collections.max(java.util.Collection), Collections.binarySearch(List, Object) or Guava utilities such
as com.google.common.collect.Iterable.filter etc.
Passing around DataColumn object is also easier than passing around a
data table along with the column index integer.
No mutation method such as List.add(Object) is supported,
except List.set(int, Object), which writes through to the underlying
data if the data is an instance of DataTable.
In order to add a row to the underlying table, use DataTable.addRow(). And then setValue(int, T) or set(int, T) can be used
to set cell values.
| Field Summary |
|---|
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Method Summary | |
|---|---|
static DataColumn<java.lang.Boolean> |
booleans(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<java.lang.Boolean> |
booleans(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
static DataColumn<java.util.Date> |
dates(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<java.util.Date> |
dates(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
static DataColumn<java.util.Date> |
datetimes(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<java.util.Date> |
datetimes(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
static DataColumn<java.lang.Double> |
doubles(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<java.lang.Double> |
doubles(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
abstract T |
get(int row)
Returns the cell value at row. |
static java.util.List<DataColumn<?>> |
getAllColumns(AbstractDataTable dataTable)
Returns a list of all the columns in the specified table, in the order they appear in the table. |
java.lang.String |
getColumnId()
Returns the column id. |
int |
getColumnIndex()
Returns the column index. |
java.lang.String |
getColumnLabel()
Returns the column label. |
AbstractDataTable.ColumnType |
getColumnType()
Returns the column type. |
AbstractDataTable |
getDataTable()
Returns the underlying table that this object reads from or writes to. |
static DataColumn<java.lang.Integer> |
integers(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<java.lang.Integer> |
integers(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
static DataColumn<?> |
of(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<?> |
of(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
T |
set(int row,
T value)
Sets the cell value at row to value and returns the
previous cell value. |
void |
setValue(int row,
T value)
Sets the cell value at row to value. |
int |
size()
Returns the number of rows in the underlying table. |
static DataColumn<java.lang.String> |
strings(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<java.lang.String> |
strings(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
static DataColumn<TimeOfDay> |
timeOfDays(AbstractDataTable table,
int columnIndex)
Returns the column identified by columnIndex in table. |
static DataColumn<TimeOfDay> |
timeOfDays(AbstractDataTable table,
java.lang.String columnId)
Returns the column identified by columnId in table. |
| Methods inherited from class java.util.AbstractList |
|---|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
| Method Detail |
|---|
public final java.lang.String getColumnId()
public final AbstractDataTable.ColumnType getColumnType()
public final java.lang.String getColumnLabel()
public final int getColumnIndex()
public final AbstractDataTable getDataTable()
public abstract T get(int row)
row.
get in interface java.util.List<T>get in class java.util.AbstractList<T>
public final T set(int row,
T value)
row to value and returns the
previous cell value. Unsupported unless the underlying table is an instance
of DataTable.
When the previous value isn't need, use setValue(int, Object)
for better performance.
set in interface java.util.List<T>set in class java.util.AbstractList<T>
public final void setValue(int row,
T value)
row to value. Unsupported unless the
underlying table is an instance of DataTable.
public final int size()
size in interface java.util.Collection<T>size in interface java.util.List<T>size in class java.util.AbstractCollection<T>
public static DataColumn<?> of(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<?> of(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static DataColumn<java.lang.Boolean> booleans(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<java.lang.Boolean> booleans(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static DataColumn<java.lang.Integer> integers(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<java.lang.Integer> integers(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static DataColumn<java.lang.Double> doubles(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<java.lang.Double> doubles(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static DataColumn<java.lang.String> strings(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<java.lang.String> strings(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static DataColumn<java.util.Date> dates(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<java.util.Date> dates(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static DataColumn<java.util.Date> datetimes(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<java.util.Date> datetimes(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static DataColumn<TimeOfDay> timeOfDays(AbstractDataTable table,
java.lang.String columnId)
columnId in table.
java.lang.IllegalArgumentException - if columnId is not found
public static DataColumn<TimeOfDay> timeOfDays(AbstractDataTable table,
int columnIndex)
columnIndex in table.
public static java.util.List<DataColumn<?>> getAllColumns(AbstractDataTable dataTable)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||