Package jadex.base.gui.asynctree
Class AsyncSwingTreeModel
- java.lang.Object
-
- jadex.base.gui.asynctree.AsyncTreeModel
-
- jadex.base.gui.asynctree.AsyncSwingTreeModel
-
- All Implemented Interfaces:
javax.swing.tree.TreeModel
public class AsyncSwingTreeModel extends AsyncTreeModel implements javax.swing.tree.TreeModel
Tree model, which dynamically represents running components.
-
-
Field Summary
-
Fields inherited from class jadex.base.gui.asynctree.AsyncTreeModel
added, changed, listeners, nodelisteners, nodes, overlays, root, zombies
-
-
Constructor Summary
Constructors Constructor Description AsyncSwingTreeModel()
Create a component tree model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNode(ITreeNode node)
Add a node.void
addNodeHandler(INodeHandler overlay)
Add a node handler.void
addNodeListener(INodeListener listener)
Register a node listener.void
addTreeModelListener(javax.swing.event.TreeModelListener l)
Add a listener.java.util.List
buildTreePath(ITreeNode node)
Build a tree path to the given node.void
deregisterNode(ITreeNode node)
Remove a node registration.void
dispose()
Called when the tree is removed.void
fireNodeAdded(ITreeNode parent, ITreeNode child, int index)
Inform listeners that a node has been addedvoid
fireNodeChanged(ITreeNode node)
Inform listeners that a node has changed.void
fireNodeRemoved(ITreeNode parent, ITreeNode child, int index)
Inform listeners that a node has been removedvoid
fireNodesRemoved(ITreeNode parent, ITreeNode[] childs, int[] indices)
Inform listeners that a node has been removedvoid
fireTreeChanged(ITreeNode node)
Inform listeners that tree has changed from given node on.ISwingTreeNode
getAddedNode(java.lang.Object id)
Get a node by its id.ITreeNode
getChild(java.lang.Object parent, int index)
Get the given child of a node.int
getChildCount(java.lang.Object parent)
Get the number of children of a node.int
getIndexOfChild(java.lang.Object parent, java.lang.Object child)
Get the index of a child.ISwingTreeNode
getNode(java.lang.Object id)
Get a node by its id.INodeHandler[]
getNodeHandlers()
Get the node handlers.ISwingTreeNode
getNodeOrAddZombie(java.lang.Object id)
Get a node for removal.ITreeNode
getRoot()
Get the root node.boolean
isLeaf(java.lang.Object node)
Test if the node is a leaf.boolean
isZombieNode(java.lang.Object id)
Check, if a node is a zombie.void
registerNode(ITreeNode node)
Register a node.void
removeNodeListener(INodeListener listener)
Deregister a node listener.void
removeTreeModelListener(javax.swing.event.TreeModelListener l)
Remove a listener.void
removeZombieNode(ITreeNode node)
Remove a zombie node.void
setRoot(ITreeNode root)
Set the root node.void
valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
Edit the value of a node.-
Methods inherited from class jadex.base.gui.asynctree.AsyncTreeModel
addTreeModelListener, addZombieNode, removeTreeModelListener
-
-
-
-
Method Detail
-
getRoot
public ITreeNode getRoot()
Get the root node.- Specified by:
getRoot
in interfacejavax.swing.tree.TreeModel
- Overrides:
getRoot
in classAsyncTreeModel
-
getChild
public ITreeNode getChild(java.lang.Object parent, int index)
Get the given child of a node.- Specified by:
getChild
in interfacejavax.swing.tree.TreeModel
- Overrides:
getChild
in classAsyncTreeModel
-
getChildCount
public int getChildCount(java.lang.Object parent)
Get the number of children of a node.- Specified by:
getChildCount
in interfacejavax.swing.tree.TreeModel
- Overrides:
getChildCount
in classAsyncTreeModel
-
getIndexOfChild
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
Get the index of a child.- Specified by:
getIndexOfChild
in interfacejavax.swing.tree.TreeModel
- Overrides:
getIndexOfChild
in classAsyncTreeModel
-
isLeaf
public boolean isLeaf(java.lang.Object node)
Test if the node is a leaf.- Specified by:
isLeaf
in interfacejavax.swing.tree.TreeModel
- Overrides:
isLeaf
in classAsyncTreeModel
-
valueForPathChanged
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
Edit the value of a node.- Specified by:
valueForPathChanged
in interfacejavax.swing.tree.TreeModel
-
addTreeModelListener
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Add a listener.- Specified by:
addTreeModelListener
in interfacejavax.swing.tree.TreeModel
-
removeTreeModelListener
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Remove a listener.- Specified by:
removeTreeModelListener
in interfacejavax.swing.tree.TreeModel
-
setRoot
public void setRoot(ITreeNode root)
Set the root node.- Overrides:
setRoot
in classAsyncTreeModel
-
fireTreeChanged
public void fireTreeChanged(ITreeNode node)
Inform listeners that tree has changed from given node on.- Overrides:
fireTreeChanged
in classAsyncTreeModel
-
fireNodeChanged
public void fireNodeChanged(ITreeNode node)
Inform listeners that a node has changed.- Overrides:
fireNodeChanged
in classAsyncTreeModel
-
fireNodeRemoved
public void fireNodeRemoved(ITreeNode parent, ITreeNode child, int index)
Inform listeners that a node has been removed- Overrides:
fireNodeRemoved
in classAsyncTreeModel
-
fireNodesRemoved
public void fireNodesRemoved(ITreeNode parent, ITreeNode[] childs, int[] indices)
Inform listeners that a node has been removed- Overrides:
fireNodesRemoved
in classAsyncTreeModel
-
fireNodeAdded
public void fireNodeAdded(ITreeNode parent, ITreeNode child, int index)
Inform listeners that a node has been added- Overrides:
fireNodeAdded
in classAsyncTreeModel
-
buildTreePath
public java.util.List buildTreePath(ITreeNode node)
Build a tree path to the given node.- Overrides:
buildTreePath
in classAsyncTreeModel
- Parameters:
desc
- The node.- Returns:
- The path items.
-
registerNode
public void registerNode(ITreeNode node)
Register a node. Nodes can be registered for easy access.- Overrides:
registerNode
in classAsyncTreeModel
-
addNode
public void addNode(ITreeNode node)
Add a node. Informs listeners.- Overrides:
addNode
in classAsyncTreeModel
-
getNode
public ISwingTreeNode getNode(java.lang.Object id)
Get a node by its id.- Overrides:
getNode
in classAsyncTreeModel
-
getAddedNode
public ISwingTreeNode getAddedNode(java.lang.Object id)
Get a node by its id.- Overrides:
getAddedNode
in classAsyncTreeModel
-
deregisterNode
public void deregisterNode(ITreeNode node)
Remove a node registration.- Overrides:
deregisterNode
in classAsyncTreeModel
-
addNodeHandler
public void addNodeHandler(INodeHandler overlay)
Add a node handler.- Overrides:
addNodeHandler
in classAsyncTreeModel
-
getNodeHandlers
public INodeHandler[] getNodeHandlers()
Get the node handlers.- Overrides:
getNodeHandlers
in classAsyncTreeModel
-
addNodeListener
public void addNodeListener(INodeListener listener)
Register a node listener.- Overrides:
addNodeListener
in classAsyncTreeModel
-
removeNodeListener
public void removeNodeListener(INodeListener listener)
Deregister a node listener.- Overrides:
removeNodeListener
in classAsyncTreeModel
-
isZombieNode
public boolean isZombieNode(java.lang.Object id)
Check, if a node is a zombie.- Overrides:
isZombieNode
in classAsyncTreeModel
-
dispose
public void dispose()
Called when the tree is removed.- Overrides:
dispose
in classAsyncTreeModel
-
getNodeOrAddZombie
public ISwingTreeNode getNodeOrAddZombie(java.lang.Object id)
Description copied from class:AsyncTreeModel
Get a node for removal. Add a zombie node, if node does not exist.- Overrides:
getNodeOrAddZombie
in classAsyncTreeModel
-
removeZombieNode
public void removeZombieNode(ITreeNode node)
Remove a zombie node.- Overrides:
removeZombieNode
in classAsyncTreeModel
-
-