Package jadex.commons.gui
Class TreeExpansionHandler
- java.lang.Object
-
- jadex.commons.gui.TreeExpansionHandler
-
- All Implemented Interfaces:
java.util.EventListener
,javax.swing.event.TreeExpansionListener
,javax.swing.event.TreeModelListener
- Direct Known Subclasses:
ExpansionHandler
public class TreeExpansionHandler extends java.lang.Object implements javax.swing.event.TreeExpansionListener, javax.swing.event.TreeModelListener
The tree expansion handler assures that tree nodes stay expanded, even when their last child is removed, and then new child nodes are added. Swing doesn't do this on its own, grrr.
-
-
Constructor Summary
Constructors Constructor Description TreeExpansionHandler(javax.swing.JTree tree)
Create a tree expansion handler for a given tree.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IFuture
handlePath(javax.swing.tree.TreePath path)
Check if an action (e.g.void
handleTreeStructureChanged(javax.swing.event.TreeModelEvent event, javax.swing.tree.TreePath root, int i)
Handle each node in the subtree.boolean
isExpanded(javax.swing.tree.TreePath path)
Test if a path is expanded or should be.static boolean
isTreeExpanded(javax.swing.JTree tree, javax.swing.tree.TreePath path)
Test if a tree node is expanded or should be.void
treeCollapsed(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree has been collapsed.void
treeExpanded(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree has been expanded.void
treeNodesChanged(javax.swing.event.TreeModelEvent event)
Invoked after a node (or a set of siblings) has changed in some way.void
treeNodesInserted(javax.swing.event.TreeModelEvent event)
Invoked after nodes have been inserted into the tree.void
treeNodesRemoved(javax.swing.event.TreeModelEvent event)
Invoked after nodes have been removed from the tree.void
treeStructureChanged(javax.swing.event.TreeModelEvent event)
Invoked after the tree has drastically changed structure from a given node down.
-
-
-
Method Detail
-
treeExpanded
public void treeExpanded(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree has been expanded.- Specified by:
treeExpanded
in interfacejavax.swing.event.TreeExpansionListener
-
treeCollapsed
public void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree has been collapsed.- Specified by:
treeCollapsed
in interfacejavax.swing.event.TreeExpansionListener
-
treeNodesChanged
public void treeNodesChanged(javax.swing.event.TreeModelEvent event)
Invoked after a node (or a set of siblings) has changed in some way.- Specified by:
treeNodesChanged
in interfacejavax.swing.event.TreeModelListener
-
treeNodesInserted
public void treeNodesInserted(javax.swing.event.TreeModelEvent event)
Invoked after nodes have been inserted into the tree.- Specified by:
treeNodesInserted
in interfacejavax.swing.event.TreeModelListener
-
treeNodesRemoved
public void treeNodesRemoved(javax.swing.event.TreeModelEvent event)
Invoked after nodes have been removed from the tree.- Specified by:
treeNodesRemoved
in interfacejavax.swing.event.TreeModelListener
-
treeStructureChanged
public void treeStructureChanged(javax.swing.event.TreeModelEvent event)
Invoked after the tree has drastically changed structure from a given node down.- Specified by:
treeStructureChanged
in interfacejavax.swing.event.TreeModelListener
-
handleTreeStructureChanged
public void handleTreeStructureChanged(javax.swing.event.TreeModelEvent event, javax.swing.tree.TreePath root, int i)
Handle each node in the subtree. Wait for node to be expanded before continuing to inlcude subnodes.
-
handlePath
protected IFuture handlePath(javax.swing.tree.TreePath path)
Check if an action (e.g. expand) has to be performed on the path.
-
isExpanded
public boolean isExpanded(javax.swing.tree.TreePath path)
Test if a path is expanded or should be.
-
isTreeExpanded
public static boolean isTreeExpanded(javax.swing.JTree tree, javax.swing.tree.TreePath path)
Test if a tree node is expanded or should be.
-
-