|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.horstmann.violet.framework.Graph
public abstract class Graph
A graph consisting of selectable nodes and edges.
| Constructor Summary | |
|---|---|
Graph()
Constructs a graph with no nodes or edges. |
|
| Method Summary | |
|---|---|
boolean |
add(Node n,
java.awt.geom.Point2D p)
Adds a node to the graph so that the top left corner of the bounding rectangle is at the given point. |
void |
addNode(Node n,
java.awt.geom.Point2D p)
Adds a node to this graph. |
void |
connect(Edge e,
Node start,
Node end)
Adds an edge to this graph. |
boolean |
connect(Edge e,
java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Adds an edge to the graph that joins the nodes containing the given points. |
void |
draw(java.awt.Graphics2D g2,
Grid g)
Draws the graph |
Edge |
findEdge(java.awt.geom.Point2D p)
Finds an edge containing the given point. |
Node |
findNode(java.awt.geom.Point2D p)
Finds a node containing the given point. |
java.awt.geom.Rectangle2D |
getBounds(java.awt.Graphics2D g2)
Gets the smallest rectangle enclosing the graph |
abstract Edge[] |
getEdgePrototypes()
Gets the edge types of a particular graph type. |
java.util.Collection |
getEdges()
Gets the edges of this graph. |
java.awt.geom.Rectangle2D |
getMinBounds()
|
abstract Node[] |
getNodePrototypes()
Gets the node types of a particular graph type. |
java.util.Collection |
getNodes()
Gets the nodes of this graph. |
void |
layout()
Causes the layout of the graph to be recomputed. |
void |
removeEdge(Edge e)
Removes an edge from the graph. |
void |
removeNode(Node n)
Removes a node and all edges that start or end with that node |
void |
setMinBounds(java.awt.geom.Rectangle2D newValue)
|
static void |
setPersistenceDelegate(java.beans.Encoder encoder)
Adds a persistence delegate to a given encoder that encodes the child nodes of this node. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Graph()
| Method Detail |
|---|
public boolean connect(Edge e,
java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
e - the edge to addp1 - a point in the starting nodep2 - a point in the ending node
public boolean add(Node n,
java.awt.geom.Point2D p)
n - the node to addp - the desired locationpublic Node findNode(java.awt.geom.Point2D p)
p - a point
public Edge findEdge(java.awt.geom.Point2D p)
p - a point
public void draw(java.awt.Graphics2D g2,
Grid g)
g2 - the graphics contextpublic void removeNode(Node n)
n - the node to removepublic void removeEdge(Edge e)
e - the edge to removepublic void layout()
public java.awt.geom.Rectangle2D getBounds(java.awt.Graphics2D g2)
g2 - the graphics context
public java.awt.geom.Rectangle2D getMinBounds()
public void setMinBounds(java.awt.geom.Rectangle2D newValue)
public abstract Node[] getNodePrototypes()
public abstract Edge[] getEdgePrototypes()
public static void setPersistenceDelegate(java.beans.Encoder encoder)
encoder - the encoder to which to add the delegatepublic java.util.Collection getNodes()
public java.util.Collection getEdges()
public void addNode(Node n,
java.awt.geom.Point2D p)
n - the node to addp - the desired location
public void connect(Edge e,
Node start,
Node end)
e - the edge to addstart - the start node of the edgeend - the end node of the edge
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||