|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.standard.AbstractTool
org.jhotdraw.standard.CreationTool
A tool to create new figures. The figure to be created is specified by a prototype.
Prototype
CreationTool creates new figures by cloning a prototype.
Figure
,
Object.clone()
Nested Class Summary |
Nested classes inherited from class org.jhotdraw.standard.AbstractTool |
AbstractTool.EventDispatcher |
Constructor Summary | |
protected |
CreationTool(DrawingEditor newDrawingEditor)
Constructs a CreationTool without a prototype. |
|
CreationTool(DrawingEditor newDrawingEditor,
Figure prototype)
Initializes a CreationTool with the given prototype. |
Method Summary | |
void |
activate()
Sets the cross hair cursor. |
protected Figure |
createFigure()
Creates a new figure by cloning the prototype. |
protected Undoable |
createUndoActivity()
Factory method for undo activity |
void |
deactivate()
Deactivates the tool. |
protected Figure |
getAddedFigure()
Gets the figure that was actually added Note, this can be a different figure from the one which has been created. |
protected java.util.List |
getAddedFigures()
Gets the list of currently added figure |
protected Figure |
getCreatedFigure()
Gets the currently created figure |
protected Figure |
getPrototypeFigure()
As the name suggests this CreationTool uses the Prototype design pattern. |
void |
mouseDown(java.awt.event.MouseEvent e,
int x,
int y)
Creates a new figure by cloning the prototype. |
void |
mouseDrag(java.awt.event.MouseEvent e,
int x,
int y)
Adjusts the extent of the created figure |
void |
mouseUp(java.awt.event.MouseEvent e,
int x,
int y)
Checks if the created figure is empty. |
protected void |
setAddedFigure(Figure newAddedFigure)
Sets the addedFigure attribute of the CreationTool object |
protected void |
setAddedFigures(java.util.List newAddedFigures)
Sets the addedFigures attribute of the CreationTool object |
protected void |
setCreatedFigure(Figure newCreatedFigure)
Sets the createdFigure attribute of the CreationTool object |
protected void |
setPrototypeFigure(Figure newPrototypeFigure)
As the name suggests this CreationTool uses the Prototype design pattern. |
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, 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 |
public CreationTool(DrawingEditor newDrawingEditor, Figure prototype)
protected CreationTool(DrawingEditor newDrawingEditor)
Method Detail |
public void activate()
activate
in interface Tool
activate
in class AbstractTool
public void deactivate()
AbstractTool
deactivate
in interface Tool
deactivate
in class AbstractTool
Tool.deactivate()
public void mouseDown(java.awt.event.MouseEvent e, int x, int y)
mouseDown
in interface Tool
mouseDown
in class AbstractTool
protected Figure createFigure()
public void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
mouseDrag
in interface Tool
mouseDrag
in class AbstractTool
public void mouseUp(java.awt.event.MouseEvent e, int x, int y)
mouseUp
in interface Tool
mouseUp
in class AbstractTool
Figure.isEmpty()
protected void setPrototypeFigure(Figure newPrototypeFigure)
newPrototypeFigure
- figure to be cloned to create new figuresprotected Figure getPrototypeFigure()
protected java.util.List getAddedFigures()
protected void setAddedFigures(java.util.List newAddedFigures)
protected Figure getCreatedFigure()
protected void setCreatedFigure(Figure newCreatedFigure)
protected Figure getAddedFigure()
protected void setAddedFigure(Figure newAddedFigure)
protected Undoable createUndoActivity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |