|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.tree.DefaultTreeModel
com.jgraph.example.GraphSelectionDemo
public class GraphSelectionDemo
With this example you'll learn how to listen to graph selection event, program graph selections and navigate accross the graph groups. This demo is is a bit like the GraphTreeModel demo. But this time, we synchronize the graph and the tree selection with two listeners. There are two issues actually. The first is that we should disable one listener when we programatically change its selection after the other listener receives a selection event (else we would fail in infinite loops). The other issue is navigating the graph and especially its group in order to get the equivalent tree selection. Also notice that ports should be handled like a special kind of group children.
Nested Class Summary | |
---|---|
static class |
GraphSelectionDemo.GraphModelTreeNode
See the GraphModelTree demo |
static class |
GraphSelectionDemo.MyMouseListener
Prevent from loosing the synchronisation after a graph element is dragged |
static class |
GraphSelectionDemo.SyncGraphSelectionListener
|
static class |
GraphSelectionDemo.SyncTreeSelectionListener
|
Constructor Summary | |
---|---|
GraphSelectionDemo(org.jgraph.graph.GraphModel model)
|
Method Summary | |
---|---|
void |
graphChanged(org.jgraph.event.GraphModelEvent e)
|
static void |
main(java.lang.String[] args)
|
Methods inherited from class javax.swing.tree.DefaultTreeModel |
---|
addTreeModelListener, asksAllowsChildren, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphSelectionDemo(org.jgraph.graph.GraphModel model)
Method Detail |
---|
public static void main(java.lang.String[] args)
public void graphChanged(org.jgraph.event.GraphModelEvent e)
graphChanged
in interface org.jgraph.event.GraphModelListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |