JHotDraw 7.4.1

org.jhotdraw.draw.connector
Class StickyRectangleConnector

java.lang.Object
  extended by org.jhotdraw.draw.connector.AbstractConnector
      extended by org.jhotdraw.draw.connector.ChopRectangleConnector
          extended by org.jhotdraw.draw.connector.StickyRectangleConnector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Connector, DOMStorable

public class StickyRectangleConnector
extends ChopRectangleConnector

A StickyRectangleConnector locates connection points by choping the connection between the centers of the two figures at the display box.

The location of the connection point is computed once, when the user connects the figure. Moving the figure around will not change the location.

Version:
$Id: StickyRectangleConnector.java 604 2010-01-09 12:00:29Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Constructor Summary
StickyRectangleConnector()
          Creates a new instance.
StickyRectangleConnector(Figure owner)
           
StickyRectangleConnector(Figure owner, java.awt.geom.Point2D.Double p)
           
 
Method Summary
protected  java.awt.geom.Point2D.Double chop(Figure target, java.awt.geom.Point2D.Double from)
           
 void draw(java.awt.Graphics2D g)
          Draws the connector.
 java.awt.geom.Point2D.Double getAnchor()
          Gets the anchor of the connector.
 double getAngle()
           
 java.lang.String getParameters()
           
 void read(DOMInput in)
           
 void setAngle(float angle)
           
 void updateAnchor(java.awt.geom.Point2D.Double p)
          Updates the anchor of the connector.
 void write(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.connector.ChopRectangleConnector
findEnd, findStart
 
Methods inherited from class org.jhotdraw.draw.connector.AbstractConnector
clone, contains, findPoint, getBounds, getConnectorTarget, getDrawingArea, getOwner, isConnectToDecorator, setConnectToDecorator, setOwner, updateEndLocation, updateStartLocation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StickyRectangleConnector

public StickyRectangleConnector()
Creates a new instance. Only used for storable.


StickyRectangleConnector

public StickyRectangleConnector(Figure owner)

StickyRectangleConnector

public StickyRectangleConnector(Figure owner,
                                java.awt.geom.Point2D.Double p)
Method Detail

draw

public void draw(java.awt.Graphics2D g)
Description copied from interface: Connector
Draws the connector.

Specified by:
draw in interface Connector
Overrides:
draw in class AbstractConnector

setAngle

public void setAngle(float angle)

getAngle

public double getAngle()

updateAnchor

public void updateAnchor(java.awt.geom.Point2D.Double p)
Description copied from interface: Connector
Updates the anchor of the connector. This method is called when the user manually changes the end point of the ConnectionFigure. The Connector uses this as a hint for choosing a new anchor position.

Specified by:
updateAnchor in interface Connector
Overrides:
updateAnchor in class AbstractConnector

getAnchor

public java.awt.geom.Point2D.Double getAnchor()
Description copied from interface: Connector
Gets the anchor of the connector. This is a point at the center or at the bounds of the figure, where the start or the end point will most likely be attached. The purpose of this method is to give the user a hint, where the connector will most likely be attached to the owner of the connector.

Specified by:
getAnchor in interface Connector
Overrides:
getAnchor in class AbstractConnector

chop

protected java.awt.geom.Point2D.Double chop(Figure target,
                                            java.awt.geom.Point2D.Double from)
Overrides:
chop in class ChopRectangleConnector

getParameters

public java.lang.String getParameters()

read

public void read(DOMInput in)
          throws java.io.IOException
Specified by:
read in interface DOMStorable
Overrides:
read in class AbstractConnector
Throws:
java.io.IOException

write

public void write(DOMOutput out)
           throws java.io.IOException
Specified by:
write in interface DOMStorable
Overrides:
write in class AbstractConnector
Throws:
java.io.IOException

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.