com.horstmann.violet
Class PointNode

java.lang.Object
  extended by com.horstmann.violet.framework.AbstractNode
      extended by com.horstmann.violet.PointNode
All Implemented Interfaces:
Node, java.io.Serializable, java.lang.Cloneable

public class PointNode
extends AbstractNode

An inivisible node that is used in the toolbar to draw an edge, and in notes to serve as an end point of the node connector.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.horstmann.violet.framework.AbstractNode
SHADOW_GAP
 
Constructor Summary
PointNode()
          Constructs a point node with coordinates (0, 0)
 
Method Summary
 boolean contains(java.awt.geom.Point2D p)
          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.awt.geom.Point2D getConnectionPoint(Direction d)
          Get the best connection point to connect this node with another node.
 void translate(double dx, double dy)
          Translates the node by a given amount
 
Methods inherited from class com.horstmann.violet.framework.AbstractNode
addChild, addChild, addEdge, addNode, clone, getChildren, getParent, getShape, layout, removeChild, removeEdge, removeNode, setParent, setPersistenceDelegate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointNode

public PointNode()
Constructs a point node with coordinates (0, 0)

Method Detail

draw

public void draw(java.awt.Graphics2D g2)
Description copied from interface: Node
Draw the node.

Specified by:
draw in interface Node
Overrides:
draw in class AbstractNode
Parameters:
g2 - the graphics context

translate

public void translate(double dx,
                      double dy)
Description copied from interface: Node
Translates the node by a given amount

Specified by:
translate in interface Node
Overrides:
translate in class AbstractNode
Parameters:
dx - the amount to translate in the x-direction
dy - the amount to translate in the y-direction

contains

public boolean contains(java.awt.geom.Point2D p)
Description copied from interface: Node
Tests whether the node contains a point.

Parameters:
p - the point to test
Returns:
true if this node contains aPoint

getBounds

public java.awt.geom.Rectangle2D getBounds()
Description copied from interface: Node
Get the bounding rectangle of the shape of this node

Returns:
the bounding rectangle

getConnectionPoint

public java.awt.geom.Point2D getConnectionPoint(Direction d)
Description copied from interface: Node
Get the best connection point to connect this node with another node. This should be a point on the boundary of the shape of this node.

Parameters:
d - the direction from the center of the bounding rectangle towards the boundary
Returns:
the recommended connection point