JHotDraw 6.0b1

org.jhotdraw.standard
Class DragTracker

java.lang.Object
  extended by org.jhotdraw.standard.AbstractTool
      extended by org.jhotdraw.standard.DragTracker
All Implemented Interfaces:
Tool

public class DragTracker
extends AbstractTool

DragTracker implements the dragging of the clicked figure.

See Also:
SelectionTool

Nested Class Summary
static class DragTracker.UndoActivity
           
 
Nested classes/interfaces inherited from class org.jhotdraw.standard.AbstractTool
AbstractTool.EventDispatcher
 
Constructor Summary
DragTracker(DrawingEditor newDrawingEditor, Figure anchor)
           
 
Method Summary
 void activate()
          Activates the tool for use on the given view.
protected  Undoable createUndoActivity()
          Factory method for undo activity
 void deactivate()
          Deactivates the tool.
 Figure getAnchorFigure()
           
protected  int getLastMouseX()
           
protected  int getLastMouseY()
           
 boolean hasMoved()
          Check whether the selected figure has been moved since the tool has been activated.
 void mouseDown(java.awt.event.MouseEvent e, int x, int y)
          Handles mouse down events in the drawing view.
 void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
          Handles mouse drag events in the drawing view.
protected  void setAnchorFigure(Figure newAnchorFigure)
           
protected  void setHasMoved(boolean newMoved)
           
protected  void setLastMouseX(int newLastMouseX)
           
protected  void setLastMouseY(int newLastMouseY)
           
 
Methods inherited from class org.jhotdraw.standard.AbstractTool
addToolListener, checkUsable, createEventDispatcher, createViewChangeListener, drawing, editor, getActiveDrawing, getActiveView, getAnchorX, getAnchorY, getEventDispatcher, getUndoActivity, isActive, isEnabled, isUsable, keyDown, mouseMove, mouseUp, removeToolListener, setAnchorX, setAnchorY, setEditor, setEnabled, setUndoActivity, setUsable, setView, view, viewCreated, viewDestroying, viewSelectionChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DragTracker

public DragTracker(DrawingEditor newDrawingEditor,
                   Figure anchor)
Method Detail

mouseDown

public void mouseDown(java.awt.event.MouseEvent e,
                      int x,
                      int y)
Description copied from class: AbstractTool
Handles mouse down events in the drawing view.

Specified by:
mouseDown in interface Tool
Overrides:
mouseDown in class AbstractTool

mouseDrag

public void mouseDrag(java.awt.event.MouseEvent e,
                      int x,
                      int y)
Description copied from class: AbstractTool
Handles mouse drag events in the drawing view.

Specified by:
mouseDrag in interface Tool
Overrides:
mouseDrag in class AbstractTool

setAnchorFigure

protected void setAnchorFigure(Figure newAnchorFigure)

getAnchorFigure

public Figure getAnchorFigure()

setLastMouseX

protected void setLastMouseX(int newLastMouseX)

getLastMouseX

protected int getLastMouseX()

setLastMouseY

protected void setLastMouseY(int newLastMouseY)

getLastMouseY

protected int getLastMouseY()

hasMoved

public boolean hasMoved()
Check whether the selected figure has been moved since the tool has been activated.

Returns:
true if the selected figure has been moved

setHasMoved

protected void setHasMoved(boolean newMoved)

activate

public void activate()
Description copied from class: AbstractTool
Activates the tool for use on the given view. This method is called whenever the user switches to this tool. Use this method to reinitialize a tool. Since tools will be disabled unless it is useable, there will always be an active view when this is called. based on isUsable() Tool should never be activated if the view is null. Ideally, the dditor should take care of that.

Specified by:
activate in interface Tool
Overrides:
activate in class AbstractTool

deactivate

public void deactivate()
Description copied from class: AbstractTool
Deactivates the tool. This method is called whenever the user switches to another tool. Use this method to do some clean-up when the tool is switched. Subclassers should always call super.deactivate. An inactive tool should never be deactivated

Specified by:
deactivate in interface Tool
Overrides:
deactivate in class AbstractTool

createUndoActivity

protected Undoable createUndoActivity()
Factory method for undo activity


JHotDraw 6.0b1