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 TreeNodeThe real node created after the identifier and the value have been specified.private intIndex in thePropertyAccessorfor the property to be set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate TreeNodedelegate()Returns thedelegatenode if non-null, or throw an exception otherwise.Returns the children of this node.For all operations other thansetValue(…), delegates to thedelegatenode or to some code functionally equivalent.private TreeNodeChildrenReturns all children of the parent node.Returns the user object associated to this node.<V> VgetValue(TableColumn<V> column) Returns the value in the given column, ornullif none.booleanisEditable(TableColumn<?> column) Determines whether the value in the specified column is editable.booleanisLeaf()Returnstrueif 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> voidsetValue(TableColumn<V> column, V value) If thedelegateis 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, waitMethods inherited from interface org.apache.sis.util.collection.TreeTable.Node
equals, hashCode
-
Field Details
-
indexInData
private int indexInDataIndex in thePropertyAccessorfor 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 thedelegatenode 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 thedelegateis not yet known, set the identifier or the value. After the identifier and value have been specified, delegates to the real node.- Specified by:
setValuein 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 thedelegatenode or to some code functionally equivalent.- Specified by:
getParentin interfaceTreeTable.Node- Returns:
- the parent, or
nullif none. - Throws:
IllegalStateException- if the identifier and value columns have not yet been defined.
-
isLeaf
public boolean isLeaf()Description copied from interface:TreeTable.NodeReturnstrueif 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).
TreeTableFormatdoes not use this value.- Specified by:
isLeafin interfaceTreeTable.Node- Returns:
trueif this node cannot have any children.
-
getChildren
Description copied from interface:TreeTable.NodeReturns 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 theListcontract is impractical or inefficient.- Specified by:
getChildrenin interfaceTreeTable.Node- Returns:
- the children, or an empty collection if none.
-
newChild
Description copied from interface:TreeTable.NodeCreates 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:
newChildin interfaceTreeTable.Node- Returns:
- the new child.
-
getValue
Description copied from interface:TreeTable.NodeReturns the value in the given column, ornullif none.- Specified by:
getValuein 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
nullif none. - See Also:
-
isEditable
Description copied from interface:TreeTable.NodeDetermines whether the value in the specified column is editable. If the given column is not a legal column for thisNodeinstance, then this method returnsfalse.- Specified by:
isEditablein interfaceTreeTable.Node- Parameters:
column- the column to query.- Returns:
trueif the given column is a legal column for thisNodeimplementation and the corresponding value is editable, orfalseotherwise.
-
getUserObject
Description copied from interface:TreeTable.NodeReturns 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 aCityLocationclass is defined as a (city name, latitude, longitude) tuple, then aTreeTable.Nodecould be defined to have 3 columns for the above 3 tuple components, and the user object could be the originalCityLocationinstance.- Specified by:
getUserObjectin interfaceTreeTable.Node- Returns:
- any object stored at this node by the user, or
nullif none.
-