org.tigris.gef.base
Class CmdZoom

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.tigris.gef.base.Cmd
          extended by org.tigris.gef.base.CmdZoom
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

public class CmdZoom
extends Cmd

Cmd zoom the view. Needs-More-Work:

See Also:
Serialized Form

Field Summary
protected  double _magnitude
           
 
Fields inherited from class org.tigris.gef.base.Cmd
_args, _resource
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
CmdZoom()
          Default behaviour is to restore scaling to 1.0 (1 to 1)
CmdZoom(double magnitude)
          Each time doIt() is invoked, adjust scaling by a factor of magnitude.
 
Method Summary
 void doIt()
          Adjust the scale factor of the current editor.
 void undoIt()
          Undo the zoom.
protected static java.lang.String wordFor(double magnitude)
          Convert the zoom magnitude to an English description.
 
Methods inherited from class org.tigris.gef.base.Cmd
about, actionPerformed, cmdAtIndex, containsArg, getArg, getArg, getName, getResource, register, registeredCmds, setArg, setName, setResource, shouldBeEnabled, updateEnabled
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_magnitude

protected double _magnitude
Constructor Detail

CmdZoom

public CmdZoom()
Default behaviour is to restore scaling to 1.0 (1 to 1)


CmdZoom

public CmdZoom(double magnitude)
Each time doIt() is invoked, adjust scaling by a factor of magnitude.

Parameters:
magnitude - the factor by which to adjust the Editor's scaling. Must be greater than or equal to zero. If zero, resets the Editor's scale factor to 1.
Method Detail

wordFor

protected static java.lang.String wordFor(double magnitude)
Convert the zoom magnitude to an English description.


doIt

public void doIt()
Adjust the scale factor of the current editor.

Specified by:
doIt in class Cmd

undoIt

public void undoIt()
Undo the zoom. Does not yet work for magnitude of 0 (a reset), and is subject to skew due to precision errors since for floats we cannot assume (x * f / f) == x

Specified by:
undoIt in class Cmd