edu.princeton.swing
Class ActionedUndoManager

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.undo.UndoManager
              extended by edu.princeton.swing.ActionedUndoManager
All Implemented Interfaces:
Serializable, EventListener, UndoableEditListener, UndoableEdit

public class ActionedUndoManager
extends UndoManager

ActionedUndoManager extends UndoManager to provide usable Action objects for the undo and redo properties.

See Also:
Serialized Form

Nested Class Summary
protected  class ActionedUndoManager.RedoAction
          RedoAction is an action which calls the redo() method of its ActionedUndoManager.
protected  class ActionedUndoManager.UndoAction
          UndoAction is an action which calls the undo() method of its ActionedUndoManager.
 
Field Summary
static Icon REDO_ICON
          The redo icon.
static byte[] REDO_ICON_BYTES
          The bytes for the redo icon.
static Icon UNDO_ICON
          The undo icon.
static byte[] UNDO_ICON_BYTES
          The bytes for the undo icon.
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
ActionedUndoManager()
          Creates a new ActionedUndoManager.
 
Method Summary
 boolean addEdit(UndoableEdit anEdit)
          Intercept all calls that could affect the undo/redo action states.
 void discardAllEdits()
          Intercept all calls that could affect the undo/redo action states.
 void end()
          Intercept all calls that could affect the undo/redo action states.
 AbstractAction2 getRedoAction()
          Returns an action that calls the redo method of this ActionedUndoManager.
 AbstractAction2 getUndoAction()
          Returns an action that calls the undo method of this ActionedUndoManager.
 void redo()
          Intercept all calls that could affect the undo/redo action states.
protected  void redoTo(UndoableEdit edit)
          Intercept all calls that could affect the undo/redo action states.
 boolean replaceEdit(UndoableEdit anEdit)
          Intercept all calls that could affect the undo/redo action states.
 void setLimit(int l)
          Intercept all calls that could affect the undo/redo action states.
protected  void trimEdits(int from, int to)
          Intercept all calls that could affect the undo/redo action states.
protected  void trimForLimit()
          Intercept all calls that could affect the undo/redo action states.
 void undo()
          Intercept all calls that could affect the undo/redo action states.
 void undoableEditHappened(UndoableEditEvent e)
          Intercept all calls that could affect the undo/redo action states.
 void undoOrRedo()
          Intercept all calls that could affect the undo/redo action states.
protected  void undoTo(UndoableEdit edit)
          Intercept all calls that could affect the undo/redo action states.
 
Methods inherited from class javax.swing.undo.UndoManager
canRedo, canUndo, canUndoOrRedo, editToBeRedone, editToBeUndone, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, toString
 
Methods inherited from class javax.swing.undo.CompoundEdit
die, getPresentationName, isInProgress, isSignificant, lastEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDO_ICON_BYTES

public static final byte[] UNDO_ICON_BYTES
The bytes for the undo icon.


UNDO_ICON

public static final Icon UNDO_ICON
The undo icon.


REDO_ICON_BYTES

public static final byte[] REDO_ICON_BYTES
The bytes for the redo icon.


REDO_ICON

public static final Icon REDO_ICON
The redo icon.

Constructor Detail

ActionedUndoManager

public ActionedUndoManager()
Creates a new ActionedUndoManager.

Method Detail

getUndoAction

public AbstractAction2 getUndoAction()
Returns an action that calls the undo method of this ActionedUndoManager. This ActionedUndoManager also manages the enabled status of the action.

Returns:
The action for the undo operation.

getRedoAction

public AbstractAction2 getRedoAction()
Returns an action that calls the redo method of this ActionedUndoManager. This ActionedUndoManager also manages the enabled status of the action.

Returns:
The action for the redo operation.

discardAllEdits

public void discardAllEdits()
Intercept all calls that could affect the undo/redo action states.

Overrides:
discardAllEdits in class UndoManager

trimForLimit

protected void trimForLimit()
Intercept all calls that could affect the undo/redo action states.

Overrides:
trimForLimit in class UndoManager

trimEdits

protected void trimEdits(int from,
                         int to)
Intercept all calls that could affect the undo/redo action states.

Overrides:
trimEdits in class UndoManager

setLimit

public void setLimit(int l)
Intercept all calls that could affect the undo/redo action states.

Overrides:
setLimit in class UndoManager

undoTo

protected void undoTo(UndoableEdit edit)
               throws CannotUndoException
Intercept all calls that could affect the undo/redo action states.

Overrides:
undoTo in class UndoManager
Throws:
CannotUndoException

redoTo

protected void redoTo(UndoableEdit edit)
               throws CannotRedoException
Intercept all calls that could affect the undo/redo action states.

Overrides:
redoTo in class UndoManager
Throws:
CannotRedoException

undoOrRedo

public void undoOrRedo()
                throws CannotRedoException,
                       CannotUndoException
Intercept all calls that could affect the undo/redo action states.

Overrides:
undoOrRedo in class UndoManager
Throws:
CannotRedoException
CannotUndoException

undo

public void undo()
          throws CannotUndoException
Intercept all calls that could affect the undo/redo action states.

Specified by:
undo in interface UndoableEdit
Overrides:
undo in class UndoManager
Throws:
CannotUndoException

redo

public void redo()
          throws CannotRedoException
Intercept all calls that could affect the undo/redo action states.

Specified by:
redo in interface UndoableEdit
Overrides:
redo in class UndoManager
Throws:
CannotRedoException

addEdit

public boolean addEdit(UndoableEdit anEdit)
Intercept all calls that could affect the undo/redo action states.

Specified by:
addEdit in interface UndoableEdit
Overrides:
addEdit in class UndoManager

end

public void end()
Intercept all calls that could affect the undo/redo action states.

Overrides:
end in class UndoManager

undoableEditHappened

public void undoableEditHappened(UndoableEditEvent e)
Intercept all calls that could affect the undo/redo action states.

Specified by:
undoableEditHappened in interface UndoableEditListener
Overrides:
undoableEditHappened in class UndoManager

replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
Intercept all calls that could affect the undo/redo action states.

Specified by:
replaceEdit in interface UndoableEdit
Overrides:
replaceEdit in class AbstractUndoableEdit