|
JHotDraw 7.5.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.tool.AbstractTool
org.jhotdraw.draw.tool.CreationTool
public class CreationTool
A Tool to create a new figure by drawing its bounds.
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.
Prototype
The creation tool creates new figures by cloning a prototype figure object.
That's the reason why Figure extends the Cloneable interface.
Prototype: Figure; Client: CreationTool.
| Field Summary | |
|---|---|
protected Figure |
createdFigure
The created figure. |
protected java.awt.Dimension |
minimalSize
We set the figure to this minimal size, if it is smaller than the minimal size treshold. |
protected java.awt.Dimension |
minimalSizeTreshold
Treshold for which we create a larger shape of a minimal size. |
protected java.lang.String |
presentationName
A localized name for this tool. |
protected Figure |
prototype
The prototype for new figures. |
protected java.util.Map<AttributeKey,java.lang.Object> |
prototypeAttributes
Attributes to be applied to the created ConnectionFigure. |
| Fields inherited from class org.jhotdraw.draw.tool.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. |
void |
updateCursor(DrawingView view,
java.awt.Point p)
|
| Methods inherited from class org.jhotdraw.beans.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Map<AttributeKey,java.lang.Object> prototypeAttributes
protected java.lang.String presentationName
protected java.awt.Dimension minimalSizeTreshold
protected java.awt.Dimension minimalSize
protected Figure prototype
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 Toolactivate in class AbstractToolpublic void deactivate(DrawingEditor editor)
Tool
deactivate in interface Tooldeactivate in class AbstractToolpublic void mousePressed(java.awt.event.MouseEvent evt)
mousePressed in interface java.awt.event.MouseListenermousePressed in class AbstractToolpublic void mouseDragged(java.awt.event.MouseEvent evt)
public void mouseReleased(java.awt.event.MouseEvent evt)
mouseReleased in interface java.awt.event.MouseListenermouseReleased in class AbstractToolprotected Figure createFigure()
protected Figure getCreatedFigure()
protected Figure getAddedFigure()
protected void creationFinished(Figure createdFigure)
public void setToolDoneAfterCreation(boolean newValue)
public boolean isToolDoneAfterCreation()
public void updateCursor(DrawingView view,
java.awt.Point p)
updateCursor in class AbstractTool
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||