public interface TreeNode
ProgramModel.getRootTreeNode(ProgramNodeContribution)
to obtain a root for the sub-tree, it is possible to add children.
For each call to addChild(ProgramNode)
, a new TreeNode
is returned, that can, in turn, act as a root for yet another sub-tree.Modifier and Type | Method and Description |
---|---|
TreeNode |
addChild(ProgramNode programNode)
Add a child to this TreeNode
|
List<TreeNode> |
getChildren() |
ProgramNode |
getProgramNode() |
TreeNode |
insertChildAfter(TreeNode existingChildNode,
ProgramNode programNode)
Inserts a child under this TreeNode directly after the existing selected child node.
|
TreeNode |
insertChildBefore(TreeNode existingChildNode,
ProgramNode programNode)
Inserts a child under this TreeNode directly before the existing selected child node.
|
boolean |
removeChild(TreeNode child)
Removes a child from the sub-tree.
|
TreeNode |
setChildSequenceLocked(boolean isChildSequenceLocked)
Means that the children can not be rearranged, deleted or have other nodes inserted into the child sequence by the end user.
|
void |
traverse(ProgramNodeVisitor nodeVisitor)
This method traverses the entire sub-tree under this tree node in a depth-first fashion (this corresponds to a
top-down approach in the program tree).
|
TreeNode addChild(ProgramNode programNode) throws TreeStructureException
programNode
- the ProgramNode
constructed using the ProgramNodeFactory
TreeStructureException
- If it is not allowed to insert the ProgramNode
at this position a TreeStructureException
will be thrown.TreeNode insertChildBefore(TreeNode existingChildNode, ProgramNode programNode) throws TreeStructureException
existingChildNode
- existing TreeNode child of this TreeNodeprogramNode
- the ProgramNode
constructed using the ProgramNodeFactory
TreeStructureException
- If it is not allowed to insert the ProgramNode
at this position or if the selected child node is not a child of this TreeNode a TreeStructureException
will be thrown.TreeNode insertChildAfter(TreeNode existingChildNode, ProgramNode programNode) throws TreeStructureException
existingChildNode
- existing TreeNode child of this TreeNodeprogramNode
- the ProgramNode
constructed using the ProgramNodeFactory
TreeStructureException
- If it is not allowed to insert the ProgramNode
at this position or if the selected child node is not a child of this TreeNode a TreeStructureException
will be thrown.boolean removeChild(TreeNode child) throws TreeStructureException
child
- The TreeNode child to be removed.TreeStructureException
- If the removed child would leave the tree in an illegal state a TreeStructureException
will be thrown.List<TreeNode> getChildren()
ProgramNode getProgramNode()
ProgramNode
at this position in the sub-tree.
Can either be a built-in PolyScope program node (provided by Universal Robots) or a URCap program node.TreeNode setChildSequenceLocked(boolean isChildSequenceLocked)
isChildSequenceLocked
- If true then the immediate children under this TreeNode will be lockedvoid traverse(ProgramNodeVisitor nodeVisitor)
ProgramNodeVisitor
implementation with optional overrides or
a URCapProgramNodeInterfaceVisitor
implementation. In the latter
case, the URCapProgramNodeInterfaceVisitor.visitURCapAs(Object, int, int)
method must be implemented.
The URCapProgramNodeInterfaceVisitor
can be used when targeting URCap program nodes implementing the (generic) type parameter
specified in URCapProgramNodeInterfaceVisitor
(see also URCapProgramNode.getAs(Class)
).
Note that this method is sometimes called accept()
in the Visitor software design pattern.nodeVisitor
- the instance callbacks are made to.Copyright © 2018. All rights reserved.