Back to index

moin  1.9.0~rc2
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
CH.ifa.draw.figures.TextTool Class Reference

Tool to create new or edit existing text figures. More...

Inheritance diagram for CH.ifa.draw.figures.TextTool:
Inheritance graph
[legend]
Collaboration diagram for CH.ifa.draw.figures.TextTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TextTool (DrawingView view, Figure prototype)
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)
void deactivate ()
 Terminates the editing of a text figure.
void activate ()
 Sets the text cursor.

Protected Member Functions

void beginEdit (TextHolder figure)
void endEdit ()

Private Member Functions

Rectangle fieldBounds (TextHolder figure)

Private Attributes

FloatingTextField fTextField
TextHolder fTypingTarget

Detailed Description

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.

See also:
TextHolder
FloatingTextField

Definition at line 24 of file TextTool.java.


Constructor & Destructor Documentation

CH.ifa.draw.figures.TextTool.TextTool ( DrawingView  view,
Figure  prototype 
) [inline]

Definition at line 29 of file TextTool.java.

                                                        {
        super(view, prototype);
    }

Member Function Documentation

Sets the text cursor.

Reimplemented in CH.ifa.draw.figures.ConnectedTextTool.

Definition at line 79 of file TextTool.java.

                           {
        super.activate();
        view().clearSelection();
        // JDK1.1 TEXT_CURSOR has an incorrect hot spot
        //view.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
    }
void CH.ifa.draw.figures.TextTool.beginEdit ( TextHolder  figure) [inline, protected]

Definition at line 86 of file TextTool.java.

                                                {
        if (fTextField == null)
            fTextField = new FloatingTextField();

       if (figure != fTypingTarget && fTypingTarget != null)
           endEdit();

        fTextField.createOverlay((Container)view(), figure.getFont());
       fTextField.setBounds(fieldBounds(figure), figure.getText());
       fTypingTarget = figure;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Terminates the editing of a text figure.

Definition at line 71 of file TextTool.java.

                             {
        super.deactivate();
        endEdit();
    }

Here is the call graph for this function:

void CH.ifa.draw.figures.TextTool.endEdit ( ) [inline, protected]

Definition at line 98 of file TextTool.java.

                             {
       if (fTypingTarget != null) {
           if (fTextField.getText().length() > 0)
              fTypingTarget.setText(fTextField.getText());
           else
              drawing().remove((Figure)fTypingTarget);
           fTypingTarget = null;
           fTextField.endOverlay();
           view().checkDamage();
       }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Rectangle CH.ifa.draw.figures.TextTool.fieldBounds ( TextHolder  figure) [inline, private]

Definition at line 110 of file TextTool.java.

                                                     {
       Rectangle box = figure.textDisplayBox();
       int nRows = figure.overlayRows();
       int nCols = figure.overlayColumns();
        Dimension d = fTextField.getPreferredSize(nRows, nCols);
        return new Rectangle(box.x, box.y, d.width, d.height);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void CH.ifa.draw.figures.TextTool.mouseDown ( MouseEvent  e,
int  x,
int  y 
) [inline]

If the pressed figure is a TextHolder it can be edited otherwise a new text figure is created.

Reimplemented in CH.ifa.draw.figures.ConnectedTextTool.

Definition at line 37 of file TextTool.java.

    {
           Figure pressedFigure;
           TextHolder textHolder = null;

           pressedFigure = drawing().findFigureInside(x, y);
           if (pressedFigure instanceof TextHolder) {
               textHolder = (TextHolder) pressedFigure;
               if (!textHolder.acceptsTyping())
                   textHolder = null;
        }
           if (textHolder != null) {
               beginEdit(textHolder);
               return;
           }
           if (fTypingTarget != null) {
               editor().toolDone();
               endEdit();
           } else {
           super.mouseDown(e, x, y);
           textHolder = (TextHolder)createdFigure();
           beginEdit(textHolder);
        }
    }

Here is the call graph for this function:

void CH.ifa.draw.figures.TextTool.mouseDrag ( MouseEvent  e,
int  x,
int  y 
) [inline]

Definition at line 62 of file TextTool.java.

                                                      {
    }
void CH.ifa.draw.figures.TextTool.mouseUp ( MouseEvent  e,
int  x,
int  y 
) [inline]

Definition at line 65 of file TextTool.java.

                                                    {
    }

Member Data Documentation

Definition at line 26 of file TextTool.java.

Definition at line 27 of file TextTool.java.


The documentation for this class was generated from the following file: