CH.ifa.draw.standard
Class ConnectionHandle

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractHandle
      extended by CH.ifa.draw.standard.LocatorHandle
          extended by CH.ifa.draw.standard.ConnectionHandle
All Implemented Interfaces:
Handle

public class ConnectionHandle
extends LocatorHandle

A handle to connect figures. The connection object to be created is specified by a prototype.


Design Patterns

 o Prototype
ConnectionHandle creates the connection by cloning a prototype.


See Also:
ConnectionFigure, Object.clone()

Field Summary
 
Fields inherited from class CH.ifa.draw.standard.AbstractHandle
HANDLESIZE
 
Constructor Summary
ConnectionHandle(Figure owner, Locator l, ConnectionFigure prototype)
          Constructs a handle with the given owner, locator, and connection prototype
 
Method Summary
protected  ConnectionFigure createConnection()
          Creates the ConnectionFigure.
 void draw(java.awt.Graphics g)
          Draws the connection handle, by default the outline of a blue circle.
protected  Connector findConnectionTarget(int x, int y, Drawing drawing)
          Finds a connection end figure.
protected  Connector findConnector(int x, int y, Figure f)
           
 void invokeEnd(int x, int y, int anchorX, int anchorY, DrawingView view)
          Connects the figures if the mouse is released over another figure.
 void invokeStart(int x, int y, DrawingView view)
          Creates the connection
 void invokeStep(int x, int y, int anchorX, int anchorY, DrawingView view)
          Tracks the connection.
 
Methods inherited from class CH.ifa.draw.standard.LocatorHandle
locate
 
Methods inherited from class CH.ifa.draw.standard.AbstractHandle
containsPoint, displayBox, invokeEnd, invokeStart, invokeStep, owner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionHandle

public ConnectionHandle(Figure owner,
                        Locator l,
                        ConnectionFigure prototype)
Constructs a handle with the given owner, locator, and connection prototype

Method Detail

invokeStart

public void invokeStart(int x,
                        int y,
                        DrawingView view)
Creates 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

invokeStep

public void invokeStep(int x,
                       int y,
                       int anchorX,
                       int anchorY,
                       DrawingView view)
Tracks 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

invokeEnd

public void invokeEnd(int x,
                      int y,
                      int anchorX,
                      int anchorY,
                      DrawingView view)
Connects the figures if the mouse is released over another figure.

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

createConnection

protected ConnectionFigure createConnection()
Creates the ConnectionFigure. By default the figure prototype is cloned.


findConnectionTarget

protected Connector findConnectionTarget(int x,
                                         int y,
                                         Drawing drawing)
Finds a connection end figure.


findConnector

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

draw

public void draw(java.awt.Graphics g)
Draws the connection handle, by default the outline of a blue circle.

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