Package docking.widgets.tree
Interface GTreeNode
-
- All Known Subinterfaces:
FSBNode
,GTreeRootNode
- All Known Implementing Classes:
AbstractGTreeNode
,AbstractGTreeRootNode
,DomainFileNode
,DomainFolderNode
,DomainFolderRootNode
,FSBDirNode
,FSBFileNode
,FSBRootNode
,GTreeLazyNode
,GTreeSlowLoadingNode
,InProgressGTreeNode
,InProgressGTreeRootNode
,NoProjectNode
public interface GTreeNode extends java.lang.Comparable<GTreeNode>, java.lang.Iterable<GTreeNode>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addNode(int index, GTreeNode node)
Adds the given node at the given index as a child to this node.void
addNode(GTreeNode node)
Adds the given node as a child to this node.void
clearFilter()
Removes any filtering on this subtree.void
dispose()
Disposes this node and all of its descendants.void
filter(GTreeFilter filter, TaskMonitor monitor, int min, int max)
Applies the the given filter to the subtree of this node.void
fireNodeChanged(GTreeNode parentNode, GTreeNode node)
Notifies the tree that a node has changed.void
fireNodeStructureChanged(GTreeNode node)
Notifies the tree that the node has different children.int
getAllChildCount()
Returns the number of all children of this node.java.util.List<GTreeNode>
getAllChildren()
Returns the list of children including those that have been filtered out.GTreeNode
getChild(int index)
Returns the child node at the given index.GTreeNode
getChild(java.lang.String name)
Returns the child node of this node with the given name.int
getChildCount()
Returns the number of visible children of this node.java.util.List<GTreeNode>
getChildren()
Returns all of the visible children of this node.javax.swing.Icon
getIcon(boolean expanded)
Returns the Icon to be displayed for this node in the tree.int
getIndexInParent()
Returns the index of this node within its parent node.int
getIndexOfChild(GTreeNode node)
Returns the index of the given node within this node.int
getLeafCount()
Returns the total number of leaf nodes in the subtree from this node.java.lang.String
getName()
Returns the name of the node to be displayed in the treeint
getNodeCount()
Returns the total number of nodes in the subtree rooted at this node.GTreeNode
getParent()
Returns the parent of this node.GTreeRootNode
getRoot()
Returns the rootNode for this tree or null if there is no parent path to a GTRootNode.java.lang.String
getToolTip()
Returns the string to be displayed as a tooltip when the user hovers the mouse on this node in the tree.GTree
getTree()
Returns the GTTree that contains this node.javax.swing.tree.TreePath
getTreePath()
Returns the TreePath for this node.boolean
isAncestor(GTreeNode node)
Returns true if the given node is a child of this node or one of its children.boolean
isEditable()
Returns true if this node is allowed to be edited in the tree.boolean
isFilteredOut()
Returns true if this node is filtered and not in the current viewboolean
isInProgress()
Returns true if this node is currently being modified.boolean
isLeaf()
Returns true if this node never has children.void
removeAll()
Removes all children from this node.void
removeNode(GTreeNode node)
Remove the given node from this node.void
setChildren(java.util.List<GTreeNode> childList)
Sets the children on this node.void
valueChanged(java.lang.Object newValue)
Notification method called when a cell editor completes editing to notify this node that its value has changed.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of the node to be displayed in the tree- Returns:
- the name of the node.
-
getIcon
javax.swing.Icon getIcon(boolean expanded)
Returns the Icon to be displayed for this node in the tree.- Parameters:
expanded
- true if the node is expanded.- Returns:
- the icon to be displayed for this node in the tree.
-
getToolTip
java.lang.String getToolTip()
Returns the string to be displayed as a tooltip when the user hovers the mouse on this node in the tree.- Returns:
- the tooltip to be displayed.
-
isLeaf
boolean isLeaf()
Returns true if this node never has children.- Returns:
- true if this node is a leaf.
-
addNode
void addNode(GTreeNode node)
Adds the given node as a child to this node.- Parameters:
node
- the node to add as a child.
-
addNode
void addNode(int index, GTreeNode node)
Adds the given node at the given index as a child to this node.- Parameters:
index
- the index to place the node.node
- the node to add as a child of this node.
-
getAllChildren
java.util.List<GTreeNode> getAllChildren()
Returns the list of children including those that have been filtered out.- Returns:
- the list of all children of this node including those that are filtered out.
-
getChildren
java.util.List<GTreeNode> getChildren()
Returns all of the visible children of this node. If there are filtered nodes, then they will not be returned.- Returns:
- all of the visible children of this node. If there are filtered nodes, then they will not be returned.
-
getChildCount
int getChildCount()
Returns the number of visible children of this node. Does not include nodes that are current filtered out.- Returns:
- the number of visible children of this node.
-
getAllChildCount
int getAllChildCount()
Returns the number of all children of this node. Includes nodes that are currently filtered out.- Returns:
- the number of all
-
getChild
GTreeNode getChild(java.lang.String name)
Returns the child node of this node with the given name.- Parameters:
name
- the name of the child to be returned.- Returns:
- the child with the given name.
-
getChild
GTreeNode getChild(int index)
Returns the child node at the given index. Returns null if the index is out of bounds.- Parameters:
index
- the index of the child to be returned.- Returns:
- the child at the given index.
-
getNodeCount
int getNodeCount()
Returns the total number of nodes in the subtree rooted at this node. Leaf nodes return 1.- Returns:
- the number of nodes from this node downward.
-
getLeafCount
int getLeafCount()
Returns the total number of leaf nodes in the subtree from this node.- Returns:
- the total number of leaf nodes in the subtree from this node.
-
getIndexInParent
int getIndexInParent()
Returns the index of this node within its parent node.- Returns:
- the index of this node within its parent node.
-
getIndexOfChild
int getIndexOfChild(GTreeNode node)
Returns the index of the given node within this node. -1 is returned if the node is not a child of this node.- Parameters:
node
- whose index we want.- Returns:
- the index of the given node within this node.
-
getTreePath
javax.swing.tree.TreePath getTreePath()
Returns the TreePath for this node.- Returns:
- the TreePath for this node.
-
removeAll
void removeAll()
Removes all children from this node. The children nodes will be disposed.
-
removeNode
void removeNode(GTreeNode node)
Remove the given node from this node.- Parameters:
node
- the to be removed.
-
setChildren
void setChildren(java.util.List<GTreeNode> childList)
Sets the children on this node. Any existing current children will be dispose.- Parameters:
childList
- this list of nodes to be set as children of this node.
-
isAncestor
boolean isAncestor(GTreeNode node)
Returns true if the given node is a child of this node or one of its children.- Parameters:
node
- the potential descendant node to check
-
filter
void filter(GTreeFilter filter, TaskMonitor monitor, int min, int max) throws CancelledException
Applies the the given filter to the subtree of this node. Nodes will be filtered out if the node and all of its descendants are not accepted by the filter. In other words, a node will remain if it or any of its descendants are accepted by the filter.- Parameters:
filter
- the filter being applied.monitor
- a TaskMonitor for tracking the progress and cancelling.min
- the min value to use for the progress bar for this subtree.max
- the max value to use for the progress bar for this subtree.- Throws:
CancelledException
- if the operation is cancelled via the TaskMonitor.
-
clearFilter
void clearFilter()
Removes any filtering on this subtree.
-
isFilteredOut
boolean isFilteredOut()
Returns true if this node is filtered and not in the current view
-
valueChanged
void valueChanged(java.lang.Object newValue)
Notification method called when a cell editor completes editing to notify this node that its value has changed. If you override this method you must also overrideisEditable()
.- Parameters:
newValue
- the new value provided by the cell editor.- See Also:
isEditable()
-
isEditable
boolean isEditable()
Returns true if this node is allowed to be edited in the tree. You must override this method to allow a node to be edited. You must also overridevalueChanged(Object)
to handle the result of the edit.- Returns:
- true if this node is allowed to be edited in the tree.
- See Also:
valueChanged(Object)
-
getRoot
GTreeRootNode getRoot()
Returns the rootNode for this tree or null if there is no parent path to a GTRootNode.- Returns:
- the rootNode for this tree.
-
getTree
GTree getTree()
Returns the GTTree that contains this node.- Returns:
- the GTTree that contains this node.
-
dispose
void dispose()
Disposes this node and all of its descendants.
-
isInProgress
boolean isInProgress()
Returns true if this node is currently being modified.- Returns:
- true if this node is currently being modified.
-
fireNodeStructureChanged
void fireNodeStructureChanged(GTreeNode node)
Notifies the tree that the node has different children. This method- Parameters:
node
- the node that has changed.
-
fireNodeChanged
void fireNodeChanged(GTreeNode parentNode, GTreeNode node)
Notifies the tree that a node has changed.- Parameters:
parentNode
- the node that contains the node that was changed.node
- the that changed.
-
getParent
GTreeNode getParent()
Returns the parent of this node.- Returns:
- the parent of this node.
-
-