org.objectweb.jac.ide.diagrams
Class TextTool

java.lang.Object
  extended byCH.ifa.draw.standard.AbstractTool
      extended byCH.ifa.draw.standard.CreationTool
          extended byorg.objectweb.jac.ide.diagrams.CreationTool
              extended byorg.objectweb.jac.ide.diagrams.TextTool
All Implemented Interfaces:
ActionListener, EventListener, KeyListener, CH.ifa.draw.framework.Tool, CH.ifa.draw.framework.ViewChangeListener

public class TextTool
extends CreationTool
implements ActionListener, KeyListener

Tool to create new or edit existing text figures. The editing behavior is implemented by overlaying the Figure providing the text with a FloatingTextField.

A tool interaction is done once a Figure that is not a TextHolder is clicked.

Version:
<$CURRENT_VERSION$>
See Also:
TextHolder, FloatingTextField

Nested Class Summary
 
Nested classes inherited from class CH.ifa.draw.standard.AbstractTool
CH.ifa.draw.standard.AbstractTool.EventDispatcher
 
Field Summary
 
Fields inherited from class CH.ifa.draw.standard.AbstractTool
fAnchorX, fAnchorY
 
Constructor Summary
TextTool(CH.ifa.draw.framework.DrawingEditor newDrawingEditor, CH.ifa.draw.framework.Figure prototype)
           
 
Method Summary
protected  void abortEdit()
           
 void actionPerformed(ActionEvent e)
           
 void activate()
          Sets the text cursor.
protected  void beginEdit(CH.ifa.draw.standard.TextHolder figure)
           
 void deactivate()
          Terminates the editing of a text figure.
protected  void endEdit()
           
protected  CH.ifa.draw.standard.TextHolder getTypingTarget()
           
 boolean isActivated()
          Test whether the text tool is currently activated and is displaying a overlay TextFigure for accepting input.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void mouseDown(MouseEvent e, int x, int y)
          If the pressed figure is a TextHolder it can be edited otherwise a new text figure is created.
 void mouseDrag(MouseEvent e, int x, int y)
           
 void mouseUp(MouseEvent e, int x, int y)
           
protected  void setTypingTarget(CH.ifa.draw.standard.TextHolder newTypingTarget)
           
 
Methods inherited from class org.objectweb.jac.ide.diagrams.CreationTool
isActive
 
Methods inherited from class CH.ifa.draw.standard.CreationTool
createFigure, getAddedFigure, getAnchorPoint, getCreatedFigure
 
Methods inherited from class CH.ifa.draw.standard.AbstractTool
addToolListener, checkUsable, createEventDispatcher, drawing, editor, getEventDispatcher, isEnabled, isUsable, keyDown, mouseMove, removeToolListener, setEnabled, setUsable, view, viewCreated, viewDestroying, viewSelectionChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextTool

public TextTool(CH.ifa.draw.framework.DrawingEditor newDrawingEditor,
                CH.ifa.draw.framework.Figure prototype)
Method Detail

mouseDown

public void mouseDown(MouseEvent e,
                      int x,
                      int y)
If the pressed figure is a TextHolder it can be edited otherwise a new text figure is created.

Specified by:
mouseDown in interface CH.ifa.draw.framework.Tool

mouseDrag

public void mouseDrag(MouseEvent e,
                      int x,
                      int y)
Specified by:
mouseDrag in interface CH.ifa.draw.framework.Tool
Overrides:
mouseDrag in class CreationTool

mouseUp

public void mouseUp(MouseEvent e,
                    int x,
                    int y)
Specified by:
mouseUp in interface CH.ifa.draw.framework.Tool

deactivate

public void deactivate()
Terminates the editing of a text figure.

Specified by:
deactivate in interface CH.ifa.draw.framework.Tool

activate

public void activate()
Sets the text cursor.

Specified by:
activate in interface CH.ifa.draw.framework.Tool

isActivated

public boolean isActivated()
Test whether the text tool is currently activated and is displaying a overlay TextFigure for accepting input.

Returns:
true, if the text tool has a accepting target TextFigure for its input, false otherwise

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

beginEdit

protected void beginEdit(CH.ifa.draw.standard.TextHolder figure)

endEdit

protected void endEdit()

abortEdit

protected void abortEdit()

setTypingTarget

protected void setTypingTarget(CH.ifa.draw.standard.TextHolder newTypingTarget)

getTypingTarget

protected CH.ifa.draw.standard.TextHolder getTypingTarget()