Class Node

  • All Implemented Interfaces:
    com.nomagic.magicdraw.ui.browser.Expandable, java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

    @OpenApi
    public class Node
    extends javax.swing.tree.DefaultMutableTreeNode
    implements java.beans.PropertyChangeListener, com.nomagic.magicdraw.ui.browser.Expandable
    The base node of all tree nodes. This node has some user object.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  com.nomagic.magicdraw.ui.browser.Node.CancelStatusTask  
      private static class  com.nomagic.magicdraw.ui.browser.Node.CancelStatusTimer  
      private static class  com.nomagic.magicdraw.ui.browser.Node.DeferredBlockingCompletionHandler  
      static class  com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.concurrent.atomic.AtomicLong addCounter  
      private static java.lang.Object children
      Hide field DefaultMutableTreeNode.children from extending classes.
      private com.nomagic.magicdraw.ui.browser.ChildrenOwner childrenOwner
      Node specific children owner.
      private static java.lang.ThreadLocal<java.util.concurrent.atomic.AtomicInteger> compactCounterHolder  
      private static java.lang.ThreadLocal<java.util.Set<java.lang.Object>> compactHistoryHolder  
      private javax.swing.Icon defaultIcon
      default icon.
      private static com.nomagic.magicdraw.ui.browser.EmptyChildrenOwner EMPTY_CHILDREN_OWNER  
      private java.util.concurrent.atomic.AtomicInteger flags  
      private boolean forceUpdate  
      private static java.lang.String HIDDEN_CHILDREN_SEPARATOR
      Path separator for compactable node
      private java.util.List<Node> hiddenOwners
      Hidden owners if node is compactable.
      private Node hiddenParent
      Parent of hidden node
      private javax.swing.Icon icon
      The icon of this node.
      protected boolean ignoreRootCheck  
      private static boolean locked
      Is locked flag is set to true, node does not do update
      private static java.util.concurrent.atomic.AtomicLong lockingCounter  
      private static org.apache.log4j.Logger LOG_SCALABILITY  
      private static int M_AUTO_EXPANDABLE
      Auto expandable flag - node will be expanded if it has only one child when expanding parent node.
      private static int M_CAN_DELETE
      Flag indicates that node's object can be deleted.
      private static int M_CHILDREN_EXPANDED  
      private static int M_CHILDREN_SORT_NEEDED
      Flag indicated that children sort needed on node expand.
      private static int M_CHILDREN_SORTABLE  
      private static int M_COMPACTABLE
      Compactable node can be suppressed if it has just one compactable child
      private static int M_DIRTY
      If mDirty true, node must be updated before expanding it.
      private static int M_EDITABLE
      Flag indicates that node's object can be edit.
      private static int M_ENABLE_UPDATE_ICON  
      private static int M_EXPANDED
      Is this node expanded.
      private static int M_FORCE_STRUCTURE_UPDATE
      Flag indicates that node structure has to be updated on node expand, because last node structure update did not fully update node's children.
      private static int M_HIDDEN
      Is node hidden?
      private static int M_LOADING
      Flag indicates that node is being loaded.
      private static int M_NODE_UPDATED
      Shows that node is updated.
      private static int M_REMOVE_CHILDREN_ON_COLLAPSE
      Flag indicates that children must be removed on collapse.
      private static int M_REMOVED  
      private static int M_STRUCTURE_CHANGED  
      private static int MAX_NODE_EVENTS  
      private static int MAX_NODES_TO_EXPAND_ON_SINGLE_EVENT  
      private int priorityInOwner  
      private boolean removeAndKeepUserObject  
      private com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys sortKeys
      The sort keys.
      private java.lang.String text
      The text of the node
      private java.lang.ref.WeakReference<?> treeModel
      The model of the node.
      • Fields inherited from class javax.swing.tree.DefaultMutableTreeNode

        allowsChildren, EMPTY_ENUMERATION, parent, userObject
    • Constructor Summary

      Constructors 
      Constructor Description
      Node​(BaseElement element, javax.swing.Icon icon)
      Constructor
      Node​(BaseElement element, javax.swing.Icon icon, javax.swing.Icon defaultIcon)
      Constructs a new Node instance with element as the user object and icon as the icon for this node.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptCopy​(java.lang.Object obj)
      Accepts drag and drop link action
      protected void acceptCopySpecific​(java.util.List<?> elements)  
      void acceptLink​(java.lang.Object obj)
      Accepts drag and drop link action
      protected void acceptLinkSpecific​(java.util.List<?> vec)  
      void acceptMove​(java.lang.Object obj, Tree tree, java.awt.Point location)
      Accepts drag and drop link action
      protected void acceptMoveSpecific​(java.util.List<?> vec, Tree tree, java.awt.Point location)  
      void add​(javax.swing.tree.MutableTreeNode newChild)  
      protected void addListeners()  
      protected void addListeners​(BaseElement data)
      Adds needed listeners to the node element.
      private void addLoadingNode()  
      boolean canAcceptCopy​(java.lang.Object obj)  
      protected boolean canAcceptCopySpecific​(BaseElement obj)  
      boolean canAcceptLink​(java.lang.Object obj)  
      protected boolean canAcceptLinkSpecific​(BaseElement obj)  
      boolean canAcceptMove​(java.lang.Object obj)  
      protected boolean canAcceptMoveSpecific​(BaseElement o)  
      private static boolean canBeCompacted​(java.lang.Object userObject)  
      boolean canDelete()
      Can delete if user object is BaseElement and can be deleted from its parent.
      java.util.Enumeration children()  
      void clearHiddenOwners()
      Clear all hidden owners.
      void collapse()
      Collapse this node.
      protected boolean compactNodes​(boolean parentStructureChanged)
      Compact all children.
      void configure​(ActionsManager manager)
      Method configure.
      void configureMultiple​(ActionsManager mngr, Node[] node)
      Method to configure actions for context menu of all the provided nodes (array always includes the current node instance too).
      protected java.lang.String constructHiddenOwnerText()
      Constructs hidden owners text.
      protected java.lang.String constructText()  
      private <A> com.nomagic.magicdraw.utils.concurrent.EventQueueCompletionHandler<java.lang.Boolean,​A> createDirtyNodesUpdateHandler​(Node node, boolean sortExplicitly, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler, A attachment, java.util.Collection<Node> processableNodes)  
      protected Node createNodeFor​(java.lang.Object obj)
      Creates node for given element.
      protected com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys createNodeSortKeys()  
      private com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​java.lang.Object> createPostUpdateChildrenHandler​(Node node, boolean sortExplicitly, java.lang.Runnable runAfter, boolean nodeChanged)  
      com.nomagic.magicdraw.commands.Command createRemoveCommand()  
      com.nomagic.magicdraw.commands.Command createSpecificRemoveCommand()
      Creates specific command for removing
      private <A> com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> createUpdateChildrenHandler​(Node node, boolean sortExplicitly, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler, java.util.Collection<java.util.concurrent.Future<?>> resultList, java.util.concurrent.atomic.AtomicLong counter)  
      void disposeNode()
      Disposes the node - unregisters listeners, removes from nodes map and etc.
      private Node doCreateNode​(java.lang.Object obj)  
      private static void doForceNodeUpdate​(Node node, boolean resetFlag, com.nomagic.magicdraw.ui.browser.TreeModel treeModel, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​java.lang.Object> updateHandler)  
      private void doRemoveNode​(int index)
      Removes node from parent by given index.
      private <A> java.util.concurrent.Future<?> doUpdateChildren​(Node node, boolean sortExplicitly, A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler, java.util.concurrent.atomic.AtomicLong counter)  
      protected <A> java.util.concurrent.Future<java.lang.Boolean> doUpdateNode​(boolean sortParent, A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)  
      protected java.lang.Boolean doUpdateNodeSync​(boolean sortParent)  
      private static void doWithBrowserNodeMap​(java.lang.Object userObject, java.util.function.BiConsumer<com.nomagic.magicdraw.ui.browser.BrowserNodeMap,​BaseElement> browserConsumer)  
      void enterClicked​(java.awt.AWTEvent event)
      Calls mouseDoubleClicked for user object.
      private com.nomagic.magicdraw.ui.browser.NodeChildrenKeeper exchangeNodeChildrenKeepers()  
      void expand()
      Expands the tree node.
      void expand​(boolean sortExplicitly)
      Expands the tree node.
      void expandAsync()
      Asynchronously expands the tree node.
      void expandAsync​(boolean sortExplicitly)
      Asynchronously expands the tree node.
      private static <A> void forceUpdateNodeStructure​(Node node, boolean resetFlag, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler)  
      void forceUpdateNodeSync​(boolean sortParent)
      Marks node as expanded which forces node to be fully updated, and initiates asynchronous node update.
      int[] getActions()  
      javax.swing.tree.TreeNode getChildAt​(int index)  
      int getChildCount()  
      java.util.List<Node> getChildren()
      Returns list of children.
      com.nomagic.magicdraw.ui.browser.ChildrenOwner getChildrenOwner()  
      javax.swing.Icon getDefaultIcon()
      Returns the default icon
      protected java.lang.String getEditingText()
      Returns text which will be edited.
      BaseElement getElementForCopyAction()  
      BaseElement[] getElementsForDnd()  
      private boolean getFlagValue​(int flag)
      Get flag value.
      protected Node getHiddenNodeFor​(BaseElement object)  
      java.util.List<Node> getHiddenOwners()  
      Node getHiddenParent()  
      javax.swing.Icon getIcon()
      Gets the icon for this node.
      int getIndex​(javax.swing.tree.TreeNode aChild)  
      Node[] getNodeForObject​(BaseElement object)
      Returns the tree node which data is the same as given Element.
      Node getParent()  
      int getPriorityInOwner()  
      java.util.Collection<BaseElement> getRootElements()
      Collects root elements of children
      com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys getSortKeys()
      Returns keys' array for sorting
      java.lang.String getText()
      This method returns the name of the ObjectData (user's object of this node).
      java.lang.String getTextForSorting()
      This method returns the name of the ObjectData (user's object of this node).
      com.nomagic.magicdraw.ui.browser.TreeModel getTreeModel()
      Returns the model of this node.
      protected java.lang.String getType()
      Returns node type
      java.lang.Object getUserObject()
      Returns user object of this node.
      void insert​(javax.swing.tree.MutableTreeNode newChild, int childIndex)  
      private void insertHiddenOwner​(Node child, int index)
      Add hidden owner at given index.
      private <A> java.util.concurrent.Future<?> internalUpdateChildren​(Node node, boolean sortExplicitly, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler, java.util.concurrent.atomic.AtomicLong counter)  
      boolean isAutoExpandable()  
      boolean isCanDelete()  
      boolean isChildrenSortable()  
      boolean isChildrenSortNeeded()  
      boolean isCompactable()  
      boolean isDirty()  
      boolean isEditable()  
      boolean isEnableUpdateIcon()  
      protected boolean isEventForUpdate​(java.beans.PropertyChangeEvent evt)  
      boolean isExpanded()  
      boolean isForceStructureUpdateOnExpand()  
      boolean isHidden()  
      boolean isInExpandedPath()
      Checks if this node is in expanded path.
      boolean isLoading()  
      static boolean isLocked()
      Returns locked flag
      protected boolean isNodeLocked​(com.nomagic.magicdraw.ui.browser.TreeModel treeModel)  
      boolean isNodeStructureChanged()  
      boolean isNodeUpdated()  
      protected boolean isProjectReady​(com.nomagic.magicdraw.ui.browser.TreeModel treeModel)  
      boolean isRemoveChildrenOnCollapse()  
      boolean isSpecificElement()  
      private static void maybeCleanCompactedHistory()  
      void mouseDoubleClicked​(java.awt.AWTEvent event)
      Calls onFind for user object.
      protected void nodeAdded()  
      protected java.util.Map<java.lang.Object,​Node> prepareUserObjectNodeMap()
      Return map of user objects mapped to nodes.
      private boolean privateCompactNodes​(boolean parentStructureChanged)  
      private static <A> java.util.concurrent.Future<java.lang.Boolean> processFailedNodeUpdate​(A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler, java.lang.Exception e)  
      void propertyChange​(java.beans.PropertyChangeEvent event)
      This method is called when some ObjectData has changed.
      void remove()
      Removes node from parent.
      void remove​(int childIndex)  
      void remove​(javax.swing.tree.MutableTreeNode aChild)  
      void removeAllChildren()
      Removes all nodes from this node.
      protected boolean removeAllChildren​(java.util.Collection<?> userObjects)
      Removes nodes from this node if theirs data objects are not in given userObjects.
      protected boolean removeIllegalNodes()
      Removes nodes from this node these nodes cannot be created with node creator.
      protected void removeListeners()
      Removes propertyChangeListener(node) from Element property change support.
      protected void removeLoadingNode()  
      private void removeNode​(int index)
      Removes node from this node.
      void removeRecursively()
      Removes all nodes from this node recursively
      void removeRecursively​(int index)
      Removes all nodes from this node recursively
      void replaceChildren​(java.util.List<Node> newChildren)  
      protected Node replaceCompactableNode​(Node node)
      Replace given node with its compacted child if needed.
      private static void reportPotentialNodeChildrenModificationProblem()  
      static long resetLock​(boolean value, long lockingCounter)
      Sets locked flag and decrements locking counter if current locking counter is equal to the one passed as method parameter
      void setAutoExpandable​(boolean autoExpandable)
      Change auto-expandable flag - node will be expanded if it has only one child when expanding parent node.
      void setCanDelete​(boolean canDelete)
      Method marks node as deletable or not.
      void setChildrenOwner​(com.nomagic.magicdraw.ui.browser.ChildrenOwner owner)
      Set node specific children owner.
      void setChildrenSortable​(boolean childrenSortable)  
      void setChildrenSortNeeded​(boolean childrenSortNeeded)  
      void setCompactable​(boolean compactable)
      Make node compactable.
      void setDefaultIcon​(javax.swing.Icon icon)
      Sets the default icon.
      void setDirty​(boolean dirty)
      Sets dirty flag.
      void setDirtyRecursively​(boolean dirty)  
      void setEditable​(boolean editable)
      Method marks node as editable or not.
      void setEnableUpdateIcon​(boolean enableUpdateIcon)  
      protected void setExpanded​(boolean expanded)
      Sets expanded state of this node.
      private void setFlagValue​(int flag, boolean value)
      Set flag value.
      void setForceStructureUpdateOnExpand​(boolean value)  
      void setForceUpdate​(boolean forceUpdate)
      Set to true to force node update, no matter if text or icon was not changed
      void setHidden​(boolean hidden)
      Make node "hidden"
      void setHiddenParent​(Node hiddenParent)
      Set hidden parent.
      void setIcon​(javax.swing.Icon icon)
      Sets the icon for this node.
      void setLoading​(boolean flag)  
      static long setLocked​(boolean value)
      Sets locked flag and increases locking counter
      void setNodeStructureChanged​(boolean nodeStructureChanged)  
      void setNodeUpdated​(boolean value)  
      void setPriorityInOwner​(int priority)
      Set priority in owner for sorting
      void setRemoveChildrenOnCollapse​(boolean value)  
      void setSortKeys​(com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys sortKeys)  
      void setText​(java.lang.String text)
      Sets the name of the ObjectData(user's object).
      void setTreeModel​(com.nomagic.magicdraw.ui.browser.TreeModel model)
      Sets the model for this node.
      void setUserObject​(java.lang.Object o)
      We put WeakReference with given object as user object in order to make things easier for garbage collector.
      java.lang.String toString()  
      protected boolean unCompactNodes()
      Un-compact all compacted children.
      void updateChildren​(Node node, boolean sortExplicitly)
      Updates children of this node depending on dirty and expand state.
      java.util.concurrent.Future<?> updateChildrenAsync​(Node node, boolean sortExplicitly)
      Asynchronously updates children of this node depending on dirty and expand state.
      <A> java.util.concurrent.Future<?> updateChildrenAsync​(Node node, boolean sortExplicitly, A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)
      Asynchronously updates children of this node depending on dirty and expand state.
      boolean updateIcon()
      Sets icon according to the data.
      boolean updateNode()
      Updates node and loads children of the node if it is necessary.
      boolean updateNode​(boolean sortParent)
      Updates node and loads children of the node if it is necessary.
      java.util.concurrent.Future<java.lang.Boolean> updateNodeAsync()
      Asynchronously updates node and loads children of the node if it is necessary.
      java.util.concurrent.Future<java.lang.Boolean> updateNodeAsync​(boolean sortParent)
      Asynchronously updates node and loads children of the node if it is necessary.
      <A> void updateNodeAsync​(boolean sortParent, A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)
      Asynchronously updates node and loads children of the node if it is necessary.
      <A> void updateNodeAsync​(A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)
      Asynchronously updates node and loads children of the node if it is necessary.
      boolean updateNodeItself()
      Updates text and icon of the node.
      protected boolean updateNodeStructure()
      Loads all children for this node.
      protected boolean updateNodeStructure​(java.util.Collection<?> objects)
      This method reloads children from given user object collection.
      void updateNodeStructureOfChildInExpandedPath​(Node node)  
      java.lang.Boolean updateNodeSync​(boolean sortParent)
      Synchronously updates node and loads children of the node if it is necessary.
      protected void updateSortKeys​(java.lang.String text)  
      void waitForUpdateNodeCompletions()
      Wait for pending updateNodeAsync() completions
      private static void waitWhileChildrenUpdate​(com.nomagic.magicdraw.ui.browser.Node.CancelStatusTask cancelStatusTask)  
      • Methods inherited from class javax.swing.tree.DefaultMutableTreeNode

        breadthFirstEnumeration, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObjectPath, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, removeFromParent, setAllowsChildren, setParent
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • HIDDEN_CHILDREN_SEPARATOR

        private static final java.lang.String HIDDEN_CHILDREN_SEPARATOR
        Path separator for compactable node
        See Also:
        Constant Field Values
      • LOG_SCALABILITY

        private static final org.apache.log4j.Logger LOG_SCALABILITY
      • EMPTY_CHILDREN_OWNER

        private static final com.nomagic.magicdraw.ui.browser.EmptyChildrenOwner EMPTY_CHILDREN_OWNER
      • M_NODE_UPDATED

        private static final int M_NODE_UPDATED
        Shows that node is updated.
        See Also:
        Constant Field Values
      • M_DIRTY

        private static final int M_DIRTY
        If mDirty true, node must be updated before expanding it.
        See Also:
        Constant Field Values
      • M_CHILDREN_SORT_NEEDED

        private static final int M_CHILDREN_SORT_NEEDED
        Flag indicated that children sort needed on node expand.
        See Also:
        Constant Field Values
      • M_COMPACTABLE

        private static final int M_COMPACTABLE
        Compactable node can be suppressed if it has just one compactable child
        See Also:
        Constant Field Values
      • M_AUTO_EXPANDABLE

        private static final int M_AUTO_EXPANDABLE
        Auto expandable flag - node will be expanded if it has only one child when expanding parent node.
        See Also:
        Constant Field Values
      • M_EDITABLE

        private static final int M_EDITABLE
        Flag indicates that node's object can be edit. If this flag is false node can not be edited, if it is true additional check can be done (for multi user or something).
        See Also:
        Constant Field Values
      • M_CAN_DELETE

        private static final int M_CAN_DELETE
        Flag indicates that node's object can be deleted. If this flag is false node can not be deleted, if it is true additional check can be done (for multi user or something).
        See Also:
        Constant Field Values
      • M_LOADING

        private static final int M_LOADING
        Flag indicates that node is being loaded.
        See Also:
        Constant Field Values
      • M_FORCE_STRUCTURE_UPDATE

        private static final int M_FORCE_STRUCTURE_UPDATE
        Flag indicates that node structure has to be updated on node expand, because last node structure update did not fully update node's children.
        See Also:
        Constant Field Values
      • M_REMOVE_CHILDREN_ON_COLLAPSE

        private static final int M_REMOVE_CHILDREN_ON_COLLAPSE
        Flag indicates that children must be removed on collapse.
        See Also:
        Constant Field Values
      • children

        private static final java.lang.Object children
        Hide field DefaultMutableTreeNode.children from extending classes. Subclasses should use appropriate methods to access or modify children.
      • locked

        private static volatile boolean locked
        Is locked flag is set to true, node does not do update
      • lockingCounter

        private static final java.util.concurrent.atomic.AtomicLong lockingCounter
      • flags

        private final java.util.concurrent.atomic.AtomicInteger flags
      • addCounter

        private static final java.util.concurrent.atomic.AtomicLong addCounter
      • text

        private java.lang.String text
        The text of the node
      • sortKeys

        private com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys sortKeys
        The sort keys.
      • treeModel

        private java.lang.ref.WeakReference<?> treeModel
        The model of the node.
      • icon

        @CheckForNull
        private javax.swing.Icon icon
        The icon of this node.
      • defaultIcon

        @CheckForNull
        private javax.swing.Icon defaultIcon
        default icon.
      • hiddenOwners

        @CheckForNull
        private java.util.List<Node> hiddenOwners
        Hidden owners if node is compactable.
      • hiddenParent

        @CheckForNull
        private Node hiddenParent
        Parent of hidden node
      • childrenOwner

        private com.nomagic.magicdraw.ui.browser.ChildrenOwner childrenOwner
        Node specific children owner. If node does not have his owner, tree model children owner is used
      • priorityInOwner

        private int priorityInOwner
      • removeAndKeepUserObject

        private volatile boolean removeAndKeepUserObject
      • ignoreRootCheck

        protected volatile boolean ignoreRootCheck
      • forceUpdate

        private boolean forceUpdate
      • compactHistoryHolder

        private static final java.lang.ThreadLocal<java.util.Set<java.lang.Object>> compactHistoryHolder
      • compactCounterHolder

        private static final java.lang.ThreadLocal<java.util.concurrent.atomic.AtomicInteger> compactCounterHolder
      • MAX_NODES_TO_EXPAND_ON_SINGLE_EVENT

        private static final int MAX_NODES_TO_EXPAND_ON_SINGLE_EVENT
        See Also:
        Constant Field Values
    • Constructor Detail

      • Node

        public Node​(@CheckForNull
                    BaseElement element,
                    @CheckForNull
                    javax.swing.Icon icon)
        Constructor
        Parameters:
        element - instance of BaseElement
        icon - node icon
      • Node

        public Node​(@CheckForNull
                    BaseElement element,
                    @CheckForNull
                    javax.swing.Icon icon,
                    @CheckForNull
                    javax.swing.Icon defaultIcon)
        Constructs a new Node instance with element as the user object and icon as the icon for this node.
        Parameters:
        element - instance of BaseElement
        icon - node icon.
        defaultIcon - default node icon.
    • Method Detail

      • reportPotentialNodeChildrenModificationProblem

        private static void reportPotentialNodeChildrenModificationProblem()
      • isLocked

        public static boolean isLocked()
        Returns locked flag
        Returns:
        true if it is locked, else false.
      • setLocked

        public static long setLocked​(boolean value)
        Sets locked flag and increases locking counter
        Parameters:
        value - lock value
        Returns:
        locking counter
      • resetLock

        public static long resetLock​(boolean value,
                                     long lockingCounter)
        Sets locked flag and decrements locking counter if current locking counter is equal to the one passed as method parameter
        Parameters:
        value - lock value
        lockingCounter - locking counter
        Returns:
        locking counter
      • addListeners

        protected void addListeners​(BaseElement data)
        Adds needed listeners to the node element.
        Parameters:
        data - instance of BaseElement
      • addListeners

        protected void addListeners()
      • getChildren

        public java.util.List<Node> getChildren()
        Returns list of children.
        Returns:
        list of Node
      • getChildCount

        public int getChildCount()
        Specified by:
        getChildCount in interface javax.swing.tree.TreeNode
        Overrides:
        getChildCount in class javax.swing.tree.DefaultMutableTreeNode
      • getChildAt

        public javax.swing.tree.TreeNode getChildAt​(int index)
        Specified by:
        getChildAt in interface javax.swing.tree.TreeNode
        Overrides:
        getChildAt in class javax.swing.tree.DefaultMutableTreeNode
      • children

        public java.util.Enumeration children()
        Specified by:
        children in interface javax.swing.tree.TreeNode
        Overrides:
        children in class javax.swing.tree.DefaultMutableTreeNode
      • getIndex

        public int getIndex​(javax.swing.tree.TreeNode aChild)
        Specified by:
        getIndex in interface javax.swing.tree.TreeNode
        Overrides:
        getIndex in class javax.swing.tree.DefaultMutableTreeNode
      • insert

        public void insert​(javax.swing.tree.MutableTreeNode newChild,
                           int childIndex)
        Specified by:
        insert in interface javax.swing.tree.MutableTreeNode
        Overrides:
        insert in class javax.swing.tree.DefaultMutableTreeNode
      • remove

        public void remove​(int childIndex)
        Specified by:
        remove in interface javax.swing.tree.MutableTreeNode
        Overrides:
        remove in class javax.swing.tree.DefaultMutableTreeNode
      • remove

        public void remove​(javax.swing.tree.MutableTreeNode aChild)
        Specified by:
        remove in interface javax.swing.tree.MutableTreeNode
        Overrides:
        remove in class javax.swing.tree.DefaultMutableTreeNode
      • replaceChildren

        public void replaceChildren​(java.util.List<Node> newChildren)
      • exchangeNodeChildrenKeepers

        @CheckForNull
        private com.nomagic.magicdraw.ui.browser.NodeChildrenKeeper exchangeNodeChildrenKeepers()
      • getUserObject

        @CheckForNull
        @OpenApi
        public java.lang.Object getUserObject()
        Returns user object of this node.
        Overrides:
        getUserObject in class javax.swing.tree.DefaultMutableTreeNode
        Returns:
        user object(some Element).
      • setUserObject

        public void setUserObject​(@CheckForNull
                                  java.lang.Object o)
        We put WeakReference with given object as user object in order to make things easier for garbage collector.
        Specified by:
        setUserObject in interface javax.swing.tree.MutableTreeNode
        Overrides:
        setUserObject in class javax.swing.tree.DefaultMutableTreeNode
      • doWithBrowserNodeMap

        private static void doWithBrowserNodeMap​(@CheckForNull
                                                 java.lang.Object userObject,
                                                 java.util.function.BiConsumer<com.nomagic.magicdraw.ui.browser.BrowserNodeMap,​BaseElement> browserConsumer)
      • getDefaultIcon

        @CheckForNull
        public javax.swing.Icon getDefaultIcon()
        Returns the default icon
        Returns:
        the default icon.
      • setDefaultIcon

        public void setDefaultIcon​(@CheckForNull
                                   javax.swing.Icon icon)
        Sets the default icon.
        Parameters:
        icon - the default icon.
      • getIcon

        @CheckForNull
        public javax.swing.Icon getIcon()
        Gets the icon for this node.
        Returns:
        the icon of this node.
      • setIcon

        public void setIcon​(@CheckForNull
                            javax.swing.Icon icon)
        Sets the icon for this node. If object is not editable, sets gray icon.
        Parameters:
        icon - the new icon.
      • updateIcon

        public boolean updateIcon()
        Sets icon according to the data.
        Returns:
        true if icon was changed
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent event)
        This method is called when some ObjectData has changed.
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
        Parameters:
        event - the property changed event.
      • isEventForUpdate

        protected boolean isEventForUpdate​(java.beans.PropertyChangeEvent evt)
      • getText

        public final java.lang.String getText()
        This method returns the name of the ObjectData (user's object of this node).
        Returns:
        the name of the ObjectData
      • getTextForSorting

        public java.lang.String getTextForSorting()
        This method returns the name of the ObjectData (user's object of this node).
        Returns:
        the name of the ObjectData
      • setText

        public void setText​(@CheckForNull
                            java.lang.String text)
        Sets the name of the ObjectData(user's object). This method is called after the node's text editing.
        Parameters:
        text - the new node's text.
      • updateSortKeys

        protected void updateSortKeys​(java.lang.String text)
      • updateNodeStructure

        protected boolean updateNodeStructure()
        Loads all children for this node.
        Returns:
        true if structure was changed
      • getChildrenOwner

        public com.nomagic.magicdraw.ui.browser.ChildrenOwner getChildrenOwner()
        Returns:
        children owner of the node. If node does not have his children owner, children owner from tree model is used
      • setChildrenOwner

        public void setChildrenOwner​(com.nomagic.magicdraw.ui.browser.ChildrenOwner owner)
        Set node specific children owner.
        Parameters:
        owner - owner
      • getTreeModel

        @CheckForNull
        public final com.nomagic.magicdraw.ui.browser.TreeModel getTreeModel()
        Returns the model of this node.
        Returns:
        the model of this node.
      • setTreeModel

        public void setTreeModel​(com.nomagic.magicdraw.ui.browser.TreeModel model)
        Sets the model for this node.
        Parameters:
        model - the TreeModel.
      • updateNodeStructure

        protected boolean updateNodeStructure​(@CheckForNull
                                              java.util.Collection<?> objects)
        This method reloads children from given user object collection. If children already exists, sets only text for the node.
        Parameters:
        objects - the given children
        Returns:
        true if node structure was changed
      • updateNodeStructureOfChildInExpandedPath

        public void updateNodeStructureOfChildInExpandedPath​(Node node)
      • unCompactNodes

        protected boolean unCompactNodes()
        Un-compact all compacted children.
        Returns:
        true if at least one child was un-compacted
      • compactNodes

        protected boolean compactNodes​(boolean parentStructureChanged)
        Compact all children.
        Parameters:
        parentStructureChanged - was parent (current) node structure changed
        Returns:
        true if at least one child was compacted
      • privateCompactNodes

        private boolean privateCompactNodes​(boolean parentStructureChanged)
      • maybeCleanCompactedHistory

        private static void maybeCleanCompactedHistory()
      • canBeCompacted

        private static boolean canBeCompacted​(@CheckForNull
                                              java.lang.Object userObject)
      • replaceCompactableNode

        @CheckForNull
        protected Node replaceCompactableNode​(Node node)
        Replace given node with its compacted child if needed.
        Parameters:
        node - given node
        Returns:
        node replaced node or null if no replacement
      • updateNodeItself

        public boolean updateNodeItself()
        Updates text and icon of the node.
        Returns:
        true if text or icon was changed.
      • setForceUpdate

        public void setForceUpdate​(boolean forceUpdate)
        Set to true to force node update, no matter if text or icon was not changed
        Parameters:
        forceUpdate - flag to indicate update status
      • createNodeFor

        @CheckForNull
        protected Node createNodeFor​(java.lang.Object obj)
        Creates node for given element. Uses node creator from tree model.
        Parameters:
        obj - the given object.
        Returns:
        the created node or null
      • doCreateNode

        @CheckForNull
        private Node doCreateNode​(java.lang.Object obj)
      • getRootElements

        public java.util.Collection<BaseElement> getRootElements()
        Collects root elements of children
        Returns:
        collection of root elements of children
      • getNodeForObject

        @CheckForNull
        public Node[] getNodeForObject​(BaseElement object)
        Returns the tree node which data is the same as given Element. This method is used to determine if node with given Element as data object exists.
        Parameters:
        object - the given Element.
        Returns:
        the node which data object is the same as given object or null such node is not found.
      • getHiddenNodeFor

        @CheckForNull
        protected Node getHiddenNodeFor​(@CheckForNull
                                        BaseElement object)
      • prepareUserObjectNodeMap

        protected java.util.Map<java.lang.Object,​Node> prepareUserObjectNodeMap()
        Return map of user objects mapped to nodes.
        Returns:
        map of user objects mapped to nodes.
      • mouseDoubleClicked

        public void mouseDoubleClicked​(@CheckForNull
                                       java.awt.AWTEvent event)
        Calls onFind for user object. This method is called when user double clicks with mouse on the node.
        Parameters:
        event - click event
      • enterClicked

        public void enterClicked​(java.awt.AWTEvent event)
        Calls mouseDoubleClicked for user object. This method is called when user double clicks with mouse on the node.
        Parameters:
        event - click event
      • removeListeners

        protected void removeListeners()
        Removes propertyChangeListener(node) from Element property change support.
      • remove

        public void remove()
        Removes node from parent.
      • removeNode

        private void removeNode​(int index)
        Removes node from this node. Removes propertyChangeListener(node) from Element property change support and calls super remove.
      • disposeNode

        public void disposeNode()
        Disposes the node - unregisters listeners, removes from nodes map and etc.
      • doRemoveNode

        private void doRemoveNode​(int index)
        Removes node from parent by given index. If index is -1 remove is done by node but not index.
        Parameters:
        index - of Node which needs to be removed.
      • removeAllChildren

        protected boolean removeAllChildren​(java.util.Collection<?> userObjects)
        Removes nodes from this node if theirs data objects are not in given userObjects.
        Parameters:
        userObjects - the given userObjects of the DTObjects.
        Returns:
        true, if at least one node was removed
      • removeIllegalNodes

        protected boolean removeIllegalNodes()
        Removes nodes from this node these nodes cannot be created with node creator.
        Returns:
        true, if at least one node was removed
      • removeAllChildren

        public void removeAllChildren()
        Removes all nodes from this node.
        Overrides:
        removeAllChildren in class javax.swing.tree.DefaultMutableTreeNode
      • removeRecursively

        public void removeRecursively()
        Removes all nodes from this node recursively
      • removeRecursively

        public void removeRecursively​(int index)
        Removes all nodes from this node recursively
        Parameters:
        index - of node which should be deleted.
      • expand

        public void expand​(boolean sortExplicitly)
        Expands the tree node. If children of the node are not loaded, load them.
        Parameters:
        sortExplicitly - true, if node children must be sorted explicitly.
      • expand

        public void expand()
        Expands the tree node. If children of the node are not loaded, load them.
      • expandAsync

        public void expandAsync​(boolean sortExplicitly)
        Asynchronously expands the tree node. If children of the node are not loaded, load them.
        Parameters:
        sortExplicitly - true, if node children must be sorted explicitly.
      • expandAsync

        public void expandAsync()
        Asynchronously expands the tree node. If children of the node are not loaded, load them.
      • updateChildren

        public final void updateChildren​(Node node,
                                         boolean sortExplicitly)
        Updates children of this node depending on dirty and expand state.
        Parameters:
        node - the given node.
        sortExplicitly - if true sort children explicitly
      • waitWhileChildrenUpdate

        private static void waitWhileChildrenUpdate​(com.nomagic.magicdraw.ui.browser.Node.CancelStatusTask cancelStatusTask)
                                             throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • updateChildrenAsync

        public final java.util.concurrent.Future<?> updateChildrenAsync​(Node node,
                                                                        boolean sortExplicitly)
        Asynchronously updates children of this node depending on dirty and expand state.
        Parameters:
        node - the given node.
        sortExplicitly - if true sort children explicitly
        Returns:
        A Future object representing the pending operation
      • updateChildrenAsync

        public final <A> java.util.concurrent.Future<?> updateChildrenAsync​(Node node,
                                                                            boolean sortExplicitly,
                                                                            @CheckForNull
                                                                            A attachment,
                                                                            com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)
        Asynchronously updates children of this node depending on dirty and expand state.
        Type Parameters:
        A - The type of the object attached to the completion handler
        Parameters:
        node - the given node.
        sortExplicitly - if true sort children explicitly
        attachment - The object to attach to the update operation; can be null
        handler - The handler for consuming the operation result, which is true, if node itself was changed(not children).
      • forceUpdateNodeStructure

        private static <A> void forceUpdateNodeStructure​(Node node,
                                                         boolean resetFlag,
                                                         com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler)
      • doForceNodeUpdate

        private static void doForceNodeUpdate​(Node node,
                                              boolean resetFlag,
                                              com.nomagic.magicdraw.ui.browser.TreeModel treeModel,
                                              com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​java.lang.Object> updateHandler)
      • doUpdateChildren

        private <A> java.util.concurrent.Future<?> doUpdateChildren​(Node node,
                                                                    boolean sortExplicitly,
                                                                    @CheckForNull
                                                                    A attachment,
                                                                    @CheckForNull
                                                                    com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler,
                                                                    java.util.concurrent.atomic.AtomicLong counter)
      • internalUpdateChildren

        private <A> java.util.concurrent.Future<?> internalUpdateChildren​(Node node,
                                                                          boolean sortExplicitly,
                                                                          @CheckForNull
                                                                          com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler,
                                                                          java.util.concurrent.atomic.AtomicLong counter)
      • createUpdateChildrenHandler

        private <A> com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> createUpdateChildrenHandler​(Node node,
                                                                                                                                    boolean sortExplicitly,
                                                                                                                                    @CheckForNull
                                                                                                                                    com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler,
                                                                                                                                    java.util.Collection<java.util.concurrent.Future<?>> resultList,
                                                                                                                                    java.util.concurrent.atomic.AtomicLong counter)
      • createDirtyNodesUpdateHandler

        private <A> com.nomagic.magicdraw.utils.concurrent.EventQueueCompletionHandler<java.lang.Boolean,​A> createDirtyNodesUpdateHandler​(Node node,
                                                                                                                                                boolean sortExplicitly,
                                                                                                                                                @CheckForNull
                                                                                                                                                com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​A> handler,
                                                                                                                                                @CheckForNull
                                                                                                                                                A attachment,
                                                                                                                                                java.util.Collection<Node> processableNodes)
      • createPostUpdateChildrenHandler

        private com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​java.lang.Object> createPostUpdateChildrenHandler​(Node node,
                                                                                                                                                   boolean sortExplicitly,
                                                                                                                                                   java.lang.Runnable runAfter,
                                                                                                                                                   boolean nodeChanged)
      • collapse

        public void collapse()
        Collapse this node.
      • isInExpandedPath

        public boolean isInExpandedPath()
        Checks if this node is in expanded path.
        Returns:
        true, is this node is in expanded path(visible to user).
      • acceptLink

        public final void acceptLink​(java.lang.Object obj)
        Accepts drag and drop link action
        Parameters:
        obj - - moved object
      • acceptLinkSpecific

        protected void acceptLinkSpecific​(java.util.List<?> vec)
      • canAcceptLink

        public boolean canAcceptLink​(java.lang.Object obj)
      • canAcceptLinkSpecific

        protected boolean canAcceptLinkSpecific​(BaseElement obj)
      • acceptMove

        public void acceptMove​(java.lang.Object obj,
                               Tree tree,
                               java.awt.Point location)
        Accepts drag and drop link action
        Parameters:
        obj - moved object
      • acceptMoveSpecific

        protected void acceptMoveSpecific​(java.util.List<?> vec,
                                          Tree tree,
                                          java.awt.Point location)
      • canAcceptMove

        public boolean canAcceptMove​(java.lang.Object obj)
      • canAcceptMoveSpecific

        protected boolean canAcceptMoveSpecific​(BaseElement o)
      • acceptCopy

        public void acceptCopy​(java.lang.Object obj)
        Accepts drag and drop link action
        Parameters:
        obj - moved object
      • acceptCopySpecific

        protected void acceptCopySpecific​(java.util.List<?> elements)
      • canAcceptCopy

        public final boolean canAcceptCopy​(java.lang.Object obj)
      • canAcceptCopySpecific

        protected boolean canAcceptCopySpecific​(BaseElement obj)
      • getSortKeys

        public com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys getSortKeys()
        Returns keys' array for sorting
        Returns:
        instance of Node.NodeSortKeys
      • setSortKeys

        public void setSortKeys​(com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys sortKeys)
      • createNodeSortKeys

        protected com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys createNodeSortKeys()
      • getType

        protected java.lang.String getType()
        Returns node type
        Returns:
        returns node type
      • updateNode

        public boolean updateNode()
        Updates node and loads children of the node if it is necessary.
        Returns:
        true, if node itself was changed(not children).
      • updateNode

        public boolean updateNode​(boolean sortParent)
        Updates node and loads children of the node if it is necessary.
        Parameters:
        sortParent - if true - parent node will be sorted if this node changes text.
        Returns:
        true, if node itself was changed(not children).
      • updateNodeAsync

        public java.util.concurrent.Future<java.lang.Boolean> updateNodeAsync()
        Asynchronously updates node and loads children of the node if it is necessary.
        Returns:
        Future which results to true, if node itself was changed(not children).
      • updateNodeAsync

        public final <A> void updateNodeAsync​(A attachment,
                                              com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)
        Asynchronously updates node and loads children of the node if it is necessary.
        Type Parameters:
        A - The type of the object attached to the completion handler
        Parameters:
        attachment - The object to attach to the update operation; can be null
        handler - The handler for consuming the operation result, which is true, if node itself was changed(not children).
      • updateNodeAsync

        public final java.util.concurrent.Future<java.lang.Boolean> updateNodeAsync​(boolean sortParent)
        Asynchronously updates node and loads children of the node if it is necessary.
        Parameters:
        sortParent - if true - parent node will be sorted if this node changes text.
        Returns:
        Future which results to true, if node itself was changed(not children).
      • updateNodeAsync

        public final <A> void updateNodeAsync​(boolean sortParent,
                                              A attachment,
                                              @CheckForNull
                                              com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)
        Asynchronously updates node and loads children of the node if it is necessary.
        Type Parameters:
        A - The type of the object attached to the completion handler
        Parameters:
        sortParent - if true - parent node will be sorted if this node changes text.
        attachment - The object to attach to the update operation; can be null
        handler - The handler for consuming the result
      • forceUpdateNodeSync

        public final void forceUpdateNodeSync​(boolean sortParent)
        Marks node as expanded which forces node to be fully updated, and initiates asynchronous node update.
        Parameters:
        sortParent - if true - parent node will be sorted if this node changes text.
      • doUpdateNode

        protected <A> java.util.concurrent.Future<java.lang.Boolean> doUpdateNode​(boolean sortParent,
                                                                                  @CheckForNull
                                                                                  A attachment,
                                                                                  @CheckForNull
                                                                                  com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler)
      • isProjectReady

        protected boolean isProjectReady​(com.nomagic.magicdraw.ui.browser.TreeModel treeModel)
      • isNodeLocked

        protected boolean isNodeLocked​(com.nomagic.magicdraw.ui.browser.TreeModel treeModel)
      • processFailedNodeUpdate

        private static <A> java.util.concurrent.Future<java.lang.Boolean> processFailedNodeUpdate​(@CheckForNull
                                                                                                  A attachment,
                                                                                                  @CheckForNull
                                                                                                  com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,​? super A> handler,
                                                                                                  java.lang.Exception e)
      • updateNodeSync

        public final java.lang.Boolean updateNodeSync​(boolean sortParent)
        Synchronously updates node and loads children of the node if it is necessary.
        Parameters:
        sortParent - if true - parent node will be sorted if this node changes text.
        Returns:
        true, if node itself was changed(not children).
      • doUpdateNodeSync

        protected java.lang.Boolean doUpdateNodeSync​(boolean sortParent)
      • waitForUpdateNodeCompletions

        public void waitForUpdateNodeCompletions()
        Wait for pending updateNodeAsync() completions
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class javax.swing.tree.DefaultMutableTreeNode
      • isExpanded

        public boolean isExpanded()
        Specified by:
        isExpanded in interface com.nomagic.magicdraw.ui.browser.Expandable
      • setExpanded

        protected void setExpanded​(boolean expanded)
        Sets expanded state of this node.
        Parameters:
        expanded - true if node is expanded.
      • isForceStructureUpdateOnExpand

        public boolean isForceStructureUpdateOnExpand()
      • setForceStructureUpdateOnExpand

        public void setForceStructureUpdateOnExpand​(boolean value)
      • isRemoveChildrenOnCollapse

        public boolean isRemoveChildrenOnCollapse()
      • setRemoveChildrenOnCollapse

        public void setRemoveChildrenOnCollapse​(boolean value)
      • constructText

        protected java.lang.String constructText()
      • createRemoveCommand

        @CheckForNull
        public com.nomagic.magicdraw.commands.Command createRemoveCommand()
      • getParent

        @CheckForNull
        public Node getParent()
        Specified by:
        getParent in interface javax.swing.tree.TreeNode
        Overrides:
        getParent in class javax.swing.tree.DefaultMutableTreeNode
      • setDirtyRecursively

        public void setDirtyRecursively​(boolean dirty)
      • isDirty

        public boolean isDirty()
      • setDirty

        public void setDirty​(boolean dirty)
        Sets dirty flag.
        Parameters:
        dirty - is dirty?
      • getActions

        public int[] getActions()
      • canDelete

        public boolean canDelete()
        Can delete if user object is BaseElement and can be deleted from its parent.
        Returns:
        true if can delete, else false.
      • getEditingText

        protected java.lang.String getEditingText()
        Returns text which will be edited. Since some nodes can display one text, but should be edited with other text this method return text to be edited.
        Returns:
        text to edit.
      • isEditable

        public boolean isEditable()
      • setEditable

        public void setEditable​(boolean editable)
        Method marks node as editable or not.
        Parameters:
        editable - is editable?
        See Also:
        isEditable()
      • isLoading

        public boolean isLoading()
      • setLoading

        public void setLoading​(boolean flag)
      • configure

        public void configure​(ActionsManager manager)
        Method configure.
        Parameters:
        manager - actions manager to be configured for this node.
      • configureMultiple

        public void configureMultiple​(ActionsManager mngr,
                                      Node[] node)
        Method to configure actions for context menu of all the provided nodes (array always includes the current node instance too). This method gets called only once for all nodes of the same class type, so each node instance in the provided array should be regarded.
        Parameters:
        mngr - actions manager to be configured for this node.
        node - array of Node for which actions are configured.
      • getElementsForDnd

        @CheckForNull
        public BaseElement[] getElementsForDnd()
      • getElementForCopyAction

        @CheckForNull
        public BaseElement getElementForCopyAction()
      • isChildrenSortable

        public boolean isChildrenSortable()
      • setChildrenSortable

        public void setChildrenSortable​(boolean childrenSortable)
      • nodeAdded

        protected void nodeAdded()
      • add

        public void add​(javax.swing.tree.MutableTreeNode newChild)
        Overrides:
        add in class javax.swing.tree.DefaultMutableTreeNode
      • isCanDelete

        public boolean isCanDelete()
      • setCanDelete

        public void setCanDelete​(boolean canDelete)
        Method marks node as deletable or not.
        Parameters:
        canDelete - can delete?
        See Also:
        canDelete()
      • isEnableUpdateIcon

        public boolean isEnableUpdateIcon()
        Returns:
        Returns the enableUpdateIcon.
      • setEnableUpdateIcon

        public void setEnableUpdateIcon​(boolean enableUpdateIcon)
      • isChildrenSortNeeded

        public boolean isChildrenSortNeeded()
      • setChildrenSortNeeded

        public void setChildrenSortNeeded​(boolean childrenSortNeeded)
      • isCompactable

        public boolean isCompactable()
        Returns:
        true is node is compactable
      • setCompactable

        public void setCompactable​(boolean compactable)
        Make node compactable.
        Parameters:
        compactable - value
      • isNodeStructureChanged

        public boolean isNodeStructureChanged()
      • setNodeStructureChanged

        public void setNodeStructureChanged​(boolean nodeStructureChanged)
      • isHidden

        public boolean isHidden()
        Returns:
        true if node is hidden
      • setHidden

        public void setHidden​(boolean hidden)
        Make node "hidden"
        Parameters:
        hidden - hidden value
      • getHiddenParent

        @CheckForNull
        public Node getHiddenParent()
        Returns:
        hidden parent
      • setHiddenParent

        public void setHiddenParent​(@CheckForNull
                                    Node hiddenParent)
        Set hidden parent. Parent is used if node is "hidden", because normal parent is null in such case.
        Parameters:
        hiddenParent - hidden parent
      • insertHiddenOwner

        private void insertHiddenOwner​(Node child,
                                       int index)
        Add hidden owner at given index. Given node becomes "hidden".
        Parameters:
        child - hidden owner to remove
        index - given index
      • clearHiddenOwners

        public void clearHiddenOwners()
        Clear all hidden owners. Hidden nodes becomes not hidden.
      • getHiddenOwners

        public java.util.List<Node> getHiddenOwners()
        Returns:
        hidden owners or empty list
      • constructHiddenOwnerText

        protected java.lang.String constructHiddenOwnerText()
        Constructs hidden owners text.
        Returns:
        hidden owner text
      • isAutoExpandable

        public boolean isAutoExpandable()
        Returns:
        auto-expandable node flag
      • setAutoExpandable

        public void setAutoExpandable​(boolean autoExpandable)
        Change auto-expandable flag - node will be expanded if it has only one child when expanding parent node.
        Parameters:
        autoExpandable - true if node is auto-expandable
      • addLoadingNode

        private void addLoadingNode()
      • removeLoadingNode

        protected void removeLoadingNode()
      • isNodeUpdated

        public boolean isNodeUpdated()
      • setNodeUpdated

        public void setNodeUpdated​(boolean value)
      • getFlagValue

        private boolean getFlagValue​(int flag)
        Get flag value. This works as boolean algebra.
        Parameters:
        flag - which position value you want to get?
        Returns:
        value of flag.
      • setFlagValue

        private void setFlagValue​(int flag,
                                  boolean value)
        Set flag value. This works as boolean algebra.
        Parameters:
        flag - which position you want to change?
        value - real flag value.
      • getPriorityInOwner

        public int getPriorityInOwner()
        Returns:
        priority in owner for sorting
      • setPriorityInOwner

        public void setPriorityInOwner​(int priority)
        Set priority in owner for sorting
        Parameters:
        priority - priority
      • createSpecificRemoveCommand

        @CheckForNull
        public com.nomagic.magicdraw.commands.Command createSpecificRemoveCommand()
        Creates specific command for removing
        Returns:
        specific command for node removing
      • isSpecificElement

        public boolean isSpecificElement()
        Returns:
        true if element is specific