Package org.apache.sis.metadata
Class TreeNode.NewChild
java.lang.Object
org.apache.sis.metadata.TreeNode.NewChild
- All Implemented Interfaces:
TreeTable.Node
- Enclosing class:
- TreeNode
The proxy to be returned by
TreeNode.newChild()
.
User shall not keep a reference to this proxy for a long time.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TreeNode
The real node created after the identifier and the value have been specified.private int
Index in thePropertyAccessor
for the property to be set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate TreeNode
delegate()
Returns thedelegate
node if non-null, or throw an exception otherwise.Returns the children of this node.For all operations other thansetValue(…)
, delegates to thedelegate
node or to some code functionally equivalent.private TreeNodeChildren
Returns all children of the parent node.Returns the user object associated to this node.<V> V
getValue
(TableColumn<V> column) Returns the value in the given column, ornull
if none.boolean
isEditable
(TableColumn<?> column) Determines whether the value in the specified column is editable.boolean
isLeaf()
Returnstrue
if this node cannot have any children.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) If thedelegate
is not yet known, set the identifier or the value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.sis.util.collection.TreeTable.Node
equals, hashCode
-
Field Details
-
indexInData
private int indexInDataIndex in thePropertyAccessor
for the property to be set. This index is known only after a value has been specified for theTableColumn.IDENTIFIER
. -
delegate
The real node created after the identifier and the value have been specified. All operations will be delegated to that node after it has been determined.
-
-
Constructor Details
-
NewChild
private NewChild()
-
-
Method Details
-
delegate
Returns thedelegate
node if non-null, or throw an exception otherwise.- Throws:
IllegalStateException
- if the identifier and value columns have not yet been defined.
-
getSiblings
Returns all children of the parent node. The new child will be added to that list. -
setValue
If thedelegate
is not yet known, set the identifier or the value. After the identifier and value have been specified, delegates to the real node.- Specified by:
setValue
in interfaceTreeTable.Node
- Type Parameters:
V
- the base type of values in the given column.- Parameters:
column
- identifier of the column into which to set the value.value
- the value to set.- See Also:
-
getParent
For all operations other thansetValue(…)
, delegates to thedelegate
node or to some code functionally equivalent.- Specified by:
getParent
in interfaceTreeTable.Node
- Returns:
- the parent, or
null
if none. - Throws:
IllegalStateException
- if the identifier and value columns have not yet been defined.
-
isLeaf
public boolean isLeaf()Description copied from interface:TreeTable.Node
Returnstrue
if this node cannot 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.- Specified by:
isLeaf
in interfaceTreeTable.Node
- Returns:
true
if this node cannot have any children.
-
getChildren
Description copied from interface:TreeTable.Node
Returns the children of this node. The returned collection may or may not be modifiable, at implementation choice. If the collection is modifiable, then it shall be live, i.e. any modification to the returned collection are reflected immediately in the tree. This allows addition or removal of child nodes as below: The collection is often aList
, but not necessarily. For some implementations like the metadata tree table view, compliance to theList
contract is impractical or inefficient.- Specified by:
getChildren
in interfaceTreeTable.Node
- Returns:
- the children, or an empty collection if none.
-
newChild
Description copied from interface:TreeTable.Node
Creates a new child with the same columns than the other children, and adds it to the children collection. The new child is typically added at the end of the collection, but this is not mandatory: implementations can add the child at whatever position they see fit.- Specified by:
newChild
in interfaceTreeTable.Node
- Returns:
- the new child.
-
getValue
Description copied from interface:TreeTable.Node
Returns the value in the given column, ornull
if none.- Specified by:
getValue
in interfaceTreeTable.Node
- Type Parameters:
V
- the base type of values in the given column.- Parameters:
column
- identifier of the column from which to get the value.- Returns:
- the value in the given column, or
null
if none. - See Also:
-
isEditable
Description copied from interface:TreeTable.Node
Determines whether the value in the specified column is editable. If the given column is not a legal column for thisNode
instance, then this method returnsfalse
.- Specified by:
isEditable
in interfaceTreeTable.Node
- Parameters:
column
- the column to query.- Returns:
true
if the given column is a legal column for thisNode
implementation and the corresponding value is editable, orfalse
otherwise.
-
getUserObject
Description copied from interface:TreeTable.Node
Returns the user object associated to this node. The user object is for information purpose only and does not appear in the rendered tree. It is typically a Java object whose content is splitted into the various table columns.Example: If aCityLocation
class is defined as a (city name, latitude, longitude) tuple, then aTreeTable.Node
could be defined to have 3 columns for the above 3 tuple components, and the user object could be the originalCityLocation
instance.- Specified by:
getUserObject
in interfaceTreeTable.Node
- Returns:
- any object stored at this node by the user, or
null
if none.
-