com.horstmann.violet.framework
Class SegmentedLineEdge

java.lang.Object
  extended by com.horstmann.violet.framework.ShapeEdge
      extended by com.horstmann.violet.framework.SegmentedLineEdge
All Implemented Interfaces:
Edge, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
CallEdge, ClassRelationshipEdge, ReturnEdge

public abstract class SegmentedLineEdge
extends ShapeEdge

An edge that is composed of multiple line segments

See Also:
Serialized Form

Constructor Summary
SegmentedLineEdge()
          Costructs an edge with no adornments.
 
Method Summary
 java.lang.Object clone()
           
 void connect(Node s, Node e)
          Connect this edge to two nodes.
 void draw(java.awt.Graphics2D g2)
          Draws 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.
 ArrowHead getEndArrowHead()
          Gets the end arrow head property
 java.lang.String getEndLabel()
          Gets the end label property
 LineStyle getLineStyle()
          Gets the line style property.
 java.lang.String getMiddleLabel()
          Gets the middle label property
abstract  java.util.ArrayList getPoints()
          Gets the corner points of this segmented line edge
 java.awt.Shape getShape()
          Returns the path that should be stroked to draw this edge.
 Node getStart()
          Gets the starting node.
 ArrowHead getStartArrowHead()
          Gets the start arrow head property
 java.lang.String getStartLabel()
          Gets the start label property
 void setEndArrowHead(ArrowHead newValue)
          Sets the end arrow head property
 void setEndLabel(java.lang.String newValue)
          Sets the end label property
 void setLineStyle(LineStyle newValue)
          Sets the line style property.
 void setMiddleLabel(java.lang.String newValue)
          Sets the middle label property
 void setStartArrowHead(ArrowHead newValue)
          Sets the start arrow head property
 void setStartLabel(java.lang.String newValue)
          Sets the start label property
 
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

SegmentedLineEdge

public SegmentedLineEdge()
Costructs an edge with no adornments.

Method Detail

setLineStyle

public void setLineStyle(LineStyle newValue)
Sets the line style property.

Parameters:
newValue - the new value

getLineStyle

public LineStyle getLineStyle()
Gets the line style property.

Returns:
the line style

setStartArrowHead

public void setStartArrowHead(ArrowHead newValue)
Sets the start arrow head property

Parameters:
newValue - the new value

getStartArrowHead

public ArrowHead getStartArrowHead()
Gets the start arrow head property

Returns:
the start arrow head style

setEndArrowHead

public void setEndArrowHead(ArrowHead newValue)
Sets the end arrow head property

Parameters:
newValue - the new value

getEndArrowHead

public ArrowHead getEndArrowHead()
Gets the end arrow head property

Returns:
the end arrow head style

setStartLabel

public void setStartLabel(java.lang.String newValue)
Sets the start label property

Parameters:
newValue - the new value

getStartLabel

public java.lang.String getStartLabel()
Gets the start label property

Returns:
the label at the start of the edge

setMiddleLabel

public void setMiddleLabel(java.lang.String newValue)
Sets the middle label property

Parameters:
newValue - the new value

getMiddleLabel

public java.lang.String getMiddleLabel()
Gets the middle label property

Returns:
the label at the middle of the edge

setEndLabel

public void setEndLabel(java.lang.String newValue)
Sets the end label property

Parameters:
newValue - the new value

getEndLabel

public java.lang.String getEndLabel()
Gets the end label property

Returns:
the label at the end of the edge

draw

public void draw(java.awt.Graphics2D g2)
Draws the edge.

Parameters:
g2 - the graphics context

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

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

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

getPoints

public abstract java.util.ArrayList getPoints()
Gets the corner points of this segmented line edge

Returns:
an array list of Point2D objects, containing the corner 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