|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.horstmann.violet.framework.AbstractNode
public abstract class AbstractNode
A class that supplies convenience implementations for a number of methods in the Node interface
Field Summary | |
---|---|
static int |
SHADOW_GAP
|
Constructor Summary | |
---|---|
AbstractNode()
Constructs a node with no parents or children. |
Method Summary | |
---|---|
void |
addChild(int index,
Node node)
Adds a child node. |
void |
addChild(Node 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()
|
void |
draw(java.awt.Graphics2D g2)
Draw the node. |
java.util.List |
getChildren()
Gets the children of this node. |
Node |
getParent()
Gets the parent of this node. |
java.awt.Shape |
getShape()
|
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 e)
Notifies this node that a node is being removed. |
void |
setParent(Node node)
Sets the parent of this node. |
static void |
setPersistenceDelegate(java.beans.Encoder encoder)
Adds a persistence delegate to a given encoder that encodes the child nodes of this node. |
void |
translate(double dx,
double dy)
Translates the node by a given amount |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.horstmann.violet.framework.Node |
---|
contains, getBounds, getConnectionPoint |
Field Detail |
---|
public static final int SHADOW_GAP
Constructor Detail |
---|
public AbstractNode()
Method Detail |
---|
public java.lang.Object clone()
clone
in interface Node
clone
in class java.lang.Object
public void translate(double dx, double dy)
Node
translate
in interface Node
dx
- the amount to translate in the x-directiondy
- the amount to translate in the y-directionpublic boolean addEdge(Edge e, java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
Node
addEdge
in interface Node
e
- the edge to add
public void removeEdge(Graph g, Edge e)
Node
removeEdge
in interface Node
g
- the ambient graphe
- the edge to be removedpublic void removeNode(Graph g, Node e)
Node
removeNode
in interface Node
g
- the ambient graphe
- the node to be removedpublic void layout(Graph g, java.awt.Graphics2D g2, Grid grid)
Node
layout
in interface Node
g
- the ambient graphg2
- the graphics contextgrid
- the grid to snap topublic boolean addNode(Node n, java.awt.geom.Point2D p)
Node
addNode
in interface Node
n
- the child nodep
- the point at which the node is being added
public Node getParent()
Node
getParent
in interface Node
public void setParent(Node node)
Node
setParent
in interface Node
node
- the parent node, or null if the node
has no parentpublic java.util.List getChildren()
Node
getChildren
in interface Node
public void addChild(int index, Node node)
Node
addChild
in interface Node
index
- the position at which to add the childnode
- the child node to addpublic void addChild(Node node)
public void removeChild(Node node)
Node
removeChild
in interface Node
node
- the child to remove.public void draw(java.awt.Graphics2D g2)
Node
draw
in interface Node
g2
- the graphics contextpublic java.awt.Shape getShape()
public static void setPersistenceDelegate(java.beans.Encoder encoder)
encoder
- the encoder to which to add the delegate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |