Package jadex.base.gui.asynctree
Class AbstractSwingTreeNode
- java.lang.Object
-
- jadex.base.gui.asynctree.AbstractTreeNode
-
- jadex.base.gui.asynctree.AbstractSwingTreeNode
-
- All Implemented Interfaces:
ISwingTreeNode
,ITreeNode
- Direct Known Subclasses:
ComponentTreeNode
,FileNode
,NFPropertyContainerNode
,NFPropertyNode
,ProvidedServiceInfoNode
,RemoteFileNode
,RequiredServiceNode
,RIDNode
,RootNode
,ServiceContainerNode
,ViewTreeNode
public abstract class AbstractSwingTreeNode extends AbstractTreeNode implements ISwingTreeNode
Basic node object.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.JTree
tree
The tree.-
Fields inherited from class jadex.base.gui.asynctree.AbstractTreeNode
childrenfuture, dirty, model, parent, recurse, searching
-
-
Constructor Summary
Constructors Constructor Description AbstractSwingTreeNode(ITreeNode parent, AsyncTreeModel model, javax.swing.JTree tree)
Create a node.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addChild(int index, ITreeNode node)
Add a child and update the tree.void
addChild(ITreeNode node)
Add a child and update the tree.boolean
equals(java.lang.Object obj)
Test if two nodes are equal.protected void
expandChildren(boolean dorecurse, java.util.List<ITreeNode> children)
java.util.List<ITreeNode>
getCachedChildren()
Get the cached children, i.e. do not start any background processes for updating the children.ISwingTreeNode
getChild(int index)
Get the given child.int
getChildCount()
Get the child count.IFuture<java.util.List<ITreeNode>>
getChildren()
Get the current children, i.e. start a new update process and provide the result as a future.int
getIndexOfChild(ITreeNode child)
Get the index of a child.AsyncSwingTreeModel
getModel()
Get the model.ISwingTreeNode
getParent()
Get the parent node.javax.swing.JComponent
getPropertiesComponent()
Get or create a component displaying the node properties.abstract javax.swing.Icon
getSwingIcon()
Get the icon for a node.javax.swing.JTree
getTree()
Get the tree.boolean
isLeaf()
Check if the node is a leaf.void
refresh(boolean recurse)
Refresh the node.void
removeChild(ITreeNode node)
Remove a child and update the tree.protected void
setChildren(java.util.List<? extends ITreeNode> newchildren)
Set the children.-
Methods inherited from class jadex.base.gui.asynctree.AbstractTreeNode
checkChildren, dispose, getIcon, getTooltipText, hashCode, hasProperties, removeAllChildren, searchChildren, setParent
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jadex.base.gui.asynctree.ITreeNode
dispose, getIcon, getId, getTooltipText, hasProperties
-
-
-
-
Constructor Detail
-
AbstractSwingTreeNode
public AbstractSwingTreeNode(ITreeNode parent, AsyncTreeModel model, javax.swing.JTree tree)
Create a node.
-
-
Method Detail
-
getParent
public ISwingTreeNode getParent()
Get the parent node.- Specified by:
getParent
in interfaceISwingTreeNode
- Specified by:
getParent
in interfaceITreeNode
- Overrides:
getParent
in classAbstractTreeNode
-
getChildCount
public int getChildCount()
Get the child count.- Specified by:
getChildCount
in interfaceITreeNode
- Overrides:
getChildCount
in classAbstractTreeNode
-
getChild
public ISwingTreeNode getChild(int index)
Get the given child.- Specified by:
getChild
in interfaceISwingTreeNode
- Specified by:
getChild
in interfaceITreeNode
- Overrides:
getChild
in classAbstractTreeNode
-
getIndexOfChild
public int getIndexOfChild(ITreeNode child)
Get the index of a child.- Specified by:
getIndexOfChild
in interfaceITreeNode
- Overrides:
getIndexOfChild
in classAbstractTreeNode
-
isLeaf
public boolean isLeaf()
Check if the node is a leaf.- Specified by:
isLeaf
in interfaceITreeNode
- Overrides:
isLeaf
in classAbstractTreeNode
-
refresh
public void refresh(boolean recurse)
Refresh the node.- Specified by:
refresh
in interfaceITreeNode
- Overrides:
refresh
in classAbstractTreeNode
- Parameters:
recurse
- Recursively refresh subnodes, if true.
-
getCachedChildren
public java.util.List<ITreeNode> getCachedChildren()
Get the cached children, i.e. do not start any background processes for updating the children.- Specified by:
getCachedChildren
in interfaceITreeNode
- Overrides:
getCachedChildren
in classAbstractTreeNode
-
getChildren
public IFuture<java.util.List<ITreeNode>> getChildren()
Get the current children, i.e. start a new update process and provide the result as a future.- Specified by:
getChildren
in interfaceISwingTreeNode
- Specified by:
getChildren
in interfaceITreeNode
- Overrides:
getChildren
in classAbstractTreeNode
-
getPropertiesComponent
public javax.swing.JComponent getPropertiesComponent()
Get or create a component displaying the node properties. Only to be called if hasProperties() is true;- Specified by:
getPropertiesComponent
in interfaceISwingTreeNode
-
getSwingIcon
public abstract javax.swing.Icon getSwingIcon()
Get the icon for a node.- Specified by:
getSwingIcon
in interfaceISwingTreeNode
-
setChildren
protected void setChildren(java.util.List<? extends ITreeNode> newchildren)
Set the children. No children should be represented as empty list to avoid ongoing search for children.- Overrides:
setChildren
in classAbstractTreeNode
-
expandChildren
protected void expandChildren(boolean dorecurse, java.util.List<ITreeNode> children)
- Overrides:
expandChildren
in classAbstractTreeNode
-
getModel
public AsyncSwingTreeModel getModel()
Get the model.- Overrides:
getModel
in classAbstractTreeNode
-
getTree
public javax.swing.JTree getTree()
Get the tree.
-
addChild
public void addChild(int index, ITreeNode node)
Add a child and update the tree. Must be called from swing thread.- Overrides:
addChild
in classAbstractTreeNode
-
addChild
public void addChild(ITreeNode node)
Add a child and update the tree. Must be called from swing thread.- Overrides:
addChild
in classAbstractTreeNode
-
removeChild
public void removeChild(ITreeNode node)
Remove a child and update the tree. Must be called from swing thread.- Overrides:
removeChild
in classAbstractTreeNode
-
equals
public boolean equals(java.lang.Object obj)
Test if two nodes are equal.- Overrides:
equals
in classAbstractTreeNode
-
-