public class IlvSDMUndoManager extends UndoManager
IlvSDMUndoManager
provides undo/redo capabilities for an
SDM engine.
The SDM undo manager adds a filtering data model
on top of the existing data model of the SDM engine.
This filtering model captures all the modifications
made to the underlying model, and stores them as
UndoableEdits
in a Swing UndoManager
.
To enable undo in an SDM engine,
create an IlvSDMUndoManager
associated with the engine.
You can also register UndoableEditListener
objects to be notified when an edit has happened and
update your GUI accordingly (for example, to gray out
undo/redo buttons).
Modifier and Type | Class and Description |
---|---|
static class |
IlvSDMUndoManager.UndoSDMModel
This class is the filtering SDM data model that records
in the undo manager all the editing calls on the underlying
data model.
|
edits
RedoName, UndoName
Constructor and Description |
---|
IlvSDMUndoManager(IlvSDMEngine engine)
Creates a new undo manager for the specified SDM engine.
|
Modifier and Type | Method and Description |
---|---|
void |
addUndoableEditListener(UndoableEditListener listener)
Registers an
UndoableEditListener that will be
called when a new edit is added to this undo manager. |
boolean |
isEnabled()
Returns
true if this undo manager is enabled, that is,
if it is currently recording changes in the SDM model. |
void |
redo()
Redoes the last undone edit.
|
void |
removeUndoableEditListener(UndoableEditListener listener)
Removes an
UndoableEditListener . |
void |
setEnabled(boolean enabled)
Enables or disables this undo manager.
|
void |
undo()
Undoes the last edit.
|
addEdit, canRedo, canUndo, canUndoOrRedo, discardAllEdits, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoableEditHappened, undoOrRedo, undoTo
die, getPresentationName, isInProgress, isSignificant, lastEdit
replaceEdit
public IlvSDMUndoManager(IlvSDMEngine engine)
engine
- The SDM engine.public boolean isEnabled()
true
if this undo manager is enabled, that is,
if it is currently recording changes in the SDM model.setEnabled(boolean)
public void setEnabled(boolean enabled)
The undo manager is enabled by default.
enabled
- If true
, the undo manager records all changes in the
SDM model. Otherwise the changes are not recorded until the undo manager
is enabled again.public void undo()
undo
in interface UndoableEdit
undo
in class UndoManager
public void redo()
redo
in interface UndoableEdit
redo
in class UndoManager
public void addUndoableEditListener(UndoableEditListener listener)
UndoableEditListener
that will be
called when a new edit is added to this undo manager.listener
- The listener to add.public void removeUndoableEditListener(UndoableEditListener listener)
UndoableEditListener
.listener
- The listener to remove.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.