JHotDraw 7.0.6

org.jhotdraw.draw
Class ChangeConnectionHandle

java.lang.Object
  extended by org.jhotdraw.draw.AbstractHandle
      extended by org.jhotdraw.draw.ChangeConnectionHandle
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener, FigureListener, Handle
Direct Known Subclasses:
ChangeConnectionEndHandle, ChangeConnectionStartHandle

public abstract class ChangeConnectionHandle
extends AbstractHandle

ChangeConnectionHandle factors the common code for handles that can be used to reconnect connections.

See Also:
ChangeConnectionEndHandle, ChangeConnectionStartHandle

Field Summary
 
Fields inherited from class org.jhotdraw.draw.AbstractHandle
listenerList, view
 
Constructor Summary
protected ChangeConnectionHandle(Figure owner)
          Initializes the change connection handle.
 
Method Summary
protected  java.awt.Rectangle basicGetBounds()
           
protected abstract  boolean canConnect(Figure existingEnd, Figure targetEnd)
           
protected abstract  void connect(Connector c)
          Connect the connection with the given figure.
protected abstract  void disconnect()
          Disconnects the connection.
 void draw(java.awt.Graphics2D g)
          Draws this handle.
protected  Connector findConnector(java.awt.geom.Point2D.Double p, Figure f, ConnectionFigure prototype)
           
protected  ConnectionFigure getConnection()
           
protected abstract  java.awt.geom.Point2D.Double getLocation()
          Returns the start point of the connection.
protected  Connector getSource()
          Gets the side of the connection that is unaffected by the change.
protected abstract  Connector getTarget()
          Returns the target connector of the change.
protected  Figure getTargetFigure()
           
 boolean isCombinableWith(Handle handle)
          Returns true, if the given handle is an instance of the same class or of a subclass of this handle,.
protected  void setConnection(ConnectionFigure newConnection)
           
protected abstract  void setLocation(java.awt.geom.Point2D.Double p)
          Sets the location of the target point.
protected  void setTargetFigure(Figure newTarget)
           
 void trackEnd(java.awt.Point anchor, java.awt.Point lead, int modifiersEx)
          Connects the figure to the new target.
 void trackStart(java.awt.Point anchor, int modifiersEx)
          Disconnects the connection.
 void trackStep(java.awt.Point anchor, java.awt.Point lead, int modifiersEx)
          Finds a new target of the connection.
 
Methods inherited from class org.jhotdraw.draw.AbstractHandle
addHandleListener, contains, createSecondaryHandles, dispose, drawCircle, drawDiamond, drawRectangle, figureAdded, figureAreaInvalidated, figureAttributeChanged, figureChanged, figureRemoved, figureRequestRemove, fireAreaInvalidated, fireHandleRequestRemove, fireHandleRequestSecondaryHandles, fireUndoableEditHappened, getBounds, getCursor, getDrawBounds, getHandlesize, getOwner, invalidate, keyPressed, keyReleased, keyTyped, removeHandleListener, setView, trackDoubleClick, updateBounds, viewTransformChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChangeConnectionHandle

protected ChangeConnectionHandle(Figure owner)
Initializes the change connection handle.

Method Detail

isCombinableWith

public boolean isCombinableWith(Handle handle)
Description copied from class: AbstractHandle
Returns true, if the given handle is an instance of the same class or of a subclass of this handle,.

Specified by:
isCombinableWith in interface Handle
Overrides:
isCombinableWith in class AbstractHandle

getTarget

protected abstract Connector getTarget()
Returns the target connector of the change.


disconnect

protected abstract void disconnect()
Disconnects the connection.


connect

protected abstract void connect(Connector c)
Connect the connection with the given figure.


setLocation

protected abstract void setLocation(java.awt.geom.Point2D.Double p)
Sets the location of the target point.


getLocation

protected abstract java.awt.geom.Point2D.Double getLocation()
Returns the start point of the connection.


getSource

protected Connector getSource()
Gets the side of the connection that is unaffected by the change.


trackStart

public void trackStart(java.awt.Point anchor,
                       int modifiersEx)
Disconnects the connection.

Parameters:
anchor - the position where the interaction started

trackStep

public void trackStep(java.awt.Point anchor,
                      java.awt.Point lead,
                      int modifiersEx)
Finds a new target of the connection.

Parameters:
anchor - the position where the interaction started
lead - the current position

trackEnd

public void trackEnd(java.awt.Point anchor,
                     java.awt.Point lead,
                     int modifiersEx)
Connects the figure to the new target. If there is no new target the connection reverts to its original one.

Parameters:
anchor - the position where the interaction started
lead - the current position

canConnect

protected abstract boolean canConnect(Figure existingEnd,
                                      Figure targetEnd)

findConnector

protected Connector findConnector(java.awt.geom.Point2D.Double p,
                                  Figure f,
                                  ConnectionFigure prototype)

draw

public void draw(java.awt.Graphics2D g)
Draws this handle.

Specified by:
draw in interface Handle
Overrides:
draw in class AbstractHandle

setConnection

protected void setConnection(ConnectionFigure newConnection)

getConnection

protected ConnectionFigure getConnection()

setTargetFigure

protected void setTargetFigure(Figure newTarget)

getTargetFigure

protected Figure getTargetFigure()

basicGetBounds

protected java.awt.Rectangle basicGetBounds()
Specified by:
basicGetBounds in class AbstractHandle

Copyright 1996-2006 © JHotDraw.org