|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pietschy.command.undo.UndoController
public class UndoController
The UndoController monitors instances of UndoableEventSource and manages undo
and redo via its undo and redo commands. The
most notable instance of UndoableEventSource is UndoableActionCommand.
The undo state is managed by an instance of UndoContext and can be changed at any time.
This allows undo state to be split into separate contexts, such as for a multi file editor.
UndoableEventSource,
UndoableActionCommand| Constructor Summary | |
|---|---|
UndoController(CommandManager commandManager)
Creates a new undo controller. |
|
UndoController(CommandManager commandManager,
java.lang.String undoCommandId,
java.lang.String redoCommandId)
Create a new controller using the specified ids for the undo and
redo commands |
|
UndoController(CommandManager commandManager,
UndoContext undoContext)
Creates a new controller using the specified UndoContext. |
|
UndoController(CommandManager commandManager,
UndoContext undoContext,
java.lang.String undoCommandId,
java.lang.String redoCommandId)
Create a new controller using the specified UndoContext and ids for the
undo and redo commands |
|
| Method Summary | |
|---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l)
|
boolean |
canRedo()
|
boolean |
canUndo()
|
protected void |
exportCommands()
|
CommandManager |
getCommandManager()
|
ActionCommand |
getRedoCommand()
Gets an ActionCommand that when invoked will redo the last undone UndoableEditEvent. |
ActionCommand |
getUndoCommand()
Gets an ActionCommand that when invoked will undo the last registered
UndoableEditEvent. |
UndoContext |
getUndoContext()
Gets the current UndoContext in use. |
protected void |
redo()
|
void |
registerUndoableCommand(UndoableEventSource command)
Manually registers an UndoableEventSource with this controller. |
void |
removeChangeListener(javax.swing.event.ChangeListener l)
|
void |
setUndoContext(UndoContext undoContext)
Configures the controller to use the specified UndoContext. |
protected void |
undo()
|
void |
undoableEditHappened(javax.swing.event.UndoableEditEvent e)
Notifies the controller that an undoable event has happened. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UndoController(CommandManager commandManager)
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.
public UndoController(CommandManager commandManager,
UndoContext undoContext)
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.
public UndoController(CommandManager commandManager,
java.lang.String undoCommandId,
java.lang.String redoCommandId)
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.
public UndoController(CommandManager commandManager,
UndoContext undoContext,
java.lang.String undoCommandId,
java.lang.String redoCommandId)
UndoContext and 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.undoContext - the UndoContext to use.undoCommandId - the id to use for the undo command.redoCommandId - the id to use for the redo command.| Method Detail |
|---|
protected void exportCommands()
public CommandManager getCommandManager()
public void registerUndoableCommand(UndoableEventSource command)
UndoableEventSource with this controller.
command - the UndoableEventSource to register.UndoableEventSource,
UndoableActionCommandpublic void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
UndoContext and the undo and redo commands udpated.
undoableEditHappened in interface javax.swing.event.UndoableEditListenere - the UndoableEditEvent.public void setUndoContext(UndoContext undoContext)
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.public UndoContext getUndoContext()
UndoContext in use.
UndoContext in use by the controller.protected void undo()
protected void redo()
public ActionCommand getUndoCommand()
ActionCommand that when invoked will undo the last registered
UndoableEditEvent.
ActionCommand that will undo the the last registered
UndoableEditEvent.public ActionCommand getRedoCommand()
ActionCommand that when invoked will redo the last undone UndoableEditEvent.
ActionCommand that will undo the the last undone UndoableEditEvent.public boolean canUndo()
public boolean canRedo()
public void addChangeListener(javax.swing.event.ChangeListener l)
public void removeChangeListener(javax.swing.event.ChangeListener l)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||