JHotDraw 7.0.6

org.jhotdraw.draw
Class StickyChopConnector

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

public class StickyChopConnector
extends ChopBoxConnector

A StickyChopConnector locates connection Points by choping the connection between the centers of the two figures at the display box. The location of the connection Point2D.Double is computed once, when the user connects the figure. Moving the figure around will not change the location.

See Also:
Serialized Form

Constructor Summary
StickyChopConnector()
          Creates a new instance.
StickyChopConnector(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 this 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.ChopBoxConnector
findEnd, findStart
 
Methods inherited from class org.jhotdraw.draw.AbstractConnector
clone, contains, findPoint, getBounds, getConnectorTarget, getOwner, isConnectToDecorator, isVisible, setConnectToDecorator, setOwner, setVisible, updateEndLocation, updateStartLocation
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StickyChopConnector

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


StickyChopConnector

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

draw

public void draw(java.awt.Graphics2D g)
Description copied from class: AbstractConnector
Draws this connector. By default connectors are invisible.

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 can use this as a hint, where the user wants to place the start or end point of the ConnectionFigure.

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 ChopBoxConnector

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-2006 © JHotDraw.org