|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.standard.AbstractTool
Default implementation support for Tools.
DrawingView
,
Tool
Nested Class Summary | |
static class |
AbstractTool.EventDispatcher
|
Constructor Summary | |
AbstractTool(DrawingEditor newDrawingEditor)
Constructs a tool for the given view. |
Method Summary | |
void |
activate()
Activates the tool for use on the given view. |
void |
addToolListener(ToolListener newToolListener)
|
protected void |
checkUsable()
|
protected AbstractTool.EventDispatcher |
createEventDispatcher()
|
protected ViewChangeListener |
createViewChangeListener()
|
void |
deactivate()
Deactivates the tool. |
Drawing |
drawing()
Gets the tool's drawing. |
DrawingEditor |
editor()
Gets the tool's editor. |
Drawing |
getActiveDrawing()
|
DrawingView |
getActiveView()
|
protected int |
getAnchorX()
The anchor point is usually the first mouse click performed with this tool. |
protected int |
getAnchorY()
The anchor point is usually the first mouse click performed with this tool. |
protected AbstractTool.EventDispatcher |
getEventDispatcher()
|
Undoable |
getUndoActivity()
|
boolean |
isActive()
An active tool is the currently selected tool in the DrawingView. |
boolean |
isEnabled()
A tool must be enabled in order to use it and to activate/deactivate it. |
boolean |
isUsable()
Tests if the tool can be used or "executed." |
void |
keyDown(java.awt.event.KeyEvent evt,
int key)
Handles key down events in the drawing view. |
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. |
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 in the drawing view. |
void |
removeToolListener(ToolListener oldToolListener)
|
protected void |
setAnchorX(int newAnchorX)
The anchor point is usually the first mouse click performed with this tool. |
protected void |
setAnchorY(int newAnchorY)
The anchor point is usually the first mouse click performed with this tool. |
protected void |
setEditor(DrawingEditor newDrawingEditor)
|
void |
setEnabled(boolean newIsEnabled)
|
void |
setUndoActivity(Undoable newUndoActivity)
|
void |
setUsable(boolean newIsUsable)
|
protected void |
setView(DrawingView newDrawingView)
|
DrawingView |
view()
Gets the tool's view (convienence method). |
protected void |
viewCreated(DrawingView view)
Sent when a new view is created |
protected void |
viewDestroying(DrawingView view)
Send when an existing view is about to be destroyed. |
protected void |
viewSelectionChanged(DrawingView oldView,
DrawingView newView)
Fired when the selected view changes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractTool(DrawingEditor newDrawingEditor)
Method Detail |
public void activate()
activate
in interface Tool
public void deactivate()
deactivate
in interface Tool
protected void viewSelectionChanged(DrawingView oldView, DrawingView newView)
protected void viewCreated(DrawingView view)
protected void viewDestroying(DrawingView view)
public void mouseDown(java.awt.event.MouseEvent e, int x, int y)
mouseDown
in interface Tool
public void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
mouseDrag
in interface Tool
public void mouseUp(java.awt.event.MouseEvent e, int x, int y)
mouseUp
in interface Tool
public void mouseMove(java.awt.event.MouseEvent evt, int x, int y)
mouseMove
in interface Tool
public void keyDown(java.awt.event.KeyEvent evt, int key)
keyDown
in interface Tool
public Drawing drawing()
public Drawing getActiveDrawing()
public DrawingEditor editor()
editor
in interface Tool
protected void setEditor(DrawingEditor newDrawingEditor)
public DrawingView view()
protected void setView(DrawingView newDrawingView)
public DrawingView getActiveView()
public boolean isUsable()
isUsable
in interface Tool
Tool.isEnabled()
,
Tool.isUsable()
public void setUsable(boolean newIsUsable)
setUsable
in interface Tool
public void setEnabled(boolean newIsEnabled)
setEnabled
in interface Tool
public boolean isEnabled()
Tool
isEnabled
in interface Tool
Tool.isUsable()
,
Tool.isActive()
protected void setAnchorX(int newAnchorX)
mouseDown(java.awt.event.MouseEvent, int, int)
protected int getAnchorX()
mouseDown(java.awt.event.MouseEvent, int, int)
protected void setAnchorY(int newAnchorY)
mouseDown(java.awt.event.MouseEvent, int, int)
protected int getAnchorY()
mouseDown(java.awt.event.MouseEvent, int, int)
public Undoable getUndoActivity()
getUndoActivity
in interface Tool
public void setUndoActivity(Undoable newUndoActivity)
setUndoActivity
in interface Tool
public boolean isActive()
Tool
isActive
in interface Tool
Tool.isEnabled()
,
Tool.isUsable()
public void addToolListener(ToolListener newToolListener)
addToolListener
in interface Tool
public void removeToolListener(ToolListener oldToolListener)
removeToolListener
in interface Tool
protected AbstractTool.EventDispatcher getEventDispatcher()
protected AbstractTool.EventDispatcher createEventDispatcher()
protected ViewChangeListener createViewChangeListener()
protected void checkUsable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |