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
,PropertyChangeListener
,Serializable
,Cloneable
,EventListener
,MutableTreeNode
,TreeNode
@OpenApi
public class Node
extends DefaultMutableTreeNode
implements PropertyChangeListener, com.nomagic.magicdraw.ui.browser.Expandable
The base node of all tree nodes. This node has some user object.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
static final int
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, EMPTY_ENUMERATION, parent, userObject
-
Constructor Summary
ConstructorsConstructorDescriptionNode
(BaseElement element, Icon icon) Node
(BaseElement element, Icon icon, Icon defaultIcon) Node
(BaseElement element, Icon icon, Icon defaultIcon, com.dassault_systemes.modeler.foundation.ui.tree.NodeTextParams nodeTextParams) -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptCopy
(Object obj) Accepts drag and drop link actionprotected void
acceptCopySpecific
(List<?> elements) final void
acceptLink
(Object obj) Accepts drag and drop link actionprotected void
acceptLinkSpecific
(List<?> vec) void
acceptMove
(Object obj, Tree tree, Point location) Accepts drag and drop link actionprotected void
acceptMoveSpecific
(List<?> vec, Tree tree, Point location) void
add
(MutableTreeNode newChild) protected void
protected void
addListeners
(BaseElement data) Adds needed listeners to the node element.final boolean
canAcceptCopy
(Object obj) protected boolean
canAcceptCopySpecific
(BaseElement element) boolean
canAcceptLink
(Object obj) protected boolean
boolean
canAcceptMove
(Object obj) protected boolean
boolean
Can delete if user object is BaseElement and can be deleted from its parent.children()
void
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 String
Constructs hidden owners text.protected String
This method returns the name of the ObjectData (user's object of this node) for sorting purposesprotected Node
createNodeFor
(Object obj) Creates node for given element.protected com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys
com.dassault_systemes.modeler.foundation.editing.Command
com.nomagic.magicdraw.commands.Command
Creates specific command for removingvoid
Disposes the node - unregisters listeners, removes from nodes map and etc.doUpdateNode
(boolean sortParent, A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<Boolean, ? super A> handler) protected Boolean
doUpdateNodeSync
(boolean sortParent) void
enterClicked
(AWTEvent event) CallsmouseDoubleClicked
for user object.protected com.nomagic.magicdraw.ui.browser.NodeChildrenKeeper
void
expand()
Expands the tree node.void
expand
(boolean sortExplicitly) Expands the tree node.void
Asynchronously expands the tree node.void
expandAsync
(boolean sortExplicitly) Asynchronously expands the tree node.final void
forceUpdateNodeSync
(boolean sortParent) Marks node as expanded which forces node to be fully updated, and initiates asynchronous node update.int[]
getChildAt
(int index) int
Returns list of children.com.nomagic.magicdraw.ui.browser.ChildrenOwner
Returns the default iconprotected String
Returns text which will be edited.protected Node
getHiddenNodeFor
(BaseElement object) getIcon()
Gets the icon for this node.int
Node[]
getNodeForObject
(BaseElement object) Returns the tree node which data is the same as given Element.protected com.dassault_systemes.modeler.foundation.ui.tree.NodeTextParams
int
Collects root elements of childrencom.nomagic.magicdraw.ui.browser.Node.NodeSortKeys
Returns keys' array for sortingfinal String
getText()
This method returns the name of the ObjectData (user's object of this node).final com.nomagic.magicdraw.ui.browser.TreeModel
Returns the model of this node.protected String
getType()
Returns node typeReturns user object of this node.void
insert
(MutableTreeNode newChild, int childIndex) protected boolean
protected boolean
Loads all children for this node.boolean
boolean
boolean
boolean
boolean
boolean
isDirty()
boolean
boolean
protected boolean
boolean
Checks if component is expanded or not.boolean
boolean
isHidden()
boolean
Checks if this node is in expanded path.boolean
static boolean
isLocked()
Returns locked flagprotected boolean
isNodeLocked
(com.nomagic.magicdraw.ui.browser.TreeModel treeModel) boolean
boolean
protected boolean
isProjectReady
(com.nomagic.magicdraw.ui.browser.TreeModel treeModel) boolean
boolean
void
mouseDoubleClicked
(AWTEvent event) CallsonFind
for user object.protected void
Return map of user objects mapped to nodes.void
This method is called when some ObjectData has changed.void
remove()
Removes node from parent.void
remove
(int childIndex) void
remove
(MutableTreeNode aChild) void
Removes all nodes from this node.protected boolean
removeAllChildren
(Collection<?> userObjects) Removes nodes from this node if theirs data objects are not in given userObjects.protected boolean
Removes nodes from this node these nodes cannot be created with node creator.protected void
Removes propertyChangeListener(node) from Element property change support.protected void
void
Removes all nodes from this node recursivelyvoid
removeRecursively
(int index) Removes all nodes from this node recursivelyvoid
replaceChildren
(List<Node> newChildren) protected Node
replaceCompactableNode
(Node node) Replace given node with its compacted child if needed.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 parametervoid
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
(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.void
setForceStructureUpdateOnExpand
(boolean value) void
setForceUpdate
(boolean forceUpdate) Set to true to force node update, no matter if text or icon was not changedvoid
setHidden
(boolean hidden) Make node "hidden"void
setHiddenParent
(Node hiddenParent) Set hidden parent.void
Sets the icon for this node.void
setLoading
(boolean flag) static long
setLocked
(boolean value) Sets locked flag and increases locking countervoid
setNodeStructureChanged
(boolean nodeStructureChanged) void
setNodeUpdated
(boolean value) void
setPriorityInOwner
(int priority) Set priority in owner for sortingvoid
setRemoveChildrenOnCollapse
(boolean value) void
setSortKeys
(com.nomagic.magicdraw.ui.browser.Node.NodeSortKeys sortKeys) void
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
We put WeakReference with given object as user object in order to make things easier for garbage collector.toString()
protected boolean
Un-compact all compacted children.final void
updateChildren
(Node node, boolean sortExplicitly) Updates children of this node depending on dirty and expand state.final Future<?>
updateChildrenAsync
(Node node, boolean sortExplicitly) Asynchronously updates children of this node depending on dirty and expand state.final <A> Future<?>
updateChildrenAsync
(Node node, boolean sortExplicitly, A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<Boolean, ? super A> handler) Asynchronously updates children of this node depending on dirty and expand state.boolean
Sets icon according to the data.boolean
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.Asynchronously updates node and loads children of the node if it is necessary.updateNodeAsync
(boolean sortParent) Asynchronously updates node and loads children of the node if it is necessary.final <A> void
updateNodeAsync
(boolean sortParent, A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<Boolean, ? super A> handler) Asynchronously updates node and loads children of the node if it is necessary.final <A> void
updateNodeAsync
(A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<Boolean, ? super A> handler) Asynchronously updates node and loads children of the node if it is necessary.final boolean
Updates text and icon of the node.protected boolean
updateNodeStructure
(Collection<?> objects) This method reloads children from given user object collection.void
final boolean
Tries to load all children of this node.final Boolean
updateNodeSync
(boolean sortParent) Synchronously updates node and loads children of the node if it is necessary.protected void
updateSortKeys
(String text) void
Wait for pendingupdateNodeAsync()
completionsMethods 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 Details
-
MAX_NODE_UPDATE_RETRY_COUNT
public static final int MAX_NODE_UPDATE_RETRY_COUNT- See Also:
-
ignoreRootCheck
protected volatile boolean ignoreRootCheck
-
-
Constructor Details
-
Node
-
Node
public Node(@CheckForNull BaseElement element, @CheckForNull Icon icon, @CheckForNull Icon defaultIcon) -
Node
public Node(@CheckForNull BaseElement element, @CheckForNull Icon icon, @CheckForNull Icon defaultIcon, com.dassault_systemes.modeler.foundation.ui.tree.NodeTextParams nodeTextParams)
-
-
Method Details
-
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
Adds needed listeners to the node element.- Parameters:
data
- instance ofBaseElement
-
addListeners
protected void addListeners() -
getChildren
Returns list of children.- Returns:
- list of
Node
-
getUserObjectBaseElementID
-
getChildCount
public int getChildCount()- Specified by:
getChildCount
in interfaceTreeNode
- Overrides:
getChildCount
in classDefaultMutableTreeNode
-
getChildAt
- Specified by:
getChildAt
in interfaceTreeNode
- Overrides:
getChildAt
in classDefaultMutableTreeNode
-
children
- Specified by:
children
in interfaceTreeNode
- Overrides:
children
in classDefaultMutableTreeNode
-
getIndex
- Specified by:
getIndex
in interfaceTreeNode
- Overrides:
getIndex
in classDefaultMutableTreeNode
-
insert
- Specified by:
insert
in interfaceMutableTreeNode
- Overrides:
insert
in classDefaultMutableTreeNode
-
remove
public void remove(int childIndex) - Specified by:
remove
in interfaceMutableTreeNode
- Overrides:
remove
in classDefaultMutableTreeNode
-
remove
- Specified by:
remove
in interfaceMutableTreeNode
- Overrides:
remove
in classDefaultMutableTreeNode
-
replaceChildren
-
exchangeNodeChildrenKeepers
@CheckForNull protected com.nomagic.magicdraw.ui.browser.NodeChildrenKeeper exchangeNodeChildrenKeepers() -
getUserObject
Returns user object of this node.- Overrides:
getUserObject
in classDefaultMutableTreeNode
- Returns:
- user object(some Element).
-
setUserObject
We put WeakReference with given object as user object in order to make things easier for garbage collector.- Specified by:
setUserObject
in interfaceMutableTreeNode
- Overrides:
setUserObject
in classDefaultMutableTreeNode
-
getDefaultIcon
Returns the default icon- Returns:
- the default icon.
-
setDefaultIcon
Sets the default icon.- Parameters:
icon
- the default icon.
-
getIcon
Gets the icon for this node.- Returns:
- the icon of this node.
-
setIcon
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
This method is called when some ObjectData has changed.- Specified by:
propertyChange
in interfacePropertyChangeListener
- Parameters:
event
- the property changed event.
-
isEventForUpdate
-
getText
This method returns the name of the ObjectData (user's object of this node).- Returns:
- the name of the ObjectData
-
setText
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
-
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
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
-
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
-
replaceCompactableNode
Replace given node with its compacted child if needed.- Parameters:
node
- given node- Returns:
- node replaced node or null if no replacement
-
updateNodeItself
public final boolean updateNodeItself()Updates text and icon of the node.- Returns:
- true if text or icon was changed.
-
internalUpdateNodeItself
protected boolean internalUpdateNodeItself() -
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
Creates node for given element. Uses node creator from tree model.- Parameters:
obj
- the given object.- Returns:
- the created node or null
-
getRootElements
Collects root elements of children- Returns:
- collection of root elements of children
-
getNodeForObject
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
-
prepareUserObjectNodeMap
Return map of user objects mapped to nodes.- Returns:
- map of user objects mapped to nodes.
-
mouseDoubleClicked
CallsonFind
for user object. This method is called when user double clicks with mouse on the node.- Parameters:
event
- click event
-
enterClicked
CallsmouseDoubleClicked
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. -
disposeNode
public void disposeNode()Disposes the node - unregisters listeners, removes from nodes map and etc. -
removeAllChildren
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 classDefaultMutableTreeNode
-
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
Updates children of this node depending on dirty and expand state.- Parameters:
node
- the given node.sortExplicitly
- iftrue
sort children explicitly
-
updateChildrenAsync
Asynchronously updates children of this node depending on dirty and expand state.- Parameters:
node
- the given node.sortExplicitly
- iftrue
sort children explicitly- Returns:
- A
Future
object representing the pending operation
-
updateChildrenAsync
public final <A> Future<?> updateChildrenAsync(Node node, boolean sortExplicitly, @CheckForNull A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<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
- iftrue
sort children explicitlyattachment
- The object to attach to the update operation; can benull
handler
- The handler for consuming the operation result, which istrue
, if node itself was changed(not children).
-
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
Accepts drag and drop link action- Parameters:
obj
- - moved object
-
acceptLinkSpecific
-
canAcceptLink
-
canAcceptLinkSpecific
-
acceptMove
Accepts drag and drop link action- Parameters:
obj
- moved object
-
acceptMoveSpecific
-
canAcceptMove
-
canAcceptMoveSpecific
-
acceptCopy
Accepts drag and drop link action- Parameters:
obj
- moved object
-
acceptCopySpecific
-
getCopyOperationTarget
-
canAcceptCopy
-
canAcceptCopySpecific
-
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
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
Asynchronously updates node and loads children of the node if it is necessary.- Returns:
Future
which results totrue
, if node itself was changed(not children).
-
updateNodeAsync
public final <A> void updateNodeAsync(A attachment, com.nomagic.magicdraw.utils.concurrent.CompletionHandler<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 benull
handler
- The handler for consuming the operation result, which istrue
, if node itself was changed(not children).
-
updateNodeAsync
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:
Future
which 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<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 benull
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
- iftrue
- parent node will be sorted if this node changes text.
-
doUpdateNode
-
isProjectReady
protected boolean isProjectReady(com.nomagic.magicdraw.ui.browser.TreeModel treeModel) -
isNodeLocked
protected boolean isNodeLocked(com.nomagic.magicdraw.ui.browser.TreeModel treeModel) -
updateNodeSync
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
-
waitForUpdateNodeCompletions
public void waitForUpdateNodeCompletions()Wait for pendingupdateNodeAsync()
completions -
toString
- Overrides:
toString
in classDefaultMutableTreeNode
-
isExpanded
public boolean isExpanded()Description copied from interface:com.nomagic.magicdraw.ui.browser.Expandable
Checks if component is expanded or not.- Specified by:
isExpanded
in interfacecom.nomagic.magicdraw.ui.browser.Expandable
- Returns:
true
when component is expanded,false
- otherwise
-
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.dassault_systemes.modeler.foundation.ui.tree.NodeTextParams getNodeTextParams() -
constructText
-
constructTextForSorting
This method returns the name of the ObjectData (user's object of this node) for sorting purposes- Returns:
- the name of the ObjectData for sorting purposes
-
createRemoveCommand
@CheckForNull public com.dassault_systemes.modeler.foundation.editing.Command createRemoveCommand() -
getParent
- Specified by:
getParent
in interfaceTreeNode
- Overrides:
getParent
in classDefaultMutableTreeNode
-
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
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:
-
isLoading
public boolean isLoading() -
setLoading
public void setLoading(boolean flag) -
configure
Method configure.- Parameters:
manager
- actions manager to be configured for this node.
-
configureMultiple
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 ofNode
for which actions are configured.
-
getElementsForDnd
-
getRepresentedElements
-
getElementForCopyAction
-
isChildrenSortable
public boolean isChildrenSortable() -
setChildrenSortable
public void setChildrenSortable(boolean childrenSortable) -
nodeAdded
protected void nodeAdded() -
add
- Overrides:
add
in classDefaultMutableTreeNode
-
isCanDelete
public boolean isCanDelete() -
setCanDelete
public void setCanDelete(boolean canDelete) Method marks node as deletable or not.- Parameters:
canDelete
- can delete?- See Also:
-
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
- Returns:
- hidden parent
-
setHiddenParent
Set hidden parent. Parent is used if node is "hidden", because normal parent is null in such case.- Parameters:
hiddenParent
- hidden parent
-
clearHiddenOwners
public void clearHiddenOwners()Clear all hidden owners. Hidden nodes becomes not hidden. -
getHiddenOwners
- Returns:
- hidden owners or empty list
-
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
-
removeLoadingNode
protected void removeLoadingNode() -
isNodeUpdated
public boolean isNodeUpdated() -
setNodeUpdated
public void setNodeUpdated(boolean 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
-