diva.canvas.connector
Class StraightConnector

java.lang.Object
  extended by diva.canvas.AbstractFigure
      extended by diva.canvas.connector.AbstractConnector
          extended by diva.canvas.connector.StraightConnector
All Implemented Interfaces:
CanvasComponent, Connector, Figure, VisibleComponent, UserObjectContainer

public class StraightConnector
extends AbstractConnector

A Connector that draws itself in a straight line.

Version:
$Id: StraightConnector.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie, Michael Shilman
Accepted Rating:
Red

Field Summary
private  java.awt.geom.Point2D _headPt
          The transformed positions of the start and end of the line, for use by the label positioning code.
private  java.awt.geom.Point2D _tailPt
           
 
Constructor Summary
StraightConnector(Site tail, Site head)
          Create a new straight connector between the given sites.
 
Method Summary
 void repositionLabel()
          Tell the connector to reposition its label if it has one.
 void route()
          Tell the connector to route itself between the current positions of the head and tail sites.
 void translate(double x, double y)
          Translate the connector.
 
Methods inherited from class diva.canvas.connector.AbstractConnector
getBounds, getDashArray, getHeadEnd, getHeadSite, getLabelFigure, getLineWidth, getShape, getStroke, getStrokePaint, getTailEnd, getTailSite, headMoved, hit, intersects, paint, reroute, setDashArray, setHeadEnd, setHeadSite, setLabelFigure, setLineWidth, setShape, setStroke, setStrokePaint, setTailEnd, setTailSite, tailMoved, transform
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface diva.canvas.Figure
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, setInteractor, setParent, setToolTipText
 
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, setVisible
 
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext, repaint, repaint
 
Methods inherited from interface diva.util.UserObjectContainer
getUserObject, setUserObject
 

Field Detail

_headPt

private java.awt.geom.Point2D _headPt
The transformed positions of the start and end of the line, for use by the label positioning code.


_tailPt

private java.awt.geom.Point2D _tailPt
Constructor Detail

StraightConnector

public StraightConnector(Site tail,
                         Site head)
Create a new straight connector between the given sites. The connector is drawn with a width of one and in black.

Method Detail

repositionLabel

public void repositionLabel()
Tell the connector to reposition its label if it has one. The label is currently only positioned at the center of the arc.

Specified by:
repositionLabel in class AbstractConnector

route

public void route()
Tell the connector to route itself between the current positions of the head and tail sites.

Specified by:
route in interface Connector
Specified by:
route in class AbstractConnector

translate

public void translate(double x,
                      double y)
Translate the connector. This method is implemented, since controllers may wish to translate connectors when the sites at both ends are moved the same distance.

Specified by:
translate in interface Figure
Specified by:
translate in class AbstractConnector