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 Details

    • elementNodeIDProvider

      @CheckForNull protected com.nomagic.magicdraw.dependencymatrix.datamodel.grouping.ScopeElementNodeIDProvider elementNodeIDProvider
  • Constructor Details

    • ElementNode

      public ElementNode(@CheckForNull Element element)
      Creates new node, which has element inside.
      Parameters:
      element - tree node information
    • ElementNode

      public ElementNode(@CheckForNull Element element, boolean real)
      Parameters:
      element - tree node information
      real - 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

      @CheckForNull @OpenApi public Element getElement()
      Specified by:
      getElement in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
      Returns:
      model element represented by this node
    • getParent

      @OpenApi public ElementNode getParent()
      Specified by:
      getParent in interface TreeNode
      Overrides:
      getParent in class DefaultMutableTreeNode
    • getChildren

      @OpenApi public List<ElementNode> getChildren()
      Returns:
      direct children of this node
    • getChild

      @CheckForNull public ElementNode getChild(Element element)
      Finds node which represents provided element between this node's direct children
      Specified by:
      getChild in interface com.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 interface com.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 interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
      Returns:
      true if the branch is infinitely recursive and is cut below this node.
    • getBreadthFirstEnumeration

      public Enumeration<ElementNode> getBreadthFirstEnumeration()
      Specified by:
      getBreadthFirstEnumeration in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • getDepthFirstEnumeration

      public Enumeration<ElementNode> getDepthFirstEnumeration()
      Specified by:
      getDepthFirstEnumeration in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • add

      public void add(MutableTreeNode newChild)
      Overrides:
      add in class DefaultMutableTreeNode
    • addGroupNode

      public void addGroupNode(ElementNode node)
      Specified by:
      addGroupNode in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • getGroupNodeIndex

      public int getGroupNodeIndex(ElementNode node)
      Specified by:
      getGroupNodeIndex in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • getIndex

      public int getIndex(@CheckForNull Element element)
      Specified by:
      getIndex in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • removeGroupNode

      public void removeGroupNode(ElementNode node)
      Specified by:
      removeGroupNode in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • remove

      public void remove(int childIndex)
      Specified by:
      remove in interface MutableTreeNode
      Overrides:
      remove in class DefaultMutableTreeNode
    • getGroupNodeParent

      public ElementNode getGroupNodeParent()
      Specified by:
      getGroupNodeParent in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • getGroupNodeChildren

      public List<ElementNode> getGroupNodeChildren()
      Get all children as single list
      Specified by:
      getGroupNodeChildren in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
      Returns:
      children (recursive)
    • getGroupNodeChildAt

      public ElementNode getGroupNodeChildAt(int index)
      Specified by:
      getGroupNodeChildAt in interface com.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 interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
      Parameters:
      real - true if this node belongs to the model
    • setExpanded

      public final void setExpanded(boolean expanded)
    • getNodeID

      public String getNodeID()
    • getGroupNodePath

      public ElementNode[] getGroupNodePath()
      Specified by:
      getGroupNodePath in interface com.nomagic.magicdraw.grouping.GroupNode<ElementNode>
    • getOriginal

      public ElementNode getOriginal()
    • setOriginal

      public void setOriginal(@CheckForNull ElementNode original)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(@Nonnull Object o)
      Specified by:
      compareTo in interface Comparable
    • toString

      public String toString()
      Overrides:
      toString in class DefaultMutableTreeNode