uci.gef
Class ModeModify

java.lang.Object
  |
  +--uci.gef.Mode
        |
        +--uci.gef.ModeModify

public class ModeModify
extends Mode

A Mode to process events from the Editor when the user is modifying a Fig. Right now users can drag one or more Figs around the drawing area, or they can move a handle on a single Fig.

See Also:
Fig, Seleciton, Serialized Form

Field Summary
protected  Point _anchor
          The point relative to the original postition of the Fig where the dragging started.
protected  int _constraint
          Indicates the kind of movement constraint being applied.
protected  Handle _curHandle
          The index of the handle that the user is dragging
protected  Rectangle _highlightTrap
           
protected  int _lastX
          the mouse location for the most recent drag event
protected  int _lastY
          the mouse location for the most recent drag event
protected  boolean _minDeltaAchieved
          Has the mouse moved enough to indicate that the user really wants to modify somthing?
protected  int _startX
          the mouse location for the first mouse down event
protected  int _startY
          the mouse location for the first mouse down event
static int HORIZONTAL_CONSTRAINT
          When _constraint == HORIZONTAL_CONSTRAINT, the user can only move selections left and right.
static int MIN_DELTA
          Minimum amoun that the user must move the mouse to indicate that he really wants to modify something.
static int NO_CONSTRAINT
          When _constraint == NO_CONSTRAINT, user can move selections any way
static int VERTICAL_CONSTRAINT
          When _constraint == VERTICAL_CONSTRAINT, the user can only move selections up and down.
 
Fields inherited from class uci.gef.Mode
_args, _editor
 
Constructor Summary
ModeModify(Editor par)
          Construct a new ModeModify with the given parent, and set the Anchor point to a default location (the _anchor's proper position will be determioned on mouse down).
 
Method Summary
protected  boolean checkMinDelta(int x, int y)
          Reply true if the user had moved the mouse enough to signify that (s)he really wants to make a change.
 void done()
           
 String instructions()
          Reply a string of instructions that should be shown in the statusbar when this mode starts.
protected  boolean legal(int dx, int dy, SelectionManager sm, MouseEvent me)
           
 void mouseDragged(MouseEvent me)
          When the user drags the mouse two things can happen: (1) if the user is dragging the body of one or more Figs then they are all moved around the drawing area, or (2) if the user started dragging on a handle of one Fig then the user can drag the handle around the drawing area and the Fig reacts to that.
 void mousePressed(MouseEvent me)
          When the user presses the mouse button on a Fig, this Mode starts preparing for future drag events by finding if a handle was clicked on.
 void mouseReleased(MouseEvent me)
          On mouse up the modification interaction is done.
 void paint(Graphics g)
           
 void start()
           
 
Methods inherited from class uci.gef.Mode
canExit, getArg, getArgs, getEditor, getInitialCursor, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, print, setArg, setArgs, setCursor, setEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_DELTA

public static final int MIN_DELTA
Minimum amoun that the user must move the mouse to indicate that he really wants to modify something.

NO_CONSTRAINT

public static final int NO_CONSTRAINT
When _constraint == NO_CONSTRAINT, user can move selections any way

HORIZONTAL_CONSTRAINT

public static final int HORIZONTAL_CONSTRAINT
When _constraint == HORIZONTAL_CONSTRAINT, the user can only move selections left and right.

VERTICAL_CONSTRAINT

public static final int VERTICAL_CONSTRAINT
When _constraint == VERTICAL_CONSTRAINT, the user can only move selections up and down.

_anchor

protected Point _anchor
The point relative to the original postition of the Fig where the dragging started. Keeping this point allows the user to "grip" any part of the Fig, rather than just dragging its position (or "pin") around.

_lastX

protected int _lastX
the mouse location for the most recent drag event

_lastY

protected int _lastY
the mouse location for the most recent drag event

_startX

protected int _startX
the mouse location for the first mouse down event

_startY

protected int _startY
the mouse location for the first mouse down event

_minDeltaAchieved

protected boolean _minDeltaAchieved
Has the mouse moved enough to indicate that the user really wants to modify somthing?

_curHandle

protected Handle _curHandle
The index of the handle that the user is dragging

_constraint

protected int _constraint
Indicates the kind of movement constraint being applied. Possible values are NO_CONSTRAINT, HORIZONTAL_CONSTRAINT, or VERTICAL_CONSTRAINT.

_highlightTrap

protected Rectangle _highlightTrap
Constructor Detail

ModeModify

public ModeModify(Editor par)
Construct a new ModeModify with the given parent, and set the Anchor point to a default location (the _anchor's proper position will be determioned on mouse down).
Method Detail

instructions

public String instructions()
Reply a string of instructions that should be shown in the statusbar when this mode starts.
Overrides:
instructions in class Mode

mouseDragged

public void mouseDragged(MouseEvent me)
When the user drags the mouse two things can happen: (1) if the user is dragging the body of one or more Figs then they are all moved around the drawing area, or (2) if the user started dragging on a handle of one Fig then the user can drag the handle around the drawing area and the Fig reacts to that.
Overrides:
mouseDragged in class Mode

mousePressed

public void mousePressed(MouseEvent me)
When the user presses the mouse button on a Fig, this Mode starts preparing for future drag events by finding if a handle was clicked on. This event is passed from ModeSelect.
Overrides:
mousePressed in class Mode

mouseReleased

public void mouseReleased(MouseEvent me)
On mouse up the modification interaction is done.
Overrides:
mouseReleased in class Mode

start

public void start()
Overrides:
start in class Mode

done

public void done()
Overrides:
done in class Mode

paint

public void paint(Graphics g)
Overrides:
paint in class Mode

checkMinDelta

protected boolean checkMinDelta(int x,
                                int y)
Reply true if the user had moved the mouse enough to signify that (s)he really wants to make a change.

legal

protected boolean legal(int dx,
                        int dy,
                        SelectionManager sm,
                        MouseEvent me)