com.horstmann.violet.framework
Class RectangularNode

java.lang.Object
  extended by com.horstmann.violet.framework.AbstractNode
      extended by com.horstmann.violet.framework.RectangularNode
All Implemented Interfaces:
Node, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ActorNode, CallNode, CircularStateNode, ClassNode, FieldNode, ImplicitParameterNode, InterfaceNode, NoteNode, ObjectNode, PackageNode, StateNode, UseCaseNode

public abstract class RectangularNode
extends AbstractNode

A node that has a rectangular shape.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.horstmann.violet.framework.AbstractNode
SHADOW_GAP
 
Constructor Summary
RectangularNode()
           
 
Method Summary
 java.lang.Object clone()
           
 boolean contains(java.awt.geom.Point2D p)
          Tests whether the node contains a point.
 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.
 java.awt.Shape getShape()
           
 void layout(Graph g, java.awt.Graphics2D g2, Grid grid)
          Lays out the node and its children.
 void setBounds(java.awt.geom.Rectangle2D newBounds)
           
 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, draw, getChildren, getParent, removeChild, removeEdge, removeNode, setParent, setPersistenceDelegate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangularNode

public RectangularNode()
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface Node
Overrides:
clone in class AbstractNode

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

setBounds

public void setBounds(java.awt.geom.Rectangle2D newBounds)

layout

public void layout(Graph g,
                   java.awt.Graphics2D g2,
                   Grid grid)
Description copied from interface: Node
Lays out the node and its children.

Specified by:
layout in interface Node
Overrides:
layout in class AbstractNode
Parameters:
g - the ambient graph
g2 - the graphics context
grid - the grid to snap to

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

getShape

public java.awt.Shape getShape()
Overrides:
getShape in class AbstractNode
Returns:
the shape to be used for computing the drop shadow