JHotDraw 7.1

org.jhotdraw.draw
Interface Handle

All Superinterfaces:
java.util.EventListener, java.awt.event.KeyListener
All Known Implementing Classes:
AbstractConnectionHandle, AbstractHandle, AbstractRotateHandle, BezierControlPointHandle, BezierNodeHandle, BezierOutlineHandle, BezierScaleHandle, BoundsOutlineHandle, CloseHandle, ConnectionEndHandle, ConnectionStartHandle, ConnectorHandle, DragHandle, FontSizeHandle, LocatorHandle, MoveHandle, NullHandle, ODGPathOutlineHandle, ODGRectRadiusHandle, RotateHandle, RoundRectangleRadiusHandle, SVGPathOutlineHandle, SVGRectRadiusHandle, TextOverflowHandle, TriangleRotationHandler

public interface Handle
extends java.awt.event.KeyListener

Handles are used to change a figure by direct manipulation. Handles know their owning figure and they provide methods to locate the handle on the figure and to track changes.

Handles are used for user interaction. Unlike figures, a handle works with the user interface coordinates of the DrawingView. The user interface coordinates are expressed in integer pixels.

A Handle forwards UndoableEdit events to the Drawing object onto which it is performing changes.

Version:
2.0 2006-01-14 Changed to support double precision coordinates.
1.0 2003-12-01 Derived from JHotDraw 5.4b1.
Author:
Werner Randelshofer

Method Summary
 void addHandleListener(HandleListener l)
          Adds a listener for this handle.
 boolean contains(java.awt.Point p)
          Tests if a point is contained in the handle.
 java.util.Collection<Handle> createSecondaryHandles()
          Creates secondary handles.
 void dispose()
          Disposes the resources aquired by the handler.
 void draw(java.awt.Graphics2D g)
          Draws this handle.
 java.awt.Rectangle getBounds()
          Returns the bounding box of the handle.
 java.awt.Cursor getCursor()
          Returns a cursor for the handle.
 java.awt.Rectangle getDrawingArea()
          Returns the drawing area of the handle.
 Figure getOwner()
          Returns the owner of this handle.
 java.lang.String getToolTipText(java.awt.Point p)
          Returns a tooltip for the specified location.
 void invalidate()
          Invalidates the handle.
 boolean isCombinableWith(Handle handle)
          Returns true, if this handle is combinable with the specified handle.
 void removeHandleListener(HandleListener l)
          Removes a listener for this handle.
 void setView(DrawingView view)
          Sets the view of the handle.
 void trackDoubleClick(java.awt.Point p, int modifiersEx)
          Tracks a double click.
 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.
 void viewTransformChanged()
          This method is invoked by the drawing view, when its transform has changed.
 
Methods inherited from interface java.awt.event.KeyListener
keyPressed, keyReleased, keyTyped
 

Method Detail

getOwner

Figure getOwner()
Returns the owner of this handle.


setView

void setView(DrawingView view)
Sets the view of the handle.


addHandleListener

void addHandleListener(HandleListener l)
Adds a listener for this handle.


removeHandleListener

void removeHandleListener(HandleListener l)
Removes a listener for this handle.


getBounds

java.awt.Rectangle getBounds()
Returns the bounding box of the handle. Note: The bounding box must be returned in the coordinate system of the DrawingView.


getDrawingArea

java.awt.Rectangle getDrawingArea()
Returns the drawing area of the handle. Note: The drawing area must be returned in the coordinate system of the DrawingView.


contains

boolean contains(java.awt.Point p)
Tests if a point is contained in the handle.


draw

void draw(java.awt.Graphics2D g)
Draws this handle. Note: The handle is drawn with the coordinate system of the DrawingView.


invalidate

void invalidate()
Invalidates the handle. This method informs its listeners that its current display box is invalid and should be refreshed.


dispose

void dispose()
Disposes the resources aquired by the handler.


getCursor

java.awt.Cursor getCursor()
Returns a cursor for the handle.


isCombinableWith

boolean isCombinableWith(Handle handle)
Returns true, if this handle is combinable with the specified handle. This method is used to determine, if multiple handles need to be tracked, when more than one figure is selected.


trackStart

void trackStart(java.awt.Point anchor,
                int modifiersEx)
Tracks the start of the interaction. The default implementation does nothing.

Parameters:
anchor - the position where the interaction started

trackStep

void trackStep(java.awt.Point anchor,
               java.awt.Point lead,
               int modifiersEx)
Tracks a step of the interaction.

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

trackEnd

void trackEnd(java.awt.Point anchor,
              java.awt.Point lead,
              int modifiersEx)
Tracks the end of the interaction.

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

trackDoubleClick

void trackDoubleClick(java.awt.Point p,
                      int modifiersEx)
Tracks a double click.


viewTransformChanged

void viewTransformChanged()
This method is invoked by the drawing view, when its transform has changed. This means, that DrawingView.viewToDrawing and DrawingView.drawingToView will return different values than they did before.


createSecondaryHandles

java.util.Collection<Handle> createSecondaryHandles()
Creates secondary handles.


getToolTipText

java.lang.String getToolTipText(java.awt.Point p)
Returns a tooltip for the specified location.


Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.