JHotDraw 6.0b1

org.jhotdraw.standard
Class ChangeConnectionHandle

java.lang.Object
  extended by org.jhotdraw.standard.AbstractHandle
      extended by org.jhotdraw.standard.ChangeConnectionHandle
All Implemented Interfaces:
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

Nested Class Summary
static class ChangeConnectionHandle.UndoActivity
           
 
Field Summary
 
Fields inherited from class org.jhotdraw.standard.AbstractHandle
HANDLESIZE
 
Constructor Summary
protected ChangeConnectionHandle(ConnectionFigure owner)
          Initializes the change connection handle.
 
Method Summary
protected abstract  boolean canConnectTo(Figure figure)
          Called to check whether this end of the connection can connect to the given target figure.
protected abstract  void connect(Connector c)
          Connect the connection with the given figure.
protected abstract  Undoable createUndoActivity(DrawingView newView)
          Factory method for undo activity.
protected abstract  void disconnect()
          Disconnects the connection.
 void draw(java.awt.Graphics g)
          Draws this handle.
protected  Connector findConnector(int x, int y, Figure f)
           
protected  ConnectionFigure getConnection()
           
protected  Figure getTargetFigure()
           
 void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view)
          Connects the figure to the new target.
 void invokeStart(int x, int y, DrawingView view)
          Disconnects the connection.
 void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view)
          Finds a new target of the connection.
protected  void setConnection(ConnectionFigure newConnection)
           
protected abstract  void setPoint(int x, int y)
          Sets the location of the target point.
protected  void setTargetFigure(Figure newTarget)
           
protected  Connector source()
          Gets the side of the connection that is unaffected by the change.
protected abstract  Connector target()
          Returns the target connector of the change.
 
Methods inherited from class org.jhotdraw.standard.AbstractHandle
containsPoint, displayBox, getCursor, getUndoActivity, invokeEnd, invokeStart, invokeStep, owner, setUndoActivity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.framework.Handle
locate
 

Constructor Detail

ChangeConnectionHandle

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

Method Detail

target

protected abstract Connector target()
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.


setPoint

protected abstract void setPoint(int x,
                                 int y)
Sets the location of the target point.


source

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


invokeStart

public void invokeStart(int x,
                        int y,
                        DrawingView view)
Disconnects the connection.

Specified by:
invokeStart in interface Handle
Overrides:
invokeStart in class AbstractHandle
Parameters:
x - the x position where the interaction started
y - the y position where the interaction started
view - the handles container
See Also:
Handle.invokeStart(int, int, org.jhotdraw.framework.DrawingView)

invokeStep

public void invokeStep(int x,
                       int y,
                       int anchorX,
                       int anchorY,
                       DrawingView view)
Finds a new target of the connection.

Specified by:
invokeStep in interface Handle
Overrides:
invokeStep in class AbstractHandle
Parameters:
x - the current x position
y - the current y position
anchorX - the x position where the interaction started
anchorY - the y position where the interaction started
See Also:
Handle.invokeStep(int, int, int, int, org.jhotdraw.framework.DrawingView)

invokeEnd

public void invokeEnd(int x,
                      int y,
                      int anchorX,
                      int anchorY,
                      DrawingView view)
Connects the figure to the new target. If there is no new target the connection reverts to its original one.

Specified by:
invokeEnd in interface Handle
Overrides:
invokeEnd in class AbstractHandle
Parameters:
x - the current x position
y - the current y position
anchorX - the x position where the interaction started
anchorY - the y position where the interaction started
See Also:
Handle.invokeEnd(int, int, int, int, org.jhotdraw.framework.DrawingView)

canConnectTo

protected abstract boolean canConnectTo(Figure figure)
Called to check whether this end of the connection can connect to the given target figure. Needs to be overriden by the start and end changers to take the connection's direction into account during the check. JHD 5.4 beta and before did not do this.


findConnector

protected Connector findConnector(int x,
                                  int y,
                                  Figure f)

draw

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

Specified by:
draw in interface Handle
Overrides:
draw in class AbstractHandle
See Also:
Handle.draw(java.awt.Graphics)

setConnection

protected void setConnection(ConnectionFigure newConnection)

getConnection

protected ConnectionFigure getConnection()

setTargetFigure

protected void setTargetFigure(Figure newTarget)

getTargetFigure

protected Figure getTargetFigure()

createUndoActivity

protected abstract Undoable createUndoActivity(DrawingView newView)
Factory method for undo activity. To be overriden by subclasses.


JHotDraw 6.0b1