Back to index

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

Tool to scribble a PolyLineFigure. More...

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

List of all members.

Public Member Functions

 ScribbleTool (DrawingView view)
void activate ()
 Activates the tool for the given view.
void deactivate ()
 Deactivates the tool.
void mouseDown (MouseEvent e, int x, int y)
 Handles mouse down events in the drawing view.
void mouseDrag (MouseEvent e, int x, int y)
 Handles mouse drag events in the drawing view.
void mouseUp (MouseEvent e, int x, int y)
 Handles mouse up in the drawing view.
void mouseMove (MouseEvent evt, int x, int y)
 Handles mouse moves (if the mouse button is up).
void keyDown (KeyEvent evt, int key)
 Handles key down events in the drawing view.
Drawing drawing ()
 Gets the tool's drawing.
DrawingEditor editor ()
 Gets the tool's editor.
DrawingView view ()
 Gets the tool's view.

Protected Attributes

DrawingView fView
int fAnchorX
 The position of the initial mouse down.

Package Attributes

int fLastY
int fAnchorY

Private Member Functions

void point (int x, int y)

Private Attributes

PolyLineFigure fScribble
int fLastX

Detailed Description

Tool to scribble a PolyLineFigure.

See also:
PolyLineFigure

Definition at line 18 of file ScribbleTool.java.


Constructor & Destructor Documentation

CH.ifa.draw.figures.ScribbleTool.ScribbleTool ( DrawingView  view) [inline]

Definition at line 23 of file ScribbleTool.java.

                                          {
        super(view);
    }

Member Function Documentation

Activates the tool for the given view.

This method is called whenever the user switches to this tool. Use this method to reinitialize a tool.

Reimplemented from CH.ifa.draw.standard.AbstractTool.

Definition at line 27 of file ScribbleTool.java.

                           {
        super.activate();
        fScribble = null;
    }

Deactivates the tool.

This method is called whenever the user switches to another tool. Use this method to do some clean-up when the tool is switched. Subclassers should always call super.deactivate.

Reimplemented from CH.ifa.draw.standard.AbstractTool.

Definition at line 32 of file ScribbleTool.java.

                             {
        super.deactivate();
        if (fScribble != null) {
            if (fScribble.size().width < 4 || fScribble.size().height < 4)
                drawing().remove(fScribble);
        }
    }

Here is the call graph for this function:

Drawing CH.ifa.draw.standard.AbstractTool.drawing ( ) [inline, inherited]

Gets the tool's drawing.

Definition at line 90 of file AbstractTool.java.

                             {
        return fView.drawing();
    }

Here is the caller graph for this function:

DrawingEditor CH.ifa.draw.standard.AbstractTool.editor ( ) [inline, inherited]

Gets the tool's editor.

Definition at line 97 of file AbstractTool.java.

                                  {
        return fView.editor();
    }

Here is the caller graph for this function:

void CH.ifa.draw.standard.AbstractTool.keyDown ( KeyEvent  evt,
int  key 
) [inline, inherited]

Handles key down events in the drawing view.

Definition at line 84 of file AbstractTool.java.

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

Handles mouse down events in the drawing view.

Reimplemented from CH.ifa.draw.standard.AbstractTool.

Definition at line 51 of file ScribbleTool.java.

                                                      {
        if (e.getClickCount() >= 2) {
            fScribble = null;
            editor().toolDone();
        }
        else {
            // use original event coordinates to avoid
            // supress that the scribble is constrained to
            // the grid
            point(e.getX(), e.getY());
        }
    }

Here is the call graph for this function:

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

Handles mouse drag events in the drawing view.

Reimplemented from CH.ifa.draw.standard.AbstractTool.

Definition at line 64 of file ScribbleTool.java.

                                                      {
        if (fScribble != null)
            point(e.getX(), e.getY());
    }

Here is the call graph for this function:

void CH.ifa.draw.standard.AbstractTool.mouseMove ( MouseEvent  evt,
int  x,
int  y 
) [inline, inherited]

Handles mouse moves (if the mouse button is up).

Reimplemented in CH.ifa.draw.standard.ConnectionTool.

Definition at line 78 of file AbstractTool.java.

                                                        {
    }
void CH.ifa.draw.standard.AbstractTool.mouseUp ( MouseEvent  e,
int  x,
int  y 
) [inline, inherited]
void CH.ifa.draw.figures.ScribbleTool.point ( int  x,
int  y 
) [inline, private]

Definition at line 40 of file ScribbleTool.java.

                                     {
        if (fScribble == null) {
            fScribble = new PolyLineFigure(x, y);
            view().add(fScribble);
        } else if (fLastX != x || fLastY != y)
            fScribble.addPoint(x, y);

        fLastX = x;
        fLastY = y;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

DrawingView CH.ifa.draw.standard.AbstractTool.view ( ) [inline, inherited]

Gets the tool's view.

Definition at line 104 of file AbstractTool.java.

                              {
        return fView;
    }

Here is the caller graph for this function:


Member Data Documentation

int CH.ifa.draw.standard.AbstractTool.fAnchorX [protected, inherited]

The position of the initial mouse down.

Definition at line 27 of file AbstractTool.java.

Definition at line 27 of file AbstractTool.java.

Definition at line 21 of file ScribbleTool.java.

Definition at line 21 of file ScribbleTool.java.

Definition at line 20 of file ScribbleTool.java.

DrawingView CH.ifa.draw.standard.AbstractTool.fView [protected, inherited]

Definition at line 22 of file AbstractTool.java.


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