org.jhotdraw.draw
Class DnDTracker
java.lang.Object
org.jhotdraw.beans.AbstractBean
org.jhotdraw.draw.AbstractTool
org.jhotdraw.draw.DnDTracker
- All Implemented Interfaces:
- java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, DragTracker, Tool
public class DnDTracker
- extends AbstractTool
- implements DragTracker
This is a tracker which supports drag and drop of figures between drawing
views and any other component or application which support drag and drop.
DnDTracker can be used stand-alone or instead of DragTracker in the
SelectionTool or the DelegationSelectionTool.
To get a drag image using drag and drop, the drawing needs to provide
an image output format.
Drag and Drop is about information moving, not images or objects. Its about
moving a figure to another application and that application understanding
both its shape, color, attributes, and everything about it - not necessarily
how it looks.
- Version:
- $Id: DnDTracker.java 527 2009-06-07 14:28:19Z rawcoder $
- Author:
- Werner Randelshofer
- See Also:
- Serialized Form
|
Field Summary |
protected Figure |
anchorFigure
|
protected java.awt.geom.Point2D.Double |
anchorOrigin
The anchorOrigin holds the origin of all dragged figures of the
mousePressed event. |
protected java.awt.geom.Point2D.Double |
anchorPoint
The anchorPoint holds the location of the mouse of the
mousePressed event. |
protected java.awt.geom.Rectangle2D.Double |
dragRect
The drag rectangle encompasses the bounds of all dragged figures. |
private boolean |
isDragging
|
protected java.awt.geom.Point2D.Double |
previousOrigin
The previousOrigin holds the origin of all dragged figures of the
previous mouseDragged event. |
protected java.awt.geom.Point2D.Double |
previousPoint
The previousPoint holds the location of the mouse of the previous
mouseDragged event. |
| Methods inherited from class org.jhotdraw.draw.AbstractTool |
activate, addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, deactivate, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getToolTipText, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, supportsHandleInteraction, updateCursor, viewToDrawing |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jhotdraw.draw.Tool |
activate, addToolListener, deactivate, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, getToolTipText, removeToolListener, supportsHandleInteraction |
| Methods inherited from interface java.awt.event.MouseListener |
mouseClicked, mouseEntered, mouseExited |
| Methods inherited from interface java.awt.event.KeyListener |
keyPressed, keyReleased, keyTyped |
anchorFigure
protected Figure anchorFigure
dragRect
protected java.awt.geom.Rectangle2D.Double dragRect
- The drag rectangle encompasses the bounds of all dragged figures.
previousOrigin
protected java.awt.geom.Point2D.Double previousOrigin
- The previousOrigin holds the origin of all dragged figures of the
previous mouseDragged event. This coordinate is constrained using
the Constrainer of the DrawingView.
anchorOrigin
protected java.awt.geom.Point2D.Double anchorOrigin
- The anchorOrigin holds the origin of all dragged figures of the
mousePressed event.
previousPoint
protected java.awt.geom.Point2D.Double previousPoint
- The previousPoint holds the location of the mouse of the previous
mouseDragged event. This coordinate is not constrained using
the Constrainer of the DrawingView.
anchorPoint
protected java.awt.geom.Point2D.Double anchorPoint
- The anchorPoint holds the location of the mouse of the
mousePressed event. This coordinate is not constrained using
the Constrainer of the DrawingView.
isDragging
private boolean isDragging
DnDTracker
public DnDTracker()
DnDTracker
public DnDTracker(Figure figure)
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent evt)
- Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener- Overrides:
mouseMoved in class AbstractTool
mousePressed
public void mousePressed(java.awt.event.MouseEvent evt)
- Specified by:
mousePressed in interface java.awt.event.MouseListener- Overrides:
mousePressed in class AbstractTool
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent evt)
- Specified by:
mouseReleased in interface java.awt.event.MouseListener- Overrides:
mouseReleased in class AbstractTool
setDraggedFigure
public void setDraggedFigure(Figure f)
- Specified by:
setDraggedFigure in interface DragTracker