|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jgraph.example.JGraphGraphFactory
public class JGraphGraphFactory
A helper class that creates graphs. Currently supports tree graphs and a random graph where all edges are connected at least once
| Nested Class Summary | |
|---|---|
class |
JGraphGraphFactory.FactoryConfigDialog
Simple Dialog that configures how many nodes and edges the graph factory is to create |
| Field Summary | |
|---|---|
static int |
FLOW
|
static int |
FULLY_CONNECTED
|
static int |
RANDOM_CONNECTED
|
static int |
TREE
|
| Constructor Summary | |
|---|---|
JGraphGraphFactory()
Default constructor |
|
| Method Summary | |
|---|---|
static void |
center(java.awt.Window wnd)
|
int |
getMaxNodesPerTreeLevel()
|
int |
getNumEdges()
|
int |
getNumNodes()
|
static void |
insert(org.jgraph.graph.GraphModel model,
java.lang.Object[] cells)
Inserts the specified cells into the graph model. |
static void |
insert(org.jgraph.graph.GraphModel model,
java.lang.Object[] cells,
java.util.Map nested,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm)
Variant of the insert method that allows to pass a default connection set and parent map and nested map. |
void |
insertConnectedGraphSampleData(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
clears the graph and inserts a random graph. |
void |
insertFullyConnectedGraphSampleData(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
clears the graph and inserts a fully connected graph. |
void |
insertGraph(org.jgraph.JGraph graph,
int graphType,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
Entry method for inserting a sample graph |
void |
insertSampleFlowGraph(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
clears the graph and inserts a fully connected graph. |
java.lang.Object |
insertTreeSampleData(org.jgraph.graph.GraphModel model,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
clears the graph and inserts a random tree. |
java.lang.Object |
insertTreeSampleData(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
clears the graph and inserts a random tree. |
boolean |
isInsertIntoModel()
|
void |
setInsertIntoModel(boolean insertIntoModel)
|
void |
setMaxNodesPerTreeLevel(int maxNodesPerTreeLevel)
|
void |
setNumEdges(int numEdges)
|
void |
setNumNodes(int numNodes)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FULLY_CONNECTED
public static final int RANDOM_CONNECTED
public static final int TREE
public static final int FLOW
| Constructor Detail |
|---|
public JGraphGraphFactory()
| Method Detail |
|---|
public void insertGraph(org.jgraph.JGraph graph,
int graphType,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
graph - the JGraph to perform the insert ongraphType - which sample graph type is to be inserteddefaultVertexAttributes - the default attributes to use for verticesdefaultEdgeAttributes - the default attributes to use for edges
public java.lang.Object insertTreeSampleData(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
graph - the JGraph to perform the insert ondefaultVertexAttributes - the default attributes to use for verticesdefaultEdgeAttributes - the default attributes to use for edges
public java.lang.Object insertTreeSampleData(org.jgraph.graph.GraphModel model,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
model - the model to perform the insert ondefaultVertexAttributes - the default attributes to use for verticesdefaultEdgeAttributes - the default attributes to use for edges
public void insertConnectedGraphSampleData(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
graph - the JGraph instance to act upondefaultVertexAttributes - the default attributes to use for verticesdefaultEdgeAttributes - the default attributes to use for edges
public void insertFullyConnectedGraphSampleData(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
graph - the JGraph instance to act upondefaultVertexAttributes - the default attributes to use for verticesdefaultEdgeAttributes - the default attributes to use for edges
public void insertSampleFlowGraph(org.jgraph.JGraph graph,
java.util.Map defaultVertexAttributes,
java.util.Map defaultEdgeAttributes)
graph - the JGraph instance to act upondefaultVertexAttributes - the default attributes to use for verticesdefaultEdgeAttributes - the default attributes to use for edges
public static void insert(org.jgraph.graph.GraphModel model,
java.lang.Object[] cells)
Object source = graph.getDefaultPortForCell(sourceVertex).getCell();
Object target = graph.getDefaultPortForCell(targetVertex).getCell();
DefaultEdge edge = new DefaultEdge("Hello, world!");
edge.setSource(source);
edge.setTarget(target);
Map attrs = edge.getAttributes();
GraphConstants.setLineEnd(attrs, GraphConstants.ARROW_TECHNICAL);
graph.getGraphLayoutCache().insert(edge);
public static void insert(org.jgraph.graph.GraphModel model,
java.lang.Object[] cells,
java.util.Map nested,
org.jgraph.graph.ConnectionSet cs,
org.jgraph.graph.ParentMap pm)
public boolean isInsertIntoModel()
public void setInsertIntoModel(boolean insertIntoModel)
insertIntoModel - The insertIntoModel to set.public int getNumEdges()
public void setNumEdges(int numEdges)
numEdges - The numEdges to set.public int getNumNodes()
public void setNumNodes(int numNodes)
numNodes - The numNodes to set.public int getMaxNodesPerTreeLevel()
public void setMaxNodesPerTreeLevel(int maxNodesPerTreeLevel)
maxNodesPerTreeLevel - The maxNodesPerTreeLevel to set.public static void center(java.awt.Window wnd)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||