|
JHotDraw 7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.beans.AbstractBean
org.jhotdraw.draw.AbstractTool
org.jhotdraw.draw.CreationTool
public class CreationTool
A tool to create new figures. The figure to be created is specified by a prototype.
To create a figure using the CreationTool, the user does the following mouse gestures on a DrawingView:
Alltough the mouse gestures might be fitting for the creation of a connection, the CreationTool is not suited for the creation of a ConnectionFigure. Use the ConnectionTool for this type of figures instead.
Field Summary | |
---|---|
protected Figure |
createdFigure
The created figure. |
Fields inherited from class org.jhotdraw.draw.AbstractTool |
---|
anchor, editor, isWorking, listenerList |
Fields inherited from class org.jhotdraw.beans.AbstractBean |
---|
propertySupport |
Constructor Summary | |
---|---|
CreationTool(Figure prototype)
Creates a new instance with the specified prototype but without an attribute set. |
|
CreationTool(Figure prototype,
java.util.Map<AttributeKey,java.lang.Object> attributes)
Creates a new instance with the specified prototype but without an attribute set. |
|
CreationTool(Figure prototype,
java.util.Map<AttributeKey,java.lang.Object> attributes,
java.lang.String name)
Deprecated. This constructor might go away, because the name parameter is not used. |
|
CreationTool(java.lang.String prototypeClassName)
Creates a new instance. |
|
CreationTool(java.lang.String prototypeClassName,
java.util.Map<AttributeKey,java.lang.Object> attributes)
|
|
CreationTool(java.lang.String prototypeClassName,
java.util.Map<AttributeKey,java.lang.Object> attributes,
java.lang.String name)
|
Method Summary | |
---|---|
void |
activate(DrawingEditor editor)
Activates the tool for the given editor. |
protected Figure |
createFigure()
|
protected void |
creationFinished(Figure createdFigure)
This method allows subclasses to do perform additonal user interactions after the new figure has been created. |
void |
deactivate(DrawingEditor editor)
Deactivates the tool. |
protected Figure |
getAddedFigure()
|
protected Figure |
getCreatedFigure()
|
Figure |
getPrototype()
|
boolean |
isToolDoneAfterCreation()
Returns true, if this tool fires toolDone immediately after a new figure has been created. |
void |
mouseDragged(java.awt.event.MouseEvent evt)
|
void |
mousePressed(java.awt.event.MouseEvent evt)
|
void |
mouseReleased(java.awt.event.MouseEvent evt)
|
void |
setToolDoneAfterCreation(boolean newValue)
If this is set to false, the CreationTool does not fire toolDone after a new Figure has been created. |
Methods inherited from class org.jhotdraw.draw.AbstractTool |
---|
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, draw, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getView, isActive, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, updateCursor, viewToDrawing |
Methods inherited from class org.jhotdraw.beans.AbstractBean |
---|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Figure createdFigure
Constructor Detail |
---|
public CreationTool(java.lang.String prototypeClassName)
public CreationTool(java.lang.String prototypeClassName, java.util.Map<AttributeKey,java.lang.Object> attributes)
public CreationTool(java.lang.String prototypeClassName, java.util.Map<AttributeKey,java.lang.Object> attributes, java.lang.String name)
public CreationTool(Figure prototype)
prototype
- The prototype used to create a new Figure.public CreationTool(Figure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes)
prototype
- The prototype used to create a new Figure.attributes
- The CreationTool applies these attributes to the
prototype after having applied the default attributes from the DrawingEditor.public CreationTool(Figure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes, java.lang.String name)
prototype
- The prototype used to create a new Figure.attributes
- The CreationTool applies these attributes to the
prototype after having applied the default attributes from the DrawingEditor.name
- The name parameter is currently not used.Method Detail |
---|
public Figure getPrototype()
public void activate(DrawingEditor editor)
Tool
activate
in interface Tool
activate
in class AbstractTool
public void deactivate(DrawingEditor editor)
Tool
deactivate
in interface Tool
deactivate
in class AbstractTool
public void mousePressed(java.awt.event.MouseEvent evt)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class AbstractTool
public void mouseDragged(java.awt.event.MouseEvent evt)
public void mouseReleased(java.awt.event.MouseEvent evt)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class AbstractTool
protected Figure createFigure()
protected Figure getCreatedFigure()
protected Figure getAddedFigure()
protected void creationFinished(Figure createdFigure)
public void setToolDoneAfterCreation(boolean newValue)
public boolean isToolDoneAfterCreation()
|
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |