org.tigris.gef.base
Class FigModifyingModeImpl

java.lang.Object
  extended by org.tigris.gef.base.ModeImpl
      extended by org.tigris.gef.base.FigModifyingModeImpl
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.util.EventListener, FigModifyingMode, Mode
Direct Known Subclasses:
ModeBroom, ModeCreate, ModeDragScroll, ModeModify, ModePlace, ModePopup, ModeSelect

public class FigModifyingModeImpl
extends ModeImpl
implements FigModifyingMode

This is the default implementation for all Modes that are manipulating the visual representation of the underlying model. It is a subclass of ModeImpl and implements FigModifyingMode. The provide simple functionality and some instance variables only. Although this class can be instantiated, it is not designed to be used as an independent Mode. Any FigModifyingMode that is tend to be used by the system should be designed as a subclass of this class and overwrite the methods if necessary.

See Also:
Editor, FigModifyingMode, ModeImpl, Serialized Form

Field Summary
protected  Editor editor
          The Editor that is in this mode.
 
Fields inherited from class org.tigris.gef.base.ModeImpl
_args
 
Constructor Summary
FigModifyingModeImpl()
          Construct a new Mode instance without any Editor as its parent, the parent must be filled in before the instance is actually used.
FigModifyingModeImpl(Editor par)
          Construct a new Mode instance with the given Editor as its editor
FigModifyingModeImpl(java.util.Hashtable parameters)
          Constructs a new Mode instance with some initial parameters.
 
Method Summary
 void done()
          When a Mode handles a certain event that indicates that the user wants to exit that Mode (e.g., a mouse up event after a drag in ModeCreateEdge) the Mode calls done to make switching to another Mode possible.
 Editor getEditor()
          Get the parent Editor of this Mode
 java.awt.Cursor getInitialCursor()
          Returns the cursor that should be shown when this Mode starts.
 java.lang.String instructions()
          Reply a string of instructions that should be shown in the statusbar when this mode starts.
 boolean isFigEnclosedIn(Fig testedFig, Fig enclosingFig)
          Tests, if the actually handled fig is contained in the one given as parameter.
 void paint(java.awt.Graphics g)
          Modes can paint themselves to give the user feedback.
 void print(java.awt.Graphics g)
          Just calls paint(g) bt default.
 void setCursor(java.awt.Cursor c)
          Set the mouse cursor to some appropriate for this mode.
 void setEditor(Editor w)
          Set the parent Editor of this Mode
 
Methods inherited from class org.tigris.gef.base.ModeImpl
canExit, getArg, getArgs, init, keyPressed, keyReleased, keyTyped, leave, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, 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

editor

protected Editor editor
The Editor that is in this mode. Each Mode instance belongs to exactly one Editor instance.

Constructor Detail

FigModifyingModeImpl

public FigModifyingModeImpl(Editor par)
Construct a new Mode instance with the given Editor as its editor


FigModifyingModeImpl

public FigModifyingModeImpl(java.util.Hashtable parameters)
Constructs a new Mode instance with some initial parameters. At least a parameter representing the the Editor, this Mode belongs to, should be provided.


FigModifyingModeImpl

public FigModifyingModeImpl()
Construct a new Mode instance without any Editor as its parent, the parent must be filled in before the instance is actually used. This constructor is needed because CmdSetMode can only call Class.newInstance which does not pass constructor arguments. A call to init is necessary in order to let this instance work properly.

Method Detail

done

public void done()
Description copied from class: ModeImpl
When a Mode handles a certain event that indicates that the user wants to exit that Mode (e.g., a mouse up event after a drag in ModeCreateEdge) the Mode calls done to make switching to another Mode possible.

Specified by:
done in interface Mode
Overrides:
done in class ModeImpl

setEditor

public void setEditor(Editor w)
Set the parent Editor of this Mode

Specified by:
setEditor in interface FigModifyingMode

getEditor

public Editor getEditor()
Get the parent Editor of this Mode

Specified by:
getEditor in interface FigModifyingMode

getInitialCursor

public java.awt.Cursor getInitialCursor()
Returns the cursor that should be shown when this Mode starts.

Specified by:
getInitialCursor in interface FigModifyingMode

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

setCursor

public void setCursor(java.awt.Cursor c)
Set the mouse cursor to some appropriate for this mode.

Specified by:
setCursor in interface FigModifyingMode

paint

public void paint(java.awt.Graphics g)
Modes can paint themselves to give the user feedback. For example, ModePlace paints the object being placed. Mode's are drawn on top of (after) the Editor's current view and on top of any selections.

Specified by:
paint in interface FigModifyingMode

print

public void print(java.awt.Graphics g)
Just calls paint(g) bt default.

Specified by:
print in interface FigModifyingMode

isFigEnclosedIn

public boolean isFigEnclosedIn(Fig testedFig,
                               Fig enclosingFig)
Description copied from interface: FigModifyingMode
Tests, if the actually handled fig is contained in the one given as parameter.

Specified by:
isFigEnclosedIn in interface FigModifyingMode