com.horstmann.violet
Class StateTransitionEdge

java.lang.Object
  extended by com.horstmann.violet.framework.ShapeEdge
      extended by com.horstmann.violet.StateTransitionEdge
All Implemented Interfaces:
Edge, java.io.Serializable, java.lang.Cloneable

public class StateTransitionEdge
extends ShapeEdge

A curved edge for a state transition in a state diagram.

See Also:
Serialized Form

Constructor Summary
StateTransitionEdge()
           
 
Method Summary
 java.lang.Object clone()
           
 void connect(Node s, Node e)
          Connect this edge to two nodes.
 void draw(java.awt.Graphics2D g2)
          Draw the edge.
 java.awt.geom.Rectangle2D getBounds(java.awt.Graphics2D g2)
          Gets the smallest rectangle that bounds this edge.
 java.awt.geom.Line2D getConnectionPoints()
          Gets the points at which this edge is connected to its nodes.
 Node getEnd()
          Gets the ending node.
 java.lang.String getLabel()
          Gets the label property value.
 java.awt.Shape getShape()
          Returns the path that should be stroked to draw this edge.
 Node getStart()
          Gets the starting node.
 void setLabel(java.lang.String newValue)
          Sets the label property value.
 
Methods inherited from class com.horstmann.violet.framework.ShapeEdge
contains
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateTransitionEdge

public StateTransitionEdge()
Method Detail

setLabel

public void setLabel(java.lang.String newValue)
Sets the label property value.

Parameters:
newValue - the new value

getLabel

public java.lang.String getLabel()
Gets the label property value.

Returns:
the current value

draw

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

Parameters:
g2 - the graphics context

getShape

public java.awt.Shape getShape()
Description copied from class: ShapeEdge
Returns the path that should be stroked to draw this edge. The path does not include arrow tips or labels.

Specified by:
getShape in class ShapeEdge
Returns:
a path along the edge

getBounds

public java.awt.geom.Rectangle2D getBounds(java.awt.Graphics2D g2)
Description copied from interface: Edge
Gets the smallest rectangle that bounds this edge. The bounding rectangle contains all labels.

Specified by:
getBounds in interface Edge
Overrides:
getBounds in class ShapeEdge
Returns:
the bounding rectangle

getConnectionPoints

public java.awt.geom.Line2D getConnectionPoints()
Description copied from interface: Edge
Gets the points at which this edge is connected to its nodes.

Specified by:
getConnectionPoints in interface Edge
Returns:
a line joining the two connection points

clone

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

connect

public void connect(Node s,
                    Node e)
Description copied from interface: Edge
Connect this edge to two nodes.

Specified by:
connect in interface Edge
Parameters:
s - the starting node
e - the ending node

getStart

public Node getStart()
Description copied from interface: Edge
Gets the starting node.

Specified by:
getStart in interface Edge
Returns:
the starting node

getEnd

public Node getEnd()
Description copied from interface: Edge
Gets the ending node.

Specified by:
getEnd in interface Edge
Returns:
the ending node