Class TreeNode.NewChild

java.lang.Object
org.apache.sis.metadata.TreeNode.NewChild
All Implemented Interfaces:
TreeTable.Node
Enclosing class:
TreeNode

private final class TreeNode.NewChild extends Object implements TreeTable.Node
The proxy to be returned by TreeNode.newChild(). User shall not keep a reference to this proxy for a long time.
  • Field Details

    • indexInData

      private int indexInData
      Index in the PropertyAccessor for the property to be set. This index is known only after a value has been specified for the TableColumn.IDENTIFIER.
    • delegate

      private TreeNode 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

      private TreeNode delegate() throws IllegalStateException
      Returns the delegate node if non-null, or throw an exception otherwise.
      Throws:
      IllegalStateException - if the identifier and value columns have not yet been defined.
    • getSiblings

      private TreeNodeChildren getSiblings()
      Returns all children of the parent node. The new child will be added to that list.
    • setValue

      public <V> void setValue(TableColumn<V> column, V value)
      If the delegate 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 interface TreeTable.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

      public TreeTable.Node getParent()
      For all operations other than setValue(…), delegates to the delegate node or to some code functionally equivalent.
      Specified by:
      getParent in interface TreeTable.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
      Returns true 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 interface TreeTable.Node
      Returns:
      true if this node cannot have any children.
    • getChildren

      public Collection<TreeTable.Node> 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 a List, but not necessarily. For some implementations like the metadata tree table view, compliance to the List contract is impractical or inefficient.
      Specified by:
      getChildren in interface TreeTable.Node
      Returns:
      the children, or an empty collection if none.
    • newChild

      public TreeTable.Node 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 interface TreeTable.Node
      Returns:
      the new child.
    • getValue

      public <V> V getValue(TableColumn<V> column)
      Description copied from interface: TreeTable.Node
      Returns the value in the given column, or null if none.
      Specified by:
      getValue in interface TreeTable.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

      public boolean isEditable(TableColumn<?> column)
      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 this Node instance, then this method returns false.
      Specified by:
      isEditable in interface TreeTable.Node
      Parameters:
      column - the column to query.
      Returns:
      true if the given column is a legal column for this Node implementation and the corresponding value is editable, or false otherwise.
    • getUserObject

      public Object 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 a 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.
      Specified by:
      getUserObject in interface TreeTable.Node
      Returns:
      any object stored at this node by the user, or null if none.