Class SimpleTreeNode<V>

java.lang.Object
org.jhotdraw8.fxbase.tree.SimpleTreeNode<V>
All Implemented Interfaces:
TreeNode<SimpleTreeNode<V>>

public class SimpleTreeNode<V> extends Object implements TreeNode<SimpleTreeNode<V>>
  • Constructor Details

    • SimpleTreeNode

      public SimpleTreeNode()
    • SimpleTreeNode

      public SimpleTreeNode(V value)
  • Method Details

    • addChild

      public void addChild(SimpleTreeNode<V> child)
    • removeChild

      public void removeChild(SimpleTreeNode<V> child)
    • getChildren

      public List<SimpleTreeNode<V>> getChildren()
      Description copied from interface: TreeNode
      Returns the children of the tree node.

      In order to keep the tree structure consistent, implementations of this interface must implement the following behavior:

      • A child can only be added if the child is a suitable child for this node, and this node is a suitable parent for the child. See TreeNode.isSuitableChild(TreeNode), TreeNode.isSuitableParent(TreeNode).
      • If a child is added to this list, then this tree node removes it from its former parent, and this tree node then sets itself as the parent of the* child.
      • If a child is removed from this tree node, then this tree node sets the parent of the child to null.
      Specified by:
      getChildren in interface TreeNode<V>
      Returns:
      the children
    • getParent

      public @Nullable SimpleTreeNode<V> getParent()
      Description copied from interface: TreeNode
      Returns the parent of the tree node.

      Note that - by convention - the parent property is changed only by a parent tree node.

      Specified by:
      getParent in interface TreeNode<V>
      Returns:
      the parent. Returns null if the tree node has no parent.
    • setParent

      public void setParent(@Nullable SimpleTreeNode<V> newValue)
      Description copied from interface: TreeNode
      Sets the parent of the tree.

      Note that - by convention - the parent property is changed only by a parent tree node.

      Specified by:
      setParent in interface TreeNode<V>
      Parameters:
      newValue - the new parent
    • getValue

      public V getValue()
    • setValue

      public void setValue(V value)