Package com.nomagic.magicdraw.ui.browser
Class Node
- java.lang.Object
-
- javax.swing.tree.DefaultMutableTreeNode
-
- com.nomagic.magicdraw.ui.browser.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.ExpandableThe 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 classcom.nomagic.magicdraw.ui.browser.Node.CancelStatusTaskprivate static classcom.nomagic.magicdraw.ui.browser.Node.CancelStatusTimerprivate static classcom.nomagic.magicdraw.ui.browser.Node.DeferredBlockingCompletionHandlerstatic classcom.nomagic.magicdraw.ui.browser.Node.NodeSortKeys
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.atomic.AtomicLongaddCounterprivate static java.lang.ObjectchildrenHide fieldDefaultMutableTreeNode.childrenfrom extending classes.private com.nomagic.magicdraw.ui.browser.ChildrenOwnerchildrenOwnerNode specific children owner.private static java.lang.ThreadLocal<java.util.concurrent.atomic.AtomicInteger>compactCounterHolderprivate static java.lang.ThreadLocal<java.util.Set<java.lang.Object>>compactHistoryHolderprivate javax.swing.IcondefaultIcondefault icon.private static com.nomagic.magicdraw.ui.browser.ChildrenOwnerEMPTY_CHILDREN_OWNERprivate java.util.concurrent.atomic.AtomicIntegerflagsprivate booleanforceUpdateprivate static java.lang.StringHIDDEN_CHILDREN_SEPARATORPath separator for compactable nodeprivate java.util.List<Node>hiddenOwnersHidden owners if node is compactable.private NodehiddenParentParent of hidden nodeprivate javax.swing.IconiconThe icon of this node.protected booleanignoreRootCheckprivate static booleanlockedIs locked flag is set to true, node does not do updateprivate static java.util.concurrent.atomic.AtomicLonglockingCounterprivate static org.apache.logging.log4j.LoggerLOG_SCALABILITYprivate static intM_AUTO_EXPANDABLEAuto expandable flag - node will be expanded if it has only one child when expanding parent node.private static intM_CAN_DELETEFlag indicates that node's object can be deleted.private static intM_CHILDREN_EXPANDEDprivate static intM_CHILDREN_SORT_NEEDEDFlag indicated that children sort needed on node expand.private static intM_CHILDREN_SORTABLEprivate static intM_COMPACTABLECompactable node can be suppressed if it has just one compactable childprivate static intM_DIRTYIf mDirty true, node must be updated before expanding it.private static intM_EDITABLEFlag indicates that node's object can be edit.private static intM_ENABLE_UPDATE_ICONprivate static intM_EXPANDEDIs this node expanded.private static intM_FORCE_STRUCTURE_UPDATEFlag 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 intM_HIDDENIs node hidden?private static intM_LOADINGFlag indicates that node is being loaded.private static intM_NODE_UPDATEDShows that node is updated.private static intM_REMOVE_CHILDREN_ON_COLLAPSEFlag indicates that children must be removed on collapse.private static intM_REMOVEDprivate static intM_STRUCTURE_CHANGEDprivate static intMAX_NODE_EVENTSprivate static intMAX_NODES_TO_EXPAND_ON_SINGLE_EVENTstatic intMAX_STRUCTURE_UPDATE_RETRY_COUNTprivate com.nomagic.magicdraw.ui.browser.NodeTextParamsnodeTextParamsprivate intpriorityInOwnerprivate booleanremoveAndKeepUserObjectprivate com.nomagic.magicdraw.ui.browser.Node.NodeSortKeyssortKeysThe sort keys.private java.lang.StringtextThe text of the nodeprivate java.lang.ref.WeakReference<?>treeModelThe model of the node.private java.lang.StringuserObjectBaseElementID
-
Constructor Summary
Constructors Constructor Description Node(BaseElement element, javax.swing.Icon icon)Node(BaseElement element, javax.swing.Icon icon, javax.swing.Icon defaultIcon)Node(BaseElement element, javax.swing.Icon icon, javax.swing.Icon defaultIcon, com.nomagic.magicdraw.ui.browser.NodeTextParams nodeTextParams)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptCopy(java.lang.Object obj)Accepts drag and drop link actionprotected voidacceptCopySpecific(java.util.List<?> elements)voidacceptLink(java.lang.Object obj)Accepts drag and drop link actionprotected voidacceptLinkSpecific(java.util.List<?> vec)voidacceptMove(java.lang.Object obj, Tree tree, java.awt.Point location)Accepts drag and drop link actionprotected voidacceptMoveSpecific(java.util.List<?> vec, Tree tree, java.awt.Point location)voidadd(javax.swing.tree.MutableTreeNode newChild)protected voidaddListeners()protected voidaddListeners(BaseElement data)Adds needed listeners to the node element.private voidaddLoadingNode()private voidaddStructureUpdateErrorNode()booleancanAcceptCopy(java.lang.Object obj)protected booleancanAcceptCopySpecific(BaseElement obj)booleancanAcceptLink(java.lang.Object obj)protected booleancanAcceptLinkSpecific(BaseElement obj)booleancanAcceptMove(java.lang.Object obj)protected booleancanAcceptMoveSpecific(BaseElement o)private static booleancanBeCompacted(java.lang.Object userObject)booleancanDelete()Can delete if user object is BaseElement and can be deleted from its parent.java.util.Enumerationchildren()voidclearHiddenOwners()Clear all hidden owners.private static com.nomagic.magicdraw.ui.browser.NodeTextParamscloneParams(com.nomagic.magicdraw.ui.browser.NodeTextParams nodeTextParams)voidcollapse()Collapse this node.protected booleancompactNodes(boolean parentStructureChanged)Compact all children.voidconfigure(ActionsManager manager)Method configure.voidconfigureMultiple(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.StringconstructHiddenOwnerText()Constructs hidden owners text.protected java.lang.StringconstructText()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 NodecreateNodeFor(java.lang.Object obj)Creates node for given element.protected com.nomagic.magicdraw.ui.browser.Node.NodeSortKeyscreateNodeSortKeys()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.CommandcreateRemoveCommand()com.nomagic.magicdraw.commands.CommandcreateSpecificRemoveCommand()Creates specific command for removingprivate <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)voiddisposeNode()Disposes the node - unregisters listeners, removes from nodes map and etc.private NodedoCreateNode(java.lang.Object obj)private static voiddoForceNodeUpdate(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 voiddoRemoveNode(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.BooleandoUpdateNodeSync(boolean sortParent)private static voiddoWithBrowserNodeMap(java.lang.Object userObject, java.util.function.BiConsumer<com.nomagic.magicdraw.ui.browser.BrowserNodeMap,BaseElement> browserConsumer)voidenterClicked(java.awt.AWTEvent event)CallsmouseDoubleClickedfor user object.protected com.nomagic.magicdraw.ui.browser.NodeChildrenKeeperexchangeNodeChildrenKeepers()private voidexecuteOnTreeModel(java.util.function.Consumer<com.nomagic.magicdraw.ui.browser.TreeModel> consumer)voidexpand()Expands the tree node.voidexpand(boolean sortExplicitly)Expands the tree node.voidexpandAsync()Asynchronously expands the tree node.voidexpandAsync(boolean sortExplicitly)Asynchronously expands the tree node.private static <A> voidforceUpdateNodeStructure(Node node, boolean resetFlag, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<java.lang.Boolean,A> handler)voidforceUpdateNodeSync(boolean sortParent)Marks node as expanded which forces node to be fully updated, and initiates asynchronous node update.int[]getActions()javax.swing.tree.TreeNodegetChildAt(int index)intgetChildCount()java.util.List<Node>getChildren()Returns list of children.com.nomagic.magicdraw.ui.browser.ChildrenOwnergetChildrenOwner()javax.swing.IcongetDefaultIcon()Returns the default iconprotected java.lang.StringgetEditingText()Returns text which will be edited.BaseElementgetElementForCopyAction()BaseElement[]getElementsForDnd()private booleangetFlagValue(int flag)Get flag value.protected NodegetHiddenNodeFor(BaseElement object)java.util.List<Node>getHiddenOwners()NodegetHiddenParent()javax.swing.IcongetIcon()Gets the icon for this node.intgetIndex(javax.swing.tree.TreeNode aChild)Node[]getNodeForObject(BaseElement object)Returns the tree node which data is the same as given Element.protected com.nomagic.magicdraw.ui.browser.NodeTextParamsgetNodeTextParams()NodegetParent()intgetPriorityInOwner()java.util.Collection<BaseElement>getRootElements()Collects root elements of childrencom.nomagic.magicdraw.ui.browser.Node.NodeSortKeysgetSortKeys()Returns keys' array for sortingjava.lang.StringgetText()This method returns the name of the ObjectData (user's object of this node).java.lang.StringgetTextForSorting()This method returns the name of the ObjectData (user's object of this node).com.nomagic.magicdraw.ui.browser.TreeModelgetTreeModel()Returns the model of this node.protected java.lang.StringgetType()Returns node typejava.lang.ObjectgetUserObject()Returns user object of this node.java.lang.StringgetUserObjectBaseElementID()voidinsert(javax.swing.tree.MutableTreeNode newChild, int childIndex)private voidinsertHiddenOwner(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)protected booleaninternalUpdateNodeStructure()Loads all children for this node.booleanisAutoExpandable()booleanisCanDelete()booleanisChildrenSortable()booleanisChildrenSortNeeded()booleanisCompactable()booleanisDirty()booleanisEditable()booleanisEnableUpdateIcon()protected booleanisEventForUpdate(java.beans.PropertyChangeEvent evt)booleanisExpanded()booleanisForceStructureUpdateOnExpand()booleanisHidden()booleanisInExpandedPath()Checks if this node is in expanded path.booleanisLoading()static booleanisLocked()Returns locked flagprotected booleanisNodeLocked(com.nomagic.magicdraw.ui.browser.TreeModel treeModel)booleanisNodeStructureChanged()booleanisNodeUpdated()protected booleanisProjectReady(com.nomagic.magicdraw.ui.browser.TreeModel treeModel)booleanisRemoveChildrenOnCollapse()booleanisSpecificElement()private static voidmaybeCleanCompactedHistory()voidmouseDoubleClicked(java.awt.AWTEvent event)CallsonFindfor user object.protected voidnodeAdded()protected java.util.Map<java.lang.Object,Node>prepareUserObjectNodeMap()Return map of user objects mapped to nodes.private booleanprivateCompactNodes(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)voidpropertyChange(java.beans.PropertyChangeEvent event)This method is called when some ObjectData has changed.voidremove()Removes node from parent.voidremove(int childIndex)voidremove(javax.swing.tree.MutableTreeNode aChild)voidremoveAllChildren()Removes all nodes from this node.protected booleanremoveAllChildren(java.util.Collection<?> userObjects)Removes nodes from this node if theirs data objects are not in given userObjects.protected booleanremoveIllegalNodes()Removes nodes from this node these nodes cannot be created with node creator.protected voidremoveListeners()Removes propertyChangeListener(node) from Element property change support.protected voidremoveLoadingNode()private voidremoveNode(int index)Removes node from this node.voidremoveRecursively()Removes all nodes from this node recursivelyvoidremoveRecursively(int index)Removes all nodes from this node recursivelyprivate voidremoveStructureUpdateErrorNode()voidreplaceChildren(java.util.List<Node> newChildren)protected NodereplaceCompactableNode(Node node)Replace given node with its compacted child if needed.private static voidreportPotentialNodeChildrenModificationProblem()static longresetLock(boolean value, long lockingCounter)Sets locked flag and decrements locking counter if current locking counter is equal to the one passed as method parametervoidsetAutoExpandable(boolean autoExpandable)Change auto-expandable flag - node will be expanded if it has only one child when expanding parent node.voidsetCanDelete(boolean canDelete)Method marks node as deletable or not.voidsetChildrenOwner(com.nomagic.magicdraw.ui.browser.ChildrenOwner owner)Set node specific children owner.voidsetChildrenSortable(boolean childrenSortable)voidsetChildrenSortNeeded(boolean childrenSortNeeded)voidsetCompactable(boolean compactable)Make node compactable.voidsetDefaultIcon(javax.swing.Icon icon)Sets the default icon.voidsetDirty(boolean dirty)Sets dirty flag.voidsetDirtyRecursively(boolean dirty)voidsetEditable(boolean editable)Method marks node as editable or not.voidsetEnableUpdateIcon(boolean enableUpdateIcon)protected voidsetExpanded(boolean expanded)Sets expanded state of this node.private voidsetFlagValue(int flag, boolean value)Set flag value.voidsetForceStructureUpdateOnExpand(boolean value)voidsetForceUpdate(boolean forceUpdate)Set to true to force node update, no matter if text or icon was not changedvoidsetHidden(boolean hidden)Make node "hidden"voidsetHiddenParent(Node hiddenParent)Set hidden parent.voidsetIcon(javax.swing.Icon icon)Sets the icon for this node.voidsetLoading(boolean flag)static longsetLocked(boolean value)Sets locked flag and increases locking countervoidsetNodeStructureChanged(boolean nodeStructureChanged)voidsetNodeUpdated(boolean value)voidsetPriorityInOwner(int priority)Set priority in owner for sortingvoidsetRemoveChildrenOnCollapse(boolean value)voidsetSortKeys(com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys sortKeys)voidsetText(java.lang.String text)Sets the name of the ObjectData(user's object).voidsetTreeModel(com.nomagic.magicdraw.ui.browser.TreeModel model)Sets the model for this node.voidsetUserObject(java.lang.Object o)We put WeakReference with given object as user object in order to make things easier for garbage collector.java.lang.StringtoString()protected booleanunCompactNodes()Un-compact all compacted children.voidupdateChildren(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.booleanupdateIcon()Sets icon according to the data.booleanupdateNode()Updates node and loads children of the node if it is necessary.booleanupdateNode(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> voidupdateNodeAsync(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> voidupdateNodeAsync(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.booleanupdateNodeItself()Updates text and icon of the node.protected booleanupdateNodeStructure(java.util.Collection<?> objects)This method reloads children from given user object collection.voidupdateNodeStructureOfChildInExpandedPath(Node node)booleanupdateNodeStructureWithRetry()Tries to load all children of this node.java.lang.BooleanupdateNodeSync(boolean sortParent)Synchronously updates node and loads children of the node if it is necessary.protected voidupdateSortKeys(java.lang.String text)voidwaitForUpdateNodeCompletions()Wait for pendingupdateNodeAsync()completionsprivate static voidwaitWhileChildrenUpdate(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
-
-
-
-
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.logging.log4j.Logger LOG_SCALABILITY
-
EMPTY_CHILDREN_OWNER
private static final com.nomagic.magicdraw.ui.browser.ChildrenOwner EMPTY_CHILDREN_OWNER
-
MAX_STRUCTURE_UPDATE_RETRY_COUNT
public static final int MAX_STRUCTURE_UPDATE_RETRY_COUNT
- See Also:
- Constant Field Values
-
M_HIDDEN
private static final int M_HIDDEN
Is node hidden?- See Also:
- Constant Field Values
-
M_NODE_UPDATED
private static final int M_NODE_UPDATED
Shows that node is updated.- See Also:
- Constant Field Values
-
M_EXPANDED
private static final int M_EXPANDED
Is this node expanded.- 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_CHILDREN_SORTABLE
private static final int M_CHILDREN_SORTABLE
- See Also:
- Constant Field Values
-
M_ENABLE_UPDATE_ICON
private static final int M_ENABLE_UPDATE_ICON
- 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_REMOVED
private static final int M_REMOVED
- See Also:
- Constant Field Values
-
M_STRUCTURE_CHANGED
private static final int M_STRUCTURE_CHANGED
- See Also:
- Constant Field Values
-
M_CHILDREN_EXPANDED
private static final int M_CHILDREN_EXPANDED
- 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 fieldDefaultMutableTreeNode.childrenfrom 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
-
nodeTextParams
private final com.nomagic.magicdraw.ui.browser.NodeTextParams nodeTextParams
-
userObjectBaseElementID
@CheckForNull private java.lang.String userObjectBaseElementID
-
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
-
MAX_NODE_EVENTS
private static final int MAX_NODE_EVENTS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Node
public Node(@CheckForNull BaseElement element, @CheckForNull javax.swing.Icon icon)
-
Node
public Node(@CheckForNull BaseElement element, @CheckForNull javax.swing.Icon icon, @CheckForNull javax.swing.Icon defaultIcon)
-
Node
public Node(@CheckForNull BaseElement element, @CheckForNull javax.swing.Icon icon, @CheckForNull javax.swing.Icon defaultIcon, com.nomagic.magicdraw.ui.browser.NodeTextParams nodeTextParams)
-
-
Method Detail
-
cloneParams
private static com.nomagic.magicdraw.ui.browser.NodeTextParams cloneParams(com.nomagic.magicdraw.ui.browser.NodeTextParams nodeTextParams)
-
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 valuelockingCounter- locking counter- Returns:
- locking counter
-
addListeners
protected void addListeners(BaseElement data)
Adds needed listeners to the node element.- Parameters:
data- instance ofBaseElement
-
addListeners
protected void addListeners()
-
getChildren
public java.util.List<Node> getChildren()
Returns list of children.- Returns:
- list of
Node
-
getUserObjectBaseElementID
@CheckForNull public java.lang.String getUserObjectBaseElementID()
-
getChildCount
public int getChildCount()
- Specified by:
getChildCountin interfacejavax.swing.tree.TreeNode- Overrides:
getChildCountin classjavax.swing.tree.DefaultMutableTreeNode
-
getChildAt
public javax.swing.tree.TreeNode getChildAt(int index)
- Specified by:
getChildAtin interfacejavax.swing.tree.TreeNode- Overrides:
getChildAtin classjavax.swing.tree.DefaultMutableTreeNode
-
children
public java.util.Enumeration children()
- Specified by:
childrenin interfacejavax.swing.tree.TreeNode- Overrides:
childrenin classjavax.swing.tree.DefaultMutableTreeNode
-
getIndex
public int getIndex(javax.swing.tree.TreeNode aChild)
- Specified by:
getIndexin interfacejavax.swing.tree.TreeNode- Overrides:
getIndexin classjavax.swing.tree.DefaultMutableTreeNode
-
insert
public void insert(javax.swing.tree.MutableTreeNode newChild, int childIndex)- Specified by:
insertin interfacejavax.swing.tree.MutableTreeNode- Overrides:
insertin classjavax.swing.tree.DefaultMutableTreeNode
-
remove
public void remove(int childIndex)
- Specified by:
removein interfacejavax.swing.tree.MutableTreeNode- Overrides:
removein classjavax.swing.tree.DefaultMutableTreeNode
-
remove
public void remove(javax.swing.tree.MutableTreeNode aChild)
- Specified by:
removein interfacejavax.swing.tree.MutableTreeNode- Overrides:
removein classjavax.swing.tree.DefaultMutableTreeNode
-
replaceChildren
public void replaceChildren(java.util.List<Node> newChildren)
-
exchangeNodeChildrenKeepers
@CheckForNull protected com.nomagic.magicdraw.ui.browser.NodeChildrenKeeper exchangeNodeChildrenKeepers()
-
getUserObject
@CheckForNull @OpenApi public java.lang.Object getUserObject()
Returns user object of this node.- Overrides:
getUserObjectin classjavax.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:
setUserObjectin interfacejavax.swing.tree.MutableTreeNode- Overrides:
setUserObjectin classjavax.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:
propertyChangein interfacejava.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)
-
internalUpdateNodeStructure
protected boolean internalUpdateNodeStructure()
Loads all children for this node.- Returns:
- true if structure was changed
-
updateNodeStructureWithRetry
public final boolean updateNodeStructureWithRetry()
Tries to load all children of this node. In case of exception due to model changes will try multiple times- 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)CallsonFindfor 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)
CallsmouseDoubleClickedfor 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- ofNodewhich 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:
removeAllChildrenin classjavax.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- iftruesort 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- iftruesort children explicitly- Returns:
- A
Futureobject 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- iftruesort children explicitlyattachment- The object to attach to the update operation; can benullhandler- The handler for consuming the operation result, which istrue, 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- iftrue- 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:
Futurewhich results totrue, 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 benullhandler- The handler for consuming the operation result, which istrue, 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- iftrue- parent node will be sorted if this node changes text.- Returns:
Futurewhich results totrue, 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- iftrue- parent node will be sorted if this node changes text.attachment- The object to attach to the update operation; can benullhandler- 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- iftrue- 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- iftrue- 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 pendingupdateNodeAsync()completions
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjavax.swing.tree.DefaultMutableTreeNode
-
isExpanded
public boolean isExpanded()
- Specified by:
isExpandedin interfacecom.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)
-
getNodeTextParams
protected com.nomagic.magicdraw.ui.browser.NodeTextParams getNodeTextParams()
-
constructText
protected java.lang.String constructText()
-
createRemoveCommand
@CheckForNull public com.nomagic.magicdraw.commands.Command createRemoveCommand()
-
getParent
@CheckForNull public Node getParent()
- Specified by:
getParentin interfacejavax.swing.tree.TreeNode- Overrides:
getParentin classjavax.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 ofNodefor 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:
addin classjavax.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 removeindex- 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
-
addStructureUpdateErrorNode
private void addStructureUpdateErrorNode()
-
removeStructureUpdateErrorNode
private void removeStructureUpdateErrorNode()
-
executeOnTreeModel
private void executeOnTreeModel(java.util.function.Consumer<com.nomagic.magicdraw.ui.browser.TreeModel> consumer)
-
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
-
-