public interface TreeTable
TreeTable
can be seen as a table in which the first
column contains a tree. Every row in this table is a TreeTable.Node
instance, and each
node can have an arbitrary number of children nodes.
Below is an example of what a two-columns TreeTable
instance may look like
when formatted as a text:
Citation ├─Title…………………………………………………………… Open Geospatial Consortium ├─Presentation Forms………………………… document digital ├─Cited Responsible Parties │ ├─Organisation Name………………… Open Geospatial Consortium │ ├─Role…………………………………………………… resource provider │ └─Contact Info │ └─Online Resource │ ├─Linkage……………………… http://www.opengeospatial.org/ │ └─Function…………………… information └─Identifiers └─Code…………………………………………………… OGC
In many cases, the columns are known in advance as hard-coded static constants.
Those column constants are typically documented close to the class producing the
TreeTable
instance. Using directly those static constants provides type
safety, as in the following example:
TreeTable table = ...; // Put here a TreeTable instance. TreeTable.Node node = table.getRoot(); CharSequence name = node.getValue(TableColumn.NAME); Class<?> type = node.getValue(TableColumn.TYPE);In the above example, the type of value returned by the
TreeTable.Node.getValue(TableColumn)
method is determined by the column constant. However this approach is possible only when
the table structure is known in advance. If a method needs to work with arbitrary tables,
then that method can get the list of columns by a call to getColumns()
. However
this column list does not provide the above type-safety.Defined in the sis-utility
module
Modifier and Type | Interface and Description |
---|---|
static interface |
TreeTable.Node
A node in a tree combined with a row in a table.
|
Modifier and Type | Method and Description |
---|---|
List<TableColumn<?>> |
getColumns()
Returns the table columns, in the order they shall be rendered by default.
|
TreeTable.Node |
getRoot()
Returns the root node of the tree.
|
List<TableColumn<?>> getColumns()
TreeTable.Node
instance can return null
for a
particular column if the node doesn't have that column.TreeTable.Node.getValue(TableColumn)
,
TreeTable.Node.setValue(TableColumn, Object)
TreeTable.Node getRoot()
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.