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.ScopeElementNodeIDProvider
Fields 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 TypeMethodDescriptionvoid
add
(MutableTreeNode newChild) void
addGroupNode
(ElementNode node) int
boolean
Finds node which represents provided element between this node's direct childrengetGroupNodeChildAt
(int index) Get all children as single listint
getGroupNodeIndex
(ElementNode node) int
int
hashCode()
boolean
boolean
Nodes which represent recursive branches are marked as infinite nodes, meaning the rest of the infinite branch is cut off bellow this nodeboolean
isReal()
Tells if this node belongs to the model represented by the treevoid
remove
(int childIndex) void
removeGroupNode
(ElementNode node) final void
setExpanded
(boolean expanded) void
setOriginal
(ElementNode original) final void
setReal
(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, setUserObject
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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
-false
if 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:
getElement
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
- Returns:
- model element represented by this node
-
getParent
- Specified by:
getParent
in interfaceTreeNode
- Overrides:
getParent
in classDefaultMutableTreeNode
-
getChildren
- Returns:
- direct children of this node
-
getChild
Finds node which represents provided element between this node's direct children- Specified by:
getChild
in 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:
isReal
in 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:
isInfinityNode
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
- Returns:
- true if the branch is infinitely recursive and is cut below this node.
-
getBreadthFirstEnumeration
- Specified by:
getBreadthFirstEnumeration
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getDepthFirstEnumeration
- Specified by:
getDepthFirstEnumeration
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
add
- Overrides:
add
in classDefaultMutableTreeNode
-
addGroupNode
- Specified by:
addGroupNode
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getGroupNodeIndex
- Specified by:
getGroupNodeIndex
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getIndex
- Specified by:
getIndex
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
removeGroupNode
- Specified by:
removeGroupNode
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
remove
public void remove(int childIndex) - Specified by:
remove
in interfaceMutableTreeNode
- Overrides:
remove
in classDefaultMutableTreeNode
-
getGroupNodeParent
- Specified by:
getGroupNodeParent
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getGroupNodeChildren
Get all children as single list- Specified by:
getGroupNodeChildren
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
- Returns:
- children (recursive)
-
getGroupNodeChildAt
- Specified by:
getGroupNodeChildAt
in 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:
setReal
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
- Parameters:
real
-true
if this node belongs to the model
-
setExpanded
public final void setExpanded(boolean expanded) -
getNodeID
-
getGroupNodePath
- Specified by:
getGroupNodePath
in interfacecom.nomagic.magicdraw.grouping.GroupNode<ElementNode>
-
getOriginal
-
setOriginal
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable
-
toString
- Overrides:
toString
in classDefaultMutableTreeNode
-