UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.command
Class UndoableCommand

java.lang.Object
  |
  +--edu.berkeley.guir.lib.satin.command.CommandImpl
        |
        +--edu.berkeley.guir.lib.satin.command.UndoableCommand
All Implemented Interfaces:
Command, SatinConstants, Serializable, UndoableEdit

public class UndoableCommand
extends CommandImpl

Undoable commands are commands that are meant to be undone only. This is more in spirit with how undo was designed in Java Swing. It assumes that the programmer has already "done" the action, and just wants some way of undoing what they did.

To use this class, subclass it and override the undo method to undo what you want. Just be sure to throw this command into the command queue in the right place, so it can be undone sequentially in the right order.

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v1.0-1.0.0, Aug 31 1999, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D
 
Fields inherited from interface edu.berkeley.guir.lib.satin.SatinConstants
ABOVE, ALL, BAR, BELOW, clipboard, clprops, cmdqueue, cmdsubsys, CONTAINEDBY, CONTAINS, COORD_ABS, COORD_LOCAL, COORD_REL, DAMAGE_LATER, DAMAGE_NOW, DEBUG_GRAPHICS_OFFSET, DEBUG_STYLE_FILE, DEBUG_STYLE_GPROPERTY, DEEP, DEFAULT_POINT2D_POOL_SIZE, DEFAULT_POLYGON2D_POOL_SIZE, DEFAULT_RECTANGLE_POOL_SIZE, DEFAULT_REPAINT_THRESHOLD, DEFAULT_SELECT_THRESHOLD, DEFAULT_STRINGBUFFER_POOL_SIZE, DEFAULT_TRANSFORM_POOL_SIZE, DIR_CENTER, DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT, DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT, FILTER_THRESHOLD, FIRST, FLOATING_PT_TOLERANCE, glprops, INTERSECTS, KEY_STYLE_DASHARRAY, KEY_STYLE_DASHPHASE, KEY_STYLE_DRAWCOLOR, KEY_STYLE_DRAWFONT, KEY_STYLE_DRAWTRANSPARENCY, KEY_STYLE_ENDCAP, KEY_STYLE_FILLCOLOR, KEY_STYLE_FILLTRANSPARENCY, KEY_STYLE_LINEJOIN, KEY_STYLE_LINEWIDTH, KEY_STYLE_MITERLIMIT, NEAR, NOTIFY_BOUNDS, NOTIFY_LAYER, NOTIFY_LOCATION, NOTIFY_STYLE, NOTIFY_TRANSFORM, poolPoints, poolPolys, poolRects, poolStrbuf, poolTx, rand, SATIN_DATA_DIRECTORY_DEFAULT, SATIN_DATA_DIRECTORY_GPROPERTY, SATIN_PROPERTIES_FILENAME, SHALLOW
 
Constructor Summary
UndoableCommand()
           
 
Method Summary
 boolean canRedo()
          Override this method in the subclass.
 boolean canUndo()
          Override this method in the subclass.
 void die()
          Override this method in the subclass.
 String getPresentationName()
          Override this method in the subclass.
 boolean isSignificant()
          Override this method in the subclass.
 void redo()
          Obviously we cannot redo, since we don't know what to do in the first place.
 void run()
          By default, does nothing.
 void undo()
          Override this method in the subclass.
 
Methods inherited from class edu.berkeley.guir.lib.satin.command.CommandImpl
addEdit, debug, disable, enable, execute, getExecutionTime, getRedoPresentationName, getUndoPresentationName, isDisabled, isEnabled, replaceEdit, setExecutionTime, setExecutionTime, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UndoableCommand

public UndoableCommand()
Method Detail

getPresentationName

public String getPresentationName()
Description copied from class: CommandImpl
Override this method in the subclass.
Overrides:
getPresentationName in class CommandImpl

canRedo

public boolean canRedo()
Description copied from class: CommandImpl
Override this method in the subclass. By default, returns false.
Overrides:
canRedo in class CommandImpl

canUndo

public boolean canUndo()
Description copied from class: CommandImpl
Override this method in the subclass. By default, returns false.
Overrides:
canUndo in class CommandImpl

isSignificant

public boolean isSignificant()
Description copied from class: CommandImpl
Override this method in the subclass. By default, returns false.
Overrides:
isSignificant in class CommandImpl

run

public void run()
By default, does nothing.
Overrides:
run in class CommandImpl

redo

public void redo()
Obviously we cannot redo, since we don't know what to do in the first place.
Overrides:
redo in class CommandImpl

undo

public void undo()
Description copied from class: CommandImpl
Override this method in the subclass.
Overrides:
undo in class CommandImpl

die

public void die()
Description copied from class: CommandImpl
Override this method in the subclass.
Overrides:
die in class CommandImpl

Copyright Information