Class ElementNode
java.lang.Object
javax.swing.tree.DefaultMutableTreeNode
com.nomagic.magicdraw.dependencymatrix.datamodel.ElementNode
- All Implemented Interfaces:
com.nomagic.magicdraw.grouping.GroupNode<ElementNode>,Serializable,Cloneable,Comparable,MutableTreeNode,TreeNode
@OpenApi
public class ElementNode
extends DefaultMutableTreeNode
implements com.nomagic.magicdraw.grouping.GroupNode<ElementNode>, Comparable
Tree node which represents instance of an
Element
Note: children of the node often does NOT represent the owned elements of the model Element, tree model can be constructed by different criteria- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.nomagic.magicdraw.dependencymatrix.datamodel.grouping.ScopeElementNodeIDProviderFields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject -
Constructor Summary
ConstructorsConstructorDescriptionElementNode(Element element) Creates new node, which has element inside.ElementNode(Element element, boolean real) ElementNode(Element element, boolean real, com.nomagic.magicdraw.dependencymatrix.datamodel.grouping.ScopeElementNodeIDProvider nodeIDProvider) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(MutableTreeNode newChild) voidaddGroupNode(ElementNode node) intbooleanFinds node which represents provided element between this node's direct childrengetGroupNodeChildAt(int index) Get all children as single listintgetGroupNodeIndex(ElementNode node) intinthashCode()booleanbooleanNodes which represent recursive branches are marked as infinite nodes, meaning the rest of the infinite branch is cut off bellow this nodebooleanisReal()Tells if this node belongs to the model represented by the treevoidremove(int childIndex) voidremoveGroupNode(ElementNode node) final voidsetExpanded(boolean expanded) voidsetOriginal(ElementNode original) final voidsetReal(boolean real) Does this node belong to the model or it is only as grouping element (parent node)toString()Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObjectMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.nomagic.magicdraw.grouping.GroupNode
getChildCount, removeAllChildren
-
Field Details
-
elementNodeIDProvider
@CheckForNull protected com.nomagic.magicdraw.dependencymatrix.datamodel.grouping.ScopeElementNodeIDProvider elementNodeIDProvider
-
-
Constructor Details
-
ElementNode
Creates new node, which has element inside.- Parameters:
element- tree node information
-
ElementNode
- Parameters:
element- tree node informationreal-falseif this node does not belong to the model (is parent only) Default value:true
-
ElementNode
public ElementNode(@CheckForNull Element element, boolean real, @CheckForNull com.nomagic.magicdraw.dependencymatrix.datamodel.grouping.ScopeElementNodeIDProvider nodeIDProvider)
-
-
Method Details
-
getElement
- Specified by:
getElementin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>- Returns:
- model element represented by this node
-
getParent
- Specified by:
getParentin interfaceTreeNode- Overrides:
getParentin classDefaultMutableTreeNode
-
getChildren
- Returns:
- direct children of this node
-
getChild
Finds node which represents provided element between this node's direct children- Specified by:
getChildin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>- Parameters:
element- element for which to search node- Returns:
- node which represents this element or null
-
isReal
@OpenApi public boolean isReal()Tells if this node belongs to the model represented by the tree- Specified by:
isRealin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>- Returns:
- true if this node truly belongs to the model represented by the tree
false if this node is only a grouping node for viewing and collapsing purposes
-
isExpanded
@OpenApi public boolean isExpanded()- Returns:
- true if node is currently expanded, meaning child nodes are visible
-
isInfinityNode
@OpenApi public boolean isInfinityNode()Nodes which represent recursive branches are marked as infinite nodes, meaning the rest of the infinite branch is cut off bellow this node- Specified by:
isInfinityNodein interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>- Returns:
- true if the branch is infinitely recursive and is cut below this node.
-
getBreadthFirstEnumeration
- Specified by:
getBreadthFirstEnumerationin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getDepthFirstEnumeration
- Specified by:
getDepthFirstEnumerationin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
add
- Overrides:
addin classDefaultMutableTreeNode
-
addGroupNode
- Specified by:
addGroupNodein interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getGroupNodeIndex
- Specified by:
getGroupNodeIndexin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getIndex
- Specified by:
getIndexin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
removeGroupNode
- Specified by:
removeGroupNodein interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
remove
public void remove(int childIndex) - Specified by:
removein interfaceMutableTreeNode- Overrides:
removein classDefaultMutableTreeNode
-
getGroupNodeParent
- Specified by:
getGroupNodeParentin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getGroupNodeChildren
Get all children as single list- Specified by:
getGroupNodeChildrenin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>- Returns:
- children (recursive)
-
getGroupNodeChildAt
- Specified by:
getGroupNodeChildAtin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
setReal
public final void setReal(boolean real) Does this node belong to the model or it is only as grouping element (parent node)- Specified by:
setRealin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>- Parameters:
real-trueif this node belongs to the model
-
setExpanded
public final void setExpanded(boolean expanded) -
getNodeID
-
getGroupNodePath
- Specified by:
getGroupNodePathin interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getOriginal
-
setOriginal
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable
-
toString
- Overrides:
toStringin classDefaultMutableTreeNode
-