JHotDraw 6.0b1

org.jhotdraw.contrib.zoom
Class ZoomCommand

java.lang.Object
  extended by org.jhotdraw.standard.AbstractCommand
      extended by org.jhotdraw.contrib.zoom.ZoomCommand
All Implemented Interfaces:
FigureSelectionListener, Command

public class ZoomCommand
extends AbstractCommand

A ZoomCommand allows for applying a zoom factor to a ZoomDrawingView.
Several ZoomCommand objects can be created in a menu or toolbar, set to various predefined zoom factors


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jhotdraw.standard.AbstractCommand
AbstractCommand.EventDispatcher
 
Field Summary
protected  float scale
          The scale factor to apply
 
Constructor Summary
ZoomCommand(java.lang.String newSame, float newScale, DrawingEditor newDrawingEditor)
          Constructor for the ZoomCommand object
 
Method Summary
 void execute()
          Executes the command
 float getScale()
          Gets the scale attribute of the ZoomCommand object
protected  boolean isExecutableWithView()
          Returns true if the command is executable with the current view
 void setScale(float newScale)
          Sets the scale attribute of the ZoomCommand object
 ZoomDrawingView zoomView()
          Sets the zoom factor of the view
 
Methods inherited from class org.jhotdraw.standard.AbstractCommand
addCommandListener, createEventDispatcher, createViewChangeListener, dispose, figureSelectionChanged, getDrawingEditor, getEventDispatcher, getUndoActivity, isExecutable, isViewRequired, name, removeCommandListener, setName, setUndoActivity, view, viewCreated, viewDestroying, viewSelectionChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scale

protected float scale
The scale factor to apply

Constructor Detail

ZoomCommand

public ZoomCommand(java.lang.String newSame,
                   float newScale,
                   DrawingEditor newDrawingEditor)
Constructor for the ZoomCommand object

Parameters:
name - the command name
scale - Description of the Parameter
newDrawingEditor - the DrawingEditor which manages the views
Method Detail

execute

public void execute()
Executes the command

Specified by:
execute in interface Command
Overrides:
execute in class AbstractCommand

zoomView

public ZoomDrawingView zoomView()
Sets the zoom factor of the view

Returns:
ZoomDrawingView currently active in the editor

getScale

public float getScale()
Gets the scale attribute of the ZoomCommand object

Returns:
The scale value

setScale

public void setScale(float newScale)
Sets the scale attribute of the ZoomCommand object

Parameters:
newScale - The new scale value

isExecutableWithView

protected boolean isExecutableWithView()
Returns true if the command is executable with the current view

Overrides:
isExecutableWithView in class AbstractCommand
Returns:
true iff the view is a ZoomDrawingView

JHotDraw 6.0b1