org.tigris.gef.base
Class ModeCreateFigInk

java.lang.Object
  extended by org.tigris.gef.base.ModeImpl
      extended by org.tigris.gef.base.FigModifyingModeImpl
          extended by org.tigris.gef.base.ModeCreate
              extended by org.tigris.gef.base.ModeCreateFigInk
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.util.EventListener, FigModifyingMode, Mode

public class ModeCreateFigInk
extends ModeCreate

A Mode to interpert user input while creating a FigInk. When creating a FigInk, new points are being added on mouseDragged, and a single mouseReleased ends the Mode. A new point is added whenever the mouse moves a minimum distance.

See Also:
Serialized Form

Field Summary
protected  int _lastX
          The position of the last point that was added.
protected  int _lastY
          The position of the last point that was added.
static int MIN_DELTA
          the minium distance that the mouse must move before a new point is added.
 
Fields inherited from class org.tigris.gef.base.ModeCreate
_defaultHeight, _defaultWidth, _newItem, anchorX, anchorY
 
Fields inherited from class org.tigris.gef.base.FigModifyingModeImpl
editor
 
Fields inherited from class org.tigris.gef.base.ModeImpl
_args
 
Constructor Summary
ModeCreateFigInk()
           
 
Method Summary
 Fig createNewItem(java.awt.event.MouseEvent me, int snapX, int snapY)
          Create a new FigInk instance based on the given mouse down event and the state of the parent Editor.
protected  void creationDrag(int x, int y)
          Update the new item to reflect the new mouse position.
 java.lang.String instructions()
          Reply a string of instructions that should be shown in the statusbar when this mode starts.
 void mouseDragged(java.awt.event.MouseEvent me)
          Dragging adds points to the ink.
protected  boolean nearLast(int x, int y)
          Internal function to test if the current point is so close to the last point that it should not be added to the ink.
 
Methods inherited from class org.tigris.gef.base.ModeCreate
createFig, getInitialCursor, keyPressed, mousePressed, mouseReleased, paint
 
Methods inherited from class org.tigris.gef.base.FigModifyingModeImpl
done, getEditor, isFigEnclosedIn, print, setCursor, setEditor
 
Methods inherited from class org.tigris.gef.base.ModeImpl
canExit, getArg, getArgs, init, keyReleased, keyTyped, leave, mouseClicked, mouseEntered, mouseExited, mouseMoved, setArg, setArgs, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tigris.gef.base.Mode
canExit, getArg, getArgs, init, setArg, setArgs, start
 

Field Detail

MIN_DELTA

public static final int MIN_DELTA
the minium distance that the mouse must move before a new point is added.

See Also:
Constant Field Values

_lastX

protected int _lastX
The position of the last point that was added.


_lastY

protected int _lastY
The position of the last point that was added.

Constructor Detail

ModeCreateFigInk

public ModeCreateFigInk()
Method Detail

instructions

public java.lang.String instructions()
Description copied from class: FigModifyingModeImpl
Reply a string of instructions that should be shown in the statusbar when this mode starts.

Specified by:
instructions in interface FigModifyingMode
Overrides:
instructions in class FigModifyingModeImpl

createNewItem

public Fig createNewItem(java.awt.event.MouseEvent me,
                         int snapX,
                         int snapY)
Create a new FigInk instance based on the given mouse down event and the state of the parent Editor.

Specified by:
createNewItem in class ModeCreate

creationDrag

protected void creationDrag(int x,
                            int y)
Description copied from class: ModeCreate
Update the new item to reflect the new mouse position. By default let the new item set its size, subclasses may override. If the user simply clicks instead of dragging then use the default size. If the user actually drags out a Fig, then use its size as the new default size.

Overrides:
creationDrag in class ModeCreate
See Also:
ModeCreate.creationDrag(int, int)

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
Dragging adds points to the ink.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class ModeCreate

nearLast

protected boolean nearLast(int x,
                           int y)
Internal function to test if the current point is so close to the last point that it should not be added to the ink.