org.pietschy.command.undo
Class UndoController
java.lang.Objectorg.pietschy.command.undo.UndoController
- UndoableEditListener
public class UndoController
extends java.lang.Object
implements UndoableEditListener
UndoController
public UndoController(CommandManager commandManager)
Creates a new undo controller. The command id used for the
undo command
will be "gui-commands.undo" and the id used for the
redo command will be
"gui-commands.redo"
commandManager - the CommandManager to which the controller belongs. It will
automatically export its undo and redo commands to the container and track any undoable commands
that are registered with it.
UndoController
public UndoController(CommandManager commandManager,
String undoCommandId,
String redoCommandId) Create a new controller using the specified ids for the
undo and
redo commands
commandManager - the CommandManager to which the controller belongs. It will
automatically export its undo and redo commands to the container and track any undoable commands
that are registered with it.undoCommandId - the id to use for the undo command.redoCommandId - the id to use for the redo command.
UndoController
public UndoController(CommandManager commandManager,
UndoContext undoContext) Creates a new controller using the specified
UndoContext.
The command id used for the
undo command
will be "gui-commands.undo" and the id used for the
redo command will be
"gui-commands.redo"
commandManager - the CommandManager to which the controller belongs. It will
automatically export its undo and redo commands to the container and track any undoable commands
that are registered with it.undoContext - the UndoContext to use.
UndoController
public UndoController(CommandManager commandManager,
UndoContext undoContext,
String undoCommandId,
String redoCommandId)commandManager - the CommandManager to which the controller belongs. It will
automatically export its undo and redo commands to the container and track any undoable commands
that are registered with it.undoContext - the UndoContext to use.undoCommandId - the id to use for the undo command.redoCommandId - the id to use for the redo command.
addChangeListener
public void addChangeListener(ChangeListener l)
canRedo
public boolean canRedo()
canUndo
public boolean canUndo()
exportCommands
protected void exportCommands()
getRedoCommand
public ActionCommand getRedoCommand()
Gets an
ActionCommand that when invoked will redo the last undone
UndoableEditEvent.
- an
ActionCommand that will undo the the last undone UndoableEditEvent.
getUndoCommand
public ActionCommand getUndoCommand()
Gets an
ActionCommand that when invoked will undo the last registered
UndoableEditEvent.
- an
ActionCommand that will undo the the last registered
UndoableEditEvent.
redo
protected void redo()
removeChangeListener
public void removeChangeListener(ChangeListener l)
setUndoContext
public void setUndoContext(UndoContext undoContext)
Configures the controller to use the specified
UndoContext. The undo and redo commands
will update according the the state of the context and all new
UndoableEditEvents
will be registed with it.
undoContext - the undo context to use.
undo
protected void undo()
undoableEditHappened
public void undoableEditHappened(UndoableEditEvent e)
Notifies the controller that an undoable event has happened. This event will be added to the
current
UndoContext and the undo and redo commands udpated.
e - the UndoableEditEvent.