org.tigris.gef.base
Class ModeSelect

java.lang.Object
  extended by org.tigris.gef.base.ModeImpl
      extended by org.tigris.gef.base.FigModifyingModeImpl
          extended by org.tigris.gef.base.ModeSelect
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 ModeSelect
extends FigModifyingModeImpl

This class implements a Mode that interprets 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 should probably implement a "UIDialog" class that would have a state machine that describes the various transitions between UI modes.

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

Field Summary
 
Fields inherited from class org.tigris.gef.base.FigModifyingModeImpl
editor
 
Fields inherited from class org.tigris.gef.base.ModeImpl
_args
 
Constructor Summary
ModeSelect()
          Construct a new ModeSelect instance.
ModeSelect(Editor parent)
          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(java.awt.event.MouseEvent me)
           
protected  void gotoModifyMode(java.awt.event.MouseEvent me)
          Set the Editor's Mode to ModeModify.
 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)
          On mouse dragging, stretch the selection rectangle.
 void mousePressed(java.awt.event.MouseEvent me)
          Handle mouse down events by preparing for a drag.
 void mouseReleased(java.awt.event.MouseEvent me)
          On mouse up, select or toggle the selection of items under the mouse or in the selection rectangle.
 void paint(java.awt.Graphics g)
          Paint this mode by painting the selection rectangle if appropriate.
 
Methods inherited from class org.tigris.gef.base.FigModifyingModeImpl
done, getEditor, getInitialCursor, isFigEnclosedIn, print, setCursor, setEditor
 
Methods inherited from class org.tigris.gef.base.ModeImpl
getArg, getArgs, init, keyPressed, 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
getArg, getArgs, init, setArg, setArgs, start
 

Constructor Detail

ModeSelect

public ModeSelect(Editor parent)
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.

Specified by:
canExit in interface Mode
Overrides:
canExit in class ModeImpl
See Also:
ModeManager

mousePressed

public void mousePressed(java.awt.event.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, go to ModeCreateEdge.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class ModeImpl

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)
On mouse dragging, stretch the selection rectangle.

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

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
On mouse up, select or toggle the selection of items under the mouse or in the selection rectangle.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class ModeImpl

instructions

public java.lang.String instructions()
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

paint

public void paint(java.awt.Graphics g)
Paint this mode by painting the selection rectangle if appropriate.

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

gotoModifyMode

protected void gotoModifyMode(java.awt.event.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(java.awt.event.MouseEvent me)