Package ghidra.framework.main.datatree
Class DataTreeNode
java.lang.Object
docking.widgets.tree.GTreeNode
docking.widgets.tree.GTreeLazyNode
docking.widgets.tree.GTreeSlowLoadingNode
ghidra.framework.main.datatree.DataTreeNode
- All Implemented Interfaces:
Cuttable,Cloneable,Comparable<GTreeNode>
- Direct Known Subclasses:
DomainFileNode,DomainFolderNode
DataTreeNode provides the base implementation for all node types contained within
a DataTree.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given node as a child to this node.children()clone()Creates a clone of this node.abstract intvoiddispose()protected voidAdds a node to this node's children at the given index and notifies the tree.protected voidAdds a node to this node's children.protected voiddoAddNodes(List<GTreeNode> nodes) Adds the given nodes to this node's children.protected voiddoFireNodeAdded(GTreeNode newNode) protected voidprotected voiddoFireNodeRemoved(GTreeNode removedNode, int index) protected voidprotected voiddoRemoveNode(GTreeNode node) Removes the node from this node's children and notifies the tree.protected voiddoSetChildren(List<GTreeNode> childList) Sets the children of this node to the given list of child nodes, but does not notify the tree.protected voiddoSetChildrenAndFireEvent(List<GTreeNode> childList) Sets the children of this node to the given list of child nodes and fires the appropriate tree event to kick the tree to update the display.abstract booleanabstract GTreeNodeFind a child using a binary-search approach.final GTreeNodeReturns the parent of this node.abstract StringReturns domain folder/file pathname within project.abstract ProjectDataGet the project data instance to which this file or folder belongs.getTree()Returns the GTree that this node is attached toabstract inthashCode()final booleanisCut()Returns true if node will be cut and moved.final booleanReturns true if the node is in the process of loading its children.booleanisLoaded()True if the children for this node have been loaded yet.final booleanisRoot()Returns true if this is a root node of a GTreevoidremoveNode(GTreeNode node) Remove the given node from this nodefinal voidsetIsCut(boolean isCut) Set this node to be deleted so that it can be rendered as such.Methods inherited from class docking.widgets.tree.GTreeSlowLoadingNode
generateChildren, generateChildren, iterator, loadAllMethods inherited from class docking.widgets.tree.GTreeLazyNode
addNode, addNodes, removeAll, unloadChildrenMethods inherited from class docking.widgets.tree.GTreeNode
collapse, expand, filter, fireNodeChanged, fireNodeStructureChanged, getChild, getChild, getChild, getChildCount, getChildren, getChildren, getDisplayText, getIcon, getIndexInParent, getIndexOfChild, getLeafCount, getName, getNodeCount, getRoot, getToolTip, getTreePath, isAncestor, isAutoExpandPermitted, isEditable, isExpanded, isLeaf, setChildren, stream, toString, valueChanged
-
Constructor Details
-
DataTreeNode
public DataTreeNode()
-
-
Method Details
-
setIsCut
public final void setIsCut(boolean isCut) Description copied from interface:CuttableSet this node to be deleted so that it can be rendered as such. -
isCut
public final boolean isCut()Description copied from interface:CuttableReturns true if node will be cut and moved. -
getProjectData
Get the project data instance to which this file or folder belongs.- Returns:
- project data instance
-
getPathname
Returns domain folder/file pathname within project.- Returns:
- domain folder/file pathname within project
-
compareTo
- Specified by:
compareToin interfaceComparable<GTreeNode>- Overrides:
compareToin classGTreeNode
-
equals
-
hashCode
public abstract int hashCode() -
addNode
Description copied from class:GTreeNodeAdds the given node as a child to this node. Note: this method may be inefficient so if you have many nodes to add, you should use eitherGTreeNode.addNodes(List)orGTreeNode.setChildren(List)- Overrides:
addNodein classGTreeLazyNode- Parameters:
newNode- the node to add as a child
-
removeNode
Description copied from class:GTreeNodeRemove the given node from this node- Overrides:
removeNodein classGTreeLazyNode- Parameters:
node- the to be removed
-
getChild
public abstract GTreeNode getChild(String name, ghidra.framework.main.datatree.DataTreeNode.NodeType type) Find a child using a binary-search approach.- Parameters:
name- name of child to findtype- node type- Returns:
- matching tree node or null if not found
-
getParent
Returns the parent of this node. Note: this method is deliberately not synchronized (See comments above)- Returns:
- the parent of this node.
-
isRoot
public final boolean isRoot()Returns true if this is a root node of a GTree- Returns:
- true if this is a root node of a GTree
-
children
-
doSetChildrenAndFireEvent
Sets the children of this node to the given list of child nodes and fires the appropriate tree event to kick the tree to update the display. Note: This method must be called from the swing thread because it will notify the underlying JTree.- Parameters:
childList- the list of child nodes to assign as children to this node- See Also:
-
doSetChildren
Sets the children of this node to the given list of child nodes, but does not notify the tree. This method does not have to be called from the swing thread. It is intended to be used by background threads that want to populate all or part of the tree, but wait until the bulk operations are completed before notifying the tree.- Parameters:
childList- the list of child nodes to assign as children to this node
-
doAddNode
Adds a node to this node's children. Must be called from the swing thread.- Parameters:
node- the node to add as a child to this node
-
doAddNode
Adds a node to this node's children at the given index and notifies the tree. Must be called from the swing thread.- Parameters:
index- the index at which to add the new nodenode- the node to add as a child to this node
-
doRemoveNode
Removes the node from this node's children and notifies the tree. Must be called from the swing thread.- Parameters:
node- the node to remove
-
doAddNodes
Adds the given nodes to this node's children. Must be called from the swing thread.- Parameters:
nodes- the nodes to add to the children this node
-
clone
Creates a clone of this node. The clone should contain a shallow copy of all the node's attributes except that the parent and children are null.- Overrides:
clonein classObject- Returns:
- the clone of this object.
- Throws:
CloneNotSupportedException- if some implementation prevents itself from being cloned.
-
dispose
public void dispose() -
isInProgress
public final boolean isInProgress()Returns true if the node is in the process of loading its children. SeeGTreeSlowLoadingNode- Returns:
- true if the node is in the process of loading its children.
-
isLoaded
public boolean isLoaded()True if the children for this node have been loaded yet. Some GTree nodes are lazy in that they don't load their children until needed. Nodes that have the IN_PROGRESS node as it child is considered loaded if in the swing thread, otherwise they are considered not loaded.- Returns:
- true if the children for this node have been loaded.
-
getTree
Returns the GTree that this node is attached to- Returns:
- the GTree that this node is attached to
-
doFireNodeAdded
-
doFireNodeRemoved
-
doFireNodeStructureChanged
protected void doFireNodeStructureChanged() -
doFireNodeChanged
protected void doFireNodeChanged()
-