|
||||||||||
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.GraphTreeModel
public class GraphTreeModel
JGraph gives you the opportunity to define whatever graph model you want. Since trees are only special cases of graph, we will here show a fairly simple new graph model: a tree model. So we build a new type inheriting most of its behavior from DefaultTreeModel and adding the minimal requirements to be a GraphModel also. To achieve this, we hold a GraphModel reference in GraphModelTreeNode which implements TreeModel and we use GraphModelTreeNode as the TreeModel to construct the DefaultTreeModel. Finally, don't believe graph models are limited to trees. Rather the GraphModel interface provides you lots of hooks to detail your model. For instance you could define custome implemetations to decide wether or not some connections are allowed...
Nested Class Summary | |
---|---|
static class |
GraphTreeModel.GraphModelTreeNode
|
Constructor Summary | |
---|---|
GraphTreeModel(org.jgraph.graph.GraphModel model)
Look how we wrapp the GraphModel into a GraphModelTreeNode to construct the GraphTreeModel and satisfy both the GraphModel and the TreeModel interfaces. |
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 GraphTreeModel(org.jgraph.graph.GraphModel model)
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 |