UndoableEditrepresents an edit. The edit may be undone, or if already undone the edit may be redone.
UndoableEdit is designed to be used with the
UndoableEdits are generated
UndoableEditListener they are typically added to
UndoManager. When an
is added to an
UndoManager the following occurs (assuming
end has not been called on the
UndoManagercontains edits it will call
addEditon the current edit passing in the new edit as the argument. If
addEditreturns true the new edit is assumed to have been incorporated into the current edit and the new edit will not be added to the list of current edits. Edits can use
addEditas a way for smaller edits to be incorporated into a larger edit and treated as a single edit.
replaceEditis called on the new edit with the current edit passed in as the argument. This is the inverse of
addEdit if the new edit returns true from
replaceEdit, the new edit replaces the current edit.
UndoManagermakes use of
isSignificantto determine how many edits should be undone or redone. The
UndoManagerwill undo or redo all insignificant edits (
isSignificantreturns false) between the current edit and the last or next significant edit.
replaceEditcan be used to treat multiple edits as a single edit, returning false from
isSignificantallows for treating can be used to have many smaller edits undone or redone at once. Similar functionality can also be done using the
|Method from javax.swing.undo.UndoableEdit Summary:|
|addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, redo, replaceEdit, undo|
|Method from javax.swing.undo.UndoableEdit Detail:|
public boolean addEdit(UndoableEdit anEdit)
A return value of true indicates
Typically the receiver is already in the queue of a
If true is returned, from now on
public boolean canRedo()
public boolean canUndo()
public void die()
This is a useful hook for cleaning up state no longer
needed once undoing or redoing is impossible--for example,
deleting file resources used by objects that can no longer be
Note that this is a one-way operation. There is no "un-die" method.
public String getPresentationName()
public String getRedoPresentationName()
public String getUndoPresentationName()
public boolean isSignificant()
public void redo() throws CannotRedoException
public boolean replaceEdit(UndoableEdit anEdit)
This method provides a way for an edit to replace an existing edit.
This message is the opposite of addEdit--anEdit has typically
already been queued in an
If true is returned, from now on anEdit must return false from canUndo() and canRedo(), and must throw the appropriate exception on undo() or redo().
public void undo() throws CannotUndoException