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.JTreetreeThe 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 voidaddChild(int index, ITreeNode node)Add a child and update the tree.voidaddChild(ITreeNode node)Add a child and update the tree.booleanequals(java.lang.Object obj)Test if two nodes are equal.protected voidexpandChildren(boolean dorecurse, java.util.List<ITreeNode> children)java.util.List<ITreeNode>getCachedChildren()Get the cached children, i.e.ISwingTreeNodegetChild(int index)Get the given child.intgetChildCount()Get the child count.IFuture<java.util.List<ITreeNode>>getChildren()Get the current children, i.e.intgetIndexOfChild(ITreeNode child)Get the index of a child.AsyncSwingTreeModelgetModel()Get the model.ISwingTreeNodegetParent()Get the parent node.javax.swing.JComponentgetPropertiesComponent()Get or create a component displaying the node properties.abstract javax.swing.IcongetSwingIcon()Get the icon for a node.javax.swing.JTreegetTree()Get the tree.booleanisLeaf()Check if the node is a leaf.voidrefresh(boolean recurse)Refresh the node.voidremoveChild(ITreeNode node)Remove a child and update the tree.protected voidsetChildren(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:
getParentin interfaceISwingTreeNode- Specified by:
getParentin interfaceITreeNode- Overrides:
getParentin classAbstractTreeNode
-
getChildCount
public int getChildCount()
Get the child count.- Specified by:
getChildCountin interfaceITreeNode- Overrides:
getChildCountin classAbstractTreeNode
-
getChild
public ISwingTreeNode getChild(int index)
Get the given child.- Specified by:
getChildin interfaceISwingTreeNode- Specified by:
getChildin interfaceITreeNode- Overrides:
getChildin classAbstractTreeNode
-
getIndexOfChild
public int getIndexOfChild(ITreeNode child)
Get the index of a child.- Specified by:
getIndexOfChildin interfaceITreeNode- Overrides:
getIndexOfChildin classAbstractTreeNode
-
isLeaf
public boolean isLeaf()
Check if the node is a leaf.- Specified by:
isLeafin interfaceITreeNode- Overrides:
isLeafin classAbstractTreeNode
-
refresh
public void refresh(boolean recurse)
Refresh the node.- Specified by:
refreshin interfaceITreeNode- Overrides:
refreshin 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:
getCachedChildrenin interfaceITreeNode- Overrides:
getCachedChildrenin 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:
getChildrenin interfaceISwingTreeNode- Specified by:
getChildrenin interfaceITreeNode- Overrides:
getChildrenin 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:
getPropertiesComponentin interfaceISwingTreeNode
-
getSwingIcon
public abstract javax.swing.Icon getSwingIcon()
Get the icon for a node.- Specified by:
getSwingIconin 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:
setChildrenin classAbstractTreeNode
-
expandChildren
protected void expandChildren(boolean dorecurse, java.util.List<ITreeNode> children)- Overrides:
expandChildrenin classAbstractTreeNode
-
getModel
public AsyncSwingTreeModel getModel()
Get the model.- Overrides:
getModelin 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:
addChildin classAbstractTreeNode
-
addChild
public void addChild(ITreeNode node)
Add a child and update the tree. Must be called from swing thread.- Overrides:
addChildin classAbstractTreeNode
-
removeChild
public void removeChild(ITreeNode node)
Remove a child and update the tree. Must be called from swing thread.- Overrides:
removeChildin classAbstractTreeNode
-
equals
public boolean equals(java.lang.Object obj)
Test if two nodes are equal.- Overrides:
equalsin classAbstractTreeNode
-
-