com.partnersoft.gadgets
Class UndoableWithSideEffects

java.lang.Object
  extended by com.partnersoft.gadgets.UndoableWithSideEffects
All Implemented Interfaces:
UndoableCommand

public abstract class UndoableWithSideEffects
extends java.lang.Object
implements UndoableCommand

This handles an annoying case in undo-land. If one undo object, during its redo or undo procedure, causes other undos to be added to the stack, we have to manage them properly so that they get bundled together as a single undo/redo event from the user's perspective. I feel like there should be a better way to handle this, but can't imagine what at the moment. An implementation involving a hierarchical stack context seems likely, but could prove complicated.

Author:
Paul Reavis Copyright 2005 Partner Software, Inc.

Constructor Summary
UndoableWithSideEffects(UndoStack undoStack)
           
 
Method Summary
 void redo()
          Execute the command, saving any state necessary to undo it.
protected abstract  void redoImp()
           
 void undo()
          Undo the command, saving any state necessary to redo it.
protected abstract  void undoImp()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UndoableWithSideEffects

public UndoableWithSideEffects(UndoStack undoStack)
Method Detail

redo

public void redo()
Description copied from interface: UndoableCommand
Execute the command, saving any state necessary to undo it.

Specified by:
redo in interface UndoableCommand

undo

public void undo()
Description copied from interface: UndoableCommand
Undo the command, saving any state necessary to redo it.

Specified by:
undo in interface UndoableCommand

redoImp

protected abstract void redoImp()

undoImp

protected abstract void undoImp()