uci.gef
Class ModeSelect

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

public class ModeSelect
extends Mode

This class implements a Mode that interperts user input as selecting one or more Figs. Clicking on a Fig will select it. Shift-clicking will toggle whether it is selected. Dragging in open space will draw a selection rectangle. Dragging on a Fig will switch to ModeModify. Dragging from a port will switch to ModeCreateEdge. ModeSelect paints itself by displaying its selection rectangle if any.

Needs-More-Work: this mode has more responsibility than just making selections, it has become the "main mode" of the editor and it has taken resposibility for switching to other modes. I shuold probably implement a "UIDialog" class that would have a state machine that describes the various transitions between UI modes.

Needs-More-Work: There is currently a bug in shift clicking, you cannot unselect an individual item by shift-clicking on it.

See Also:
ModeCreateEdge, ModeModify, Fig, Editor, Serialized Form

Fields inherited from class uci.gef.Mode
_args, _editor
 
Constructor Summary
ModeSelect()
          Construct a new ModeSelect instance.
ModeSelect(Editor par)
          Construct a new ModeSelect with the given parent.
 
Method Summary
 boolean canExit()
          Always false because I never want to get out of selection mode.
protected  void gotoBroomMode(MouseEvent me)
           
protected  void gotoModifyMode(MouseEvent me)
          Set the Editor's Mode to ModeModify.
 String instructions()
          Reply a string of instructions that should be shown in the statusbar when this mode starts.
 void mouseDragged(MouseEvent me)
          On mouse dragging, stretch the selection rectangle.
 void mousePressed(MouseEvent me)
          Handle mouse down events by preparing for a drag.
 void mouseReleased(MouseEvent me)
          On mouse up, select or toggle the selection of items under the mouse or in the selection rectangle.
 void paint(Graphics g)
          Paint this mode by painting the selection rectangle if appropriate.
 
Methods inherited from class uci.gef.Mode
done, getArg, getArgs, getEditor, getInitialCursor, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mouseMoved, print, setArg, setArgs, setCursor, setEditor, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModeSelect

public ModeSelect(Editor par)
Construct a new ModeSelect with the given parent.

ModeSelect

public ModeSelect()
Construct a new ModeSelect instance. Its parent must be set before this instance can be used.
Method Detail

canExit

public boolean canExit()
Always false because I never want to get out of selection mode.
Overrides:
canExit in class Mode

mousePressed

public void mousePressed(MouseEvent me)
Handle mouse down events by preparing for a drag. If the mouse down event happens on a handle or an already selected object, and the shift key is not down, then go to ModeModify. If the mouse down event happens on a port, to to ModeCreateEdge.
Overrides:
mousePressed in class Mode

mouseDragged

public void mouseDragged(MouseEvent me)
On mouse dragging, stretch the selection rectangle.
Overrides:
mouseDragged in class Mode

mouseReleased

public void mouseReleased(MouseEvent me)
On mouse up, select or toggle the selection of items under the mouse or in the selection rectangle.
Overrides:
mouseReleased in class Mode

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

paint

public void paint(Graphics g)
Paint this mode by painting the selection rectangle if appropriate.
Overrides:
paint in class Mode

gotoModifyMode

protected void gotoModifyMode(MouseEvent me)
Set the Editor's Mode to ModeModify. Needs-More-Work: This should not be in ModeSelect, I wanted to move it to ModeModify, but it is too tighly integrated with ModeSelect.

gotoBroomMode

protected void gotoBroomMode(MouseEvent me)