|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Node
A node in a graph.
Method Summary | |
---|---|
void |
addChild(int index,
Node node)
Adds a child node. |
boolean |
addEdge(Edge e,
java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Adds an edge that originates at this node. |
boolean |
addNode(Node n,
java.awt.geom.Point2D p)
Adds a node as a child node to this node. |
java.lang.Object |
clone()
|
boolean |
contains(java.awt.geom.Point2D aPoint)
Tests whether the node contains a point. |
void |
draw(java.awt.Graphics2D g2)
Draw the node. |
java.awt.geom.Rectangle2D |
getBounds()
Get the bounding rectangle of the shape of this node |
java.util.List |
getChildren()
Gets the children of this node. |
java.awt.geom.Point2D |
getConnectionPoint(Direction d)
Get the best connection point to connect this node with another node. |
Node |
getParent()
Gets the parent of this node. |
void |
layout(Graph g,
java.awt.Graphics2D g2,
Grid grid)
Lays out the node and its children. |
void |
removeChild(Node node)
Removes a child node. |
void |
removeEdge(Graph g,
Edge e)
Notifies this node that an edge is being removed. |
void |
removeNode(Graph g,
Node n)
Notifies this node that a node is being removed. |
void |
setParent(Node node)
Sets the parent of this node. |
void |
translate(double dx,
double dy)
Translates the node by a given amount |
Method Detail |
---|
void draw(java.awt.Graphics2D g2)
g2
- the graphics contextvoid translate(double dx, double dy)
dx
- the amount to translate in the x-directiondy
- the amount to translate in the y-directionboolean contains(java.awt.geom.Point2D aPoint)
aPoint
- the point to test
java.awt.geom.Point2D getConnectionPoint(Direction d)
d
- the direction from the center
of the bounding rectangle towards the boundary
java.awt.geom.Rectangle2D getBounds()
boolean addEdge(Edge e, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
p
- the point that the user selected as
the starting point. This may be used as a hint if
edges are ordered.e
- the edge to add
boolean addNode(Node n, java.awt.geom.Point2D p)
n
- the child nodep
- the point at which the node is being added
void removeEdge(Graph g, Edge e)
g
- the ambient graphe
- the edge to be removedvoid removeNode(Graph g, Node n)
g
- the ambient graphn
- the node to be removedvoid layout(Graph g, java.awt.Graphics2D g2, Grid grid)
g
- the ambient graphg2
- the graphics contextgrid
- the grid to snap toNode getParent()
void setParent(Node node)
node
- the parent node, or null if the node
has no parentjava.util.List getChildren()
void addChild(int index, Node node)
index
- the position at which to add the childnode
- the child node to addvoid removeChild(Node node)
node
- the child to remove.java.lang.Object clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |