Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pietschy.command.undo
Class UndoContext

    java.lang.Object
      javax.swing.undo.AbstractUndoableEdit
          javax.swing.undo.CompoundEdit
              javax.swing.undo.UndoManager
                  com.pietschy.command.undo.UndoContext

All Implemented Interfaces:
  java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit

    public class UndoContext

extends javax.swing.undo.UndoManager
implements javax.swing.event.UndoableEditListener

Provides a drop-in replacement for swings `UndoManager` that provides state change notifications to listners like the `UndoCommand` and `RedoCommand`.

The undo and redo commands locate the current undo context via their `CommandContainer`. See `CommandContainer.setUndoContext(UndoContext)`.

Version:
  $Revision: 1.4 $
Author:
  andrewp
See Also:
  `CommandContainer.setUndoContext(UndoContext)`, `UndoCommand`, `RedoCommand`, Serialized Form

Field Summary

Fields inherited from class javax.swing.undo.CompoundEdit
`edits`

Fields inherited from class javax.swing.undo.AbstractUndoableEdit
`RedoName, UndoName`

Constructor Summary
`UndoContext()` Creates a new instance.

Method Summary
`void` | `addChangeListener(javax.swing.event.ChangeListener l)` Adds a the specified listener.
`boolean` | `addEdit(javax.swing.undo.UndoableEdit anEdit)` Overrides `UndoManager.addEdit(UndoableEdit)` to provide state change notification.
`protected void` | `fireStateChaged()` Notifies listeners that there has been a change in state.
`void` | `redo()` Overrides `UndoManager.redo()` to provide state change notification.
`void` | `removeChangeListener(javax.swing.event.ChangeListener l)` Removes the specified listener.
`void` | `undo()` Overrides `UndoManager.undo()` to provide state change notification.
`void` | `undoableEditHappened(javax.swing.event.UndoableEditEvent e)` Overrides `UndoManager.undoableEditHappened(UndoableEditEvent)` to provide state change notification.

Methods inherited from class javax.swing.undo.UndoManager
`canRedo, canUndo, canUndoOrRedo, discardAllEdits, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoOrRedo, undoTo`

Methods inherited from class javax.swing.undo.CompoundEdit
`die, getPresentationName, isInProgress, isSignificant, lastEdit`

Methods inherited from class javax.swing.undo.AbstractUndoableEdit
`replaceEdit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### UndoContext

    public UndoContext()

  Creates a new instance.

Method Detail

### addEdit

    public boolean addEdit(javax.swing.undo.UndoableEdit anEdit)

  Overrides `UndoManager.addEdit(UndoableEdit)` to provide state change notification.

  Specified by:
    `addEdit` in interface `javax.swing.undo.UndoableEdit`
  Overrides:
    `addEdit` in class `javax.swing.undo.UndoManager`

### undoableEditHappened

    public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)

  Overrides `UndoManager.undoableEditHappened(UndoableEditEvent)` to provide state change notification.

  Specified by:
    `undoableEditHappened` in interface `javax.swing.event.UndoableEditListener`
  Overrides:
    `undoableEditHappened` in class `javax.swing.undo.UndoManager`

### undo

    public void undo()

  Overrides `UndoManager.undo()` to provide state change notification.

  Specified by:
    `undo` in interface `javax.swing.undo.UndoableEdit`
  Overrides:
    `undo` in class `javax.swing.undo.UndoManager`

### redo

    public void redo()

  Overrides `UndoManager.redo()` to provide state change notification.

  Specified by:
    `redo` in interface `javax.swing.undo.UndoableEdit`
  Overrides:
    `redo` in class `javax.swing.undo.UndoManager`

### fireStateChaged

    protected void fireStateChaged()

  Notifies listeners that there has been a change in state.

### addChangeListener

    public void addChangeListener(javax.swing.event.ChangeListener l)

  Adds a the specified listener.

  Parameters:
    `l` - the listener to add.

### removeChangeListener

    public void removeChangeListener(javax.swing.event.ChangeListener l)

  Removes the specified listener.

  Parameters:
    `l` - the listener to remove.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 - 2007 Andrew Pietsch