|
||||||||||
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
org.jhotdraw.contrib.TextAreaTool
A TextAreaTool creates TextAreaFigures.
To create a new text area, the user drags a rectangle on the drawing on
a free spot.
When releasing the mouse the tool calls the area's editor to enter the text.
If the tool is clicked on an existing area the tool simply calls the
area's editor.
When creating a new area, if the user leaves the text empty, the newly created
area figure is discarded.
Nested Class Summary | |
static class |
TextAreaTool.UndoActivity
Handles undo/redo for text areas |
Nested classes inherited from class org.jhotdraw.standard.AbstractTool |
AbstractTool.EventDispatcher |
Field Summary | |
protected Figure |
fEditedFigure
The edited figure |
protected FloatingTextArea |
fTextField
The field used for editing |
protected TextHolder |
fTypingTarget
The typing target |
Constructor Summary | |
TextAreaTool(DrawingEditor newDrawingEditor,
Figure prototype)
Constructor for the TextAreaTool object |
Method Summary | |
void |
activate()
Activates the figure's editor |
protected void |
beginEdit(TextHolder figure,
Figure selectedFigure)
Begins editing the figure's text |
protected Undoable |
createUndoActivity()
Factory method for undo activity |
void |
deactivate()
Terminates the editing of a text figure. |
protected void |
endEdit()
Ends editing of the figure's text |
protected Figure |
getEditedFigure()
Gets the editedFigure attribute of the TextAreaTool |
protected java.awt.Font |
getFont(TextHolder figure)
Gets the font to be used for editing the figure |
protected TextHolder |
getTypingTarget()
Gets the typingTarget attribute of the TextAreaTool |
boolean |
isActivated()
Test whether the text tool is currently activated and is displaying a overlay TextFigure for accepting input. |
void |
mouseDown(java.awt.event.MouseEvent e,
int x,
int y)
If the pressed figure is a TextHolder and it accepts editing it can be edited. |
void |
mouseDrag(java.awt.event.MouseEvent e,
int x,
int y)
Drags to set the initial text area display box |
void |
mouseUp(java.awt.event.MouseEvent e,
int x,
int y)
If creating a figure it ends the creation process and calls the editor |
protected void |
setEditedFigure(Figure figure)
Sets the editedFigure attribute of the TextAreaTool |
protected void |
setTypingTarget(TextHolder newTypingTarget)
Sets the typingTarget attribute of the TextAreaTool |
Methods inherited from class org.jhotdraw.standard.CreationTool |
createFigure, getAddedFigure, getAddedFigures, getCreatedFigure, getPrototypeFigure, setAddedFigure, setAddedFigures, setCreatedFigure, setPrototypeFigure |
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 |
Field Detail |
protected FloatingTextArea fTextField
protected TextHolder fTypingTarget
protected Figure fEditedFigure
Constructor Detail |
public TextAreaTool(DrawingEditor newDrawingEditor, Figure prototype)
newDrawingEditor
- the managing drawing editorprototype
- the prototype for the figureMethod Detail |
public void mouseDown(java.awt.event.MouseEvent e, int x, int y)
mouseDown
in interface Tool
mouseDown
in class CreationTool
e
- Description of the Parameterx
- Description of the Parametery
- Description of the Parameterpublic void mouseDrag(java.awt.event.MouseEvent e, int x, int y)
mouseDrag
in interface Tool
mouseDrag
in class CreationTool
e
- Description of the Parameterx
- Description of the Parametery
- Description of the Parameterpublic void mouseUp(java.awt.event.MouseEvent e, int x, int y)
mouseUp
in interface Tool
mouseUp
in class CreationTool
e
- Description of the Parameterx
- Description of the Parametery
- Description of the ParameterFigure.isEmpty()
public void deactivate()
deactivate
in interface Tool
deactivate
in class CreationTool
Tool.deactivate()
public void activate()
activate
in interface Tool
activate
in class CreationTool
public boolean isActivated()
protected void beginEdit(TextHolder figure, Figure selectedFigure)
figure
- the typing targetselectedFigure
- the edited figureprotected java.awt.Font getFont(TextHolder figure)
figure
- the figure
protected void endEdit()
protected void setTypingTarget(TextHolder newTypingTarget)
newTypingTarget
- The new typingTarget valueprotected Figure getEditedFigure()
protected void setEditedFigure(Figure figure)
figure
- The new editedFigure valueprotected TextHolder getTypingTarget()
protected Undoable createUndoActivity()
createUndoActivity
in class CreationTool
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |