public class TextAreaCreationTool extends CreationTool implements java.awt.event.ActionListener
To create a figure using the TextAreaCreationTool, the user does the following mouse gestures on a DrawingView:
To edit an existing text figure using the TextAreaCreationTool, the user does the following mouse gesture on a DrawingView:
The TextAreaCreationTool then uses Figure.findFigureInside to find a Figure that implements the TextHolderFigure interface and that is editable. Then it overlays a text area over the drawing where the user can enter the text for the Figure.
XXX - Maybe this class should be split up into a CreateTextAreaTool and a EditTextAreaTool.
Framework
The text creation and editing tools and the TextHolderFigure
interface define together the contracts of a smaller framework inside of the
JHotDraw framework for structured drawing editors.
Contract: TextHolderFigure
, TextCreationTool
,
TextAreaCreationTool
, TextEditingTool
,
TextAreaEditingTool
, FloatingTextField
,
FloatingTextArea
.
Prototype
The text creation tools create new figures by cloning a prototype
TextHolderFigure
object.
Prototype: TextHolderFigure
; Client: TextCreationTool
,
TextAreaCreationTool
.
createdFigure, minimalSize, minimalSizeTreshold, presentationName, prototype, prototypeAttributes
anchor, editor, isWorking, listenerList
propertySupport
Constructor and Description |
---|
TextAreaCreationTool(TextHolderFigure prototype)
Creates a new instance.
|
TextAreaCreationTool(TextHolderFigure prototype,
java.util.Map<AttributeKey,java.lang.Object> attributes) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event) |
protected void |
beginEdit(TextHolderFigure textHolder) |
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.
|
void |
draw(java.awt.Graphics2D g)
Draws the tool.
|
protected void |
endEdit() |
void |
mousePressed(java.awt.event.MouseEvent e)
Creates a new figure at the mouse location.
|
void |
setRubberbandColor(java.awt.Color c)
Sets the rubberband color for the tool.
|
activate, createFigure, getAddedFigure, getCreatedFigure, getPrototype, isToolDoneAfterCreation, mouseDragged, mouseReleased, setToolDoneAfterCreation, updateCursor
addToolListener, addUndoableEditListener, constrainPoint, constrainPoint, createActionMap, createInputMap, editCopy, editCut, editDelete, editDuplicate, editPaste, fireAreaInvalidated, fireAreaInvalidated, fireBoundsInvalidated, fireToolDone, fireToolStarted, getActionMap, getDrawing, getEditor, getInputMap, getToolTipText, getView, isActive, keyPressed, keyReleased, keyTyped, maybeFireBoundsInvalidated, mouseClicked, mouseEntered, mouseExited, mouseMoved, removeToolListener, removeUndoableEditListener, setActionMap, setInputMap, supportsHandleInteraction, viewToDrawing
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
public TextAreaCreationTool(TextHolderFigure prototype)
public TextAreaCreationTool(TextHolderFigure prototype, java.util.Map<AttributeKey,java.lang.Object> attributes)
public void setRubberbandColor(java.awt.Color c)
c
- Rubberband color or null.public void deactivate(DrawingEditor editor)
Tool
deactivate
in interface Tool
deactivate
in class CreationTool
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class CreationTool
protected void creationFinished(Figure createdFigure)
creationFinished
in class CreationTool
public void draw(java.awt.Graphics2D g)
Tool
draw
in interface Tool
draw
in class AbstractTool
protected void beginEdit(TextHolderFigure textHolder)
protected void endEdit()
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener