JHotDraw 7.5.1

org.jhotdraw.draw.handle
Class DragHandle

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

public class DragHandle
extends AbstractHandle

A handle that changes the location of the owning figure, the handle covers all visible points of the figure.

Usually, DragHandle is not needed, because of the DragTracker in the |@code SelectionTool}. Use a (subclass of) DragHandle, if you want to implement figure specific drag behavior. A CompositeFigure can create DragHandles for all its child figures, to support dragging of child figures without having to decompose the CompositeFigure.

Version:
$Id: DragHandle.java 647 2010-01-24 22:52:59Z rawcoder $
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class org.jhotdraw.draw.handle.AbstractHandle
listenerList, view
 
Constructor Summary
DragHandle(Figure owner)
          Creates a new instance.
 
Method Summary
protected  java.awt.Rectangle basicGetBounds()
           
 boolean contains(java.awt.Point p)
          Tests if a point is contained in the handle.
 void draw(java.awt.Graphics2D g)
          Draws nothing.
 java.awt.Cursor getCursor()
          Returns a cursor for the handle.
 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, createSecondaryHandles, dispose, drawCircle, drawDiamond, drawRectangle, figureAdded, figureChanged, figureHandlesChanged, figureRemoved, figureRequestRemove, fireAreaInvalidated, fireHandleRequestRemove, fireHandleRequestSecondaryHandles, fireUndoableEditHappened, getBounds, getDrawingArea, getEditor, getHandlesize, getOwner, getToolTipText, getView, invalidate, isCombinableWith, 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
 

Constructor Detail

DragHandle

public DragHandle(Figure owner)
Creates a new instance.

Method Detail

draw

public void draw(java.awt.Graphics2D g)
Draws nothing. Drag Handles have no visual appearance of their own.

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

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

contains

public boolean contains(java.awt.Point p)
Description copied from interface: Handle
Tests if a point is contained in the handle.

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

basicGetBounds

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

getCursor

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

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

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