JHotDraw 7.4.1

org.jhotdraw.draw.handle
Class ConnectorHandle

java.lang.Object
  extended by org.jhotdraw.draw.handle.AbstractHandle
      extended by org.jhotdraw.draw.handle.ConnectorHandle
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener, FigureListener, Handle

public class ConnectorHandle
extends AbstractHandle

A Handle associated to a Connector which allows to create a new ConnectionFigure by dragging the handle to another connector.

Version:
$Id: ConnectorHandle.java -1 $
Author:
Werner Randelshofer.

Field Summary
protected  java.util.Collection<Connector> connectors
          All connectors of the connectable Figure.
 
Fields inherited from class org.jhotdraw.draw.handle.AbstractHandle
listenerList, view
 
Constructor Summary
ConnectorHandle(Connector connector, ConnectionFigure prototype)
          Creates a new instance.
 
Method Summary
protected  java.awt.Rectangle basicGetBounds()
           
protected  ConnectionFigure createConnection()
          Creates the ConnectionFigure.
 void draw(java.awt.Graphics2D g)
          Draws this handle.
protected  Connector findConnectableConnector(Figure connectableFigure, java.awt.geom.Point2D.Double p)
          Finds a connection end figure.
protected  ConnectionFigure getConnection()
           
 java.awt.Rectangle getDrawingArea()
          Returns the drawing area of the handle.
 java.awt.Point getLocation()
           
 java.awt.geom.Point2D.Double getLocationOnDrawing()
           
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,.
 void repaintConnectors()
          Updates the list of connectors that we draw when the user moves or drags the mouse over a figure to which can connect.
protected  void setConnection(ConnectionFigure newConnection)
           
protected  void setTargetFigure(Figure newTargetFigure)
           
 void trackEnd(java.awt.Point anchor, java.awt.Point lead, int modifiersEx)
          Tracks the end of the interaction.
 void trackStart(java.awt.Point anchor, int modifiersEx)
          Tracks the start of the interaction.
 void trackStep(java.awt.Point anchor, java.awt.Point lead, int modifiersEx)
          Tracks a step of the interaction.
 
Methods inherited from class org.jhotdraw.draw.handle.AbstractHandle
addHandleListener, areaInvalidated, attributeChanged, contains, createSecondaryHandles, dispose, drawCircle, drawDiamond, drawRectangle, figureAdded, figureChanged, figureHandlesChanged, figureRemoved, figureRequestRemove, fireAreaInvalidated, fireHandleRequestRemove, fireHandleRequestSecondaryHandles, fireUndoableEditHappened, getBounds, getCursor, getEditor, getHandlesize, getOwner, getToolTipText, getView, invalidate, keyPressed, keyReleased, keyTyped, removeHandleListener, setToolTipText, setView, trackDoubleClick, updateBounds, viewTransformChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connectors

protected java.util.Collection<Connector> connectors
All connectors of the connectable Figure.

Constructor Detail

ConnectorHandle

public ConnectorHandle(Connector connector,
                       ConnectionFigure prototype)
Creates a new instance.

Method Detail

getLocationOnDrawing

public java.awt.geom.Point2D.Double getLocationOnDrawing()

getLocation

public java.awt.Point getLocation()

draw

public void draw(java.awt.Graphics2D g)
Description copied from class: AbstractHandle
Draws this handle.

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

trackStart

public void trackStart(java.awt.Point anchor,
                       int modifiersEx)
Description copied from interface: Handle
Tracks the start of the interaction. The default implementation does nothing.

Parameters:
anchor - the position where the interaction started

trackStep

public void trackStep(java.awt.Point anchor,
                      java.awt.Point lead,
                      int modifiersEx)
Description copied from interface: Handle
Tracks a step of the interaction.

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

getDrawingArea

public java.awt.Rectangle getDrawingArea()
Description copied from interface: Handle
Returns the drawing area of the handle. Note: The drawing area must be returned in the coordinate system of the DrawingView.

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

trackEnd

public void trackEnd(java.awt.Point anchor,
                     java.awt.Point lead,
                     int modifiersEx)
Description copied from interface: Handle
Tracks the end of the interaction.

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

createConnection

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


setConnection

protected void setConnection(ConnectionFigure newConnection)

getConnection

protected ConnectionFigure getConnection()

getTargetFigure

protected Figure getTargetFigure()

setTargetFigure

protected void setTargetFigure(Figure newTargetFigure)

findConnectableConnector

protected Connector findConnectableConnector(Figure connectableFigure,
                                             java.awt.geom.Point2D.Double p)
Finds a connection end figure.


basicGetBounds

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

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

repaintConnectors

public void repaintConnectors()
Updates the list of connectors that we draw when the user moves or drags the mouse over a figure to which can connect.


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