JHotDraw 6.0b1

org.jhotdraw.standard
Class SelectionTool

java.lang.Object
  extended by org.jhotdraw.standard.AbstractTool
      extended by org.jhotdraw.standard.SelectionTool
All Implemented Interfaces:
Tool
Direct Known Subclasses:
CustomSelectionTool, MySelectionTool

public class SelectionTool
extends AbstractTool

Tool to select and manipulate figures. A selection tool is in one of three states, e.g., background selection, figure selection, handle manipulation. The different states are handled by different child tools.


Design Patterns

 o State
SelectionTool is the StateContext and child is the State. The SelectionTool delegates state specific behavior to its current child tool.



Nested Class Summary
 
Nested classes/interfaces inherited from class org.jhotdraw.standard.AbstractTool
AbstractTool.EventDispatcher
 
Constructor Summary
SelectionTool(DrawingEditor newDrawingEditor)
           
 
Method Summary
protected  Tool createAreaTracker()
          Factory method to create an area tracker.
protected  Tool createDragTracker(Figure f)
          Factory method to create a Drag tracker.
protected  Tool createHandleTracker(DrawingView view, Handle handle)
          Factory method to create a Handle tracker.
protected  Tool getDelegateTool()
           
 void mouseDown(java.awt.event.MouseEvent e, int x, int y)
          Handles mouse down events and starts the corresponding tracker.
 void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
          Handles mouse drag events.
 void mouseMove(java.awt.event.MouseEvent evt, int x, int y)
          Handles mouse moves (if the mouse button is up).
 void mouseUp(java.awt.event.MouseEvent e, int x, int y)
          Handles mouse up events.
protected  void setDelegateTool(Tool newDelegateTool)
           
 
Methods inherited from class org.jhotdraw.standard.AbstractTool
activate, addToolListener, checkUsable, createEventDispatcher, createViewChangeListener, deactivate, drawing, editor, getActiveDrawing, getActiveView, getAnchorX, getAnchorY, getEventDispatcher, getUndoActivity, isActive, isEnabled, isUsable, keyDown, 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

SelectionTool

public SelectionTool(DrawingEditor newDrawingEditor)
Method Detail

mouseDown

public void mouseDown(java.awt.event.MouseEvent e,
                      int x,
                      int y)
Handles mouse down events and starts the corresponding tracker.

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

mouseMove

public void mouseMove(java.awt.event.MouseEvent evt,
                      int x,
                      int y)
Handles mouse moves (if the mouse button is up). Switches the cursors depending on whats under them.

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

mouseDrag

public void mouseDrag(java.awt.event.MouseEvent e,
                      int x,
                      int y)
Handles mouse drag events. The events are forwarded to the current tracker.

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

mouseUp

public void mouseUp(java.awt.event.MouseEvent e,
                    int x,
                    int y)
Handles mouse up events. The events are forwarded to the current tracker.

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

createHandleTracker

protected Tool createHandleTracker(DrawingView view,
                                   Handle handle)
Factory method to create a Handle tracker. It is used to track a handle.


createDragTracker

protected Tool createDragTracker(Figure f)
Factory method to create a Drag tracker. It is used to drag a figure.


createAreaTracker

protected Tool createAreaTracker()
Factory method to create an area tracker. It is used to select an area.


getDelegateTool

protected Tool getDelegateTool()

setDelegateTool

protected final void setDelegateTool(Tool newDelegateTool)

JHotDraw 6.0b1