public static interface TreeTable.Node
TreeTable.Node
can be seen as a
tree node associated to a single user object (like ordinary trees),
augmented with the capability to describe some aspects of the user object in pre-defined columns.
The list of allowed columns is given by the TreeTable.getColumns()
method.
The following table summarizes the tree-related and table-related methods:
Tree-related methods | Table-related methods |
---|---|
Node
can be associated to an arbitrary object by the
getUserObject()
method. This object is not used directly by the tree tables.Defined in the sis-utility
module
Modifier and Type | Method and Description |
---|---|
Collection<TreeTable.Node> |
getChildren()
Returns the children of this node.
|
TreeTable.Node |
getParent()
Returns the parent node, or
null if this node is the root of the tree. |
Object |
getUserObject()
Returns the user object associated to this node.
|
<V> V |
getValue(TableColumn<V> column)
Returns the value in the given column, or
null if none. |
boolean |
isEditable(TableColumn<?> column)
Determines whether the value in the specified column is editable.
|
boolean |
isLeaf()
Returns
true if this node can not have any children. |
TreeTable.Node |
newChild()
Creates a new child with the same columns than the other children, and adds it to
the children collection.
|
<V> void |
setValue(TableColumn<V> column,
V value)
Sets the value for the given column (optional operation).
|
TreeTable.Node getParent()
null
if this node is the root of the tree.
There is intentionally no setParent(Node)
method, as children and parent managements
are highly implementation-dependant. If the children collection is
modifiable, then implementations are encouraged to update automatically the parent when a child
is added to or removed from that collection.
null
if none.boolean isLeaf()
true
if this node can not have any children. The children
collection of a leaf node can only be empty, and adding new child
is an unsupported operation.
This value is provided as a tip for graphical user interfaces, in order to determine if
a node is expandable (even if empty). TreeTableFormat
does not use this value.
true
if this node can not have any children.Collection<TreeTable.Node> getChildren()
The collection is often aTreeTable.Node newNode = new ...; // Create a new node here. parent.getChildren().add(newNode);
List
, but not necessarily. For some implementations like the
metadata tree table view,
compliance to the List
contract is impractical or inefficient.TreeTable.Node newChild() throws UnsupportedOperationException
UnsupportedOperationException
- If this node can not add new children.<V> V getValue(TableColumn<V> column)
null
if none.V
- The base type of values in the given column.column
- Identifier of the column from which to get the value.null
if none.TreeTable.getColumns()
<V> void setValue(TableColumn<V> column, V value) throws IllegalArgumentException, UnsupportedOperationException
isEditable(TableColumn)
method can be invoked before this setter method
for determining if the given column is modifiable.V
- The base type of values in the given column.column
- Identifier of the column into which to set the value.value
- The value to set.IllegalArgumentException
- If the given column is not a legal column for this node.UnsupportedOperationException
- If values in the given column can not be modified.TreeTable.getColumns()
,
isEditable(TableColumn)
boolean isEditable(TableColumn<?> column)
Node
instance, then this method
returns false
.column
- The column to query.true
if the given column is a legal column for this Node
implementation and the corresponding value is editable, or false
otherwise.Object getUserObject()
CityLocation
class is defined as a (city name, latitude,
longitude) tuple, then a TreeTable.Node
could be defined to have 3 columns for the
above 3 tuple components, and the user object could be the original CityLocation
instance.null
if none.Copyright © 2010–2014 The Apache Software Foundation. All rights reserved.