|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CommandStack
A simple and obvious interface for an undoable stack of commands with a listener.
See Command
for more details about the command methods that this implementation uses
and CommandStackListener
for details about the listener.
Method Summary | |
---|---|
void |
addCommandStackListener(CommandStackListener listener)
Adds a listener to the command stack, which will be notified whenever a command has been processed on the stack. |
boolean |
canRedo()
Returns whether there are commands past the top of the stack that can be redone. |
boolean |
canUndo()
Returns whether the top command on the stack can be undone. |
void |
execute(Command command)
Clears any redoable commands not yet redone, adds the command, and then executes the command. |
void |
flush()
Disposes all the commands in the stack. |
Command |
getMostRecentCommand()
Returns the command most recently executed, undone, or redone. |
Command |
getRedoCommand()
Returns the command that will be redone if redo() is called. |
Command |
getUndoCommand()
Returns the command that will be undone if undo() is called. |
void |
redo()
Moves the top of the stack up, redoing the new top command. |
void |
removeCommandStackListener(CommandStackListener listener)
Removes a listener from the command stack. |
void |
undo()
Moves the top of the stack down, undoing what was formerly the top command. |
Method Detail |
---|
void execute(Command command)
command
- the command to execute.boolean canUndo()
void undo()
boolean canRedo()
Command getUndoCommand()
undo()
is called.
undo()
is called.Command getRedoCommand()
redo()
is called.
redo()
is called.Command getMostRecentCommand()
void redo()
void flush()
void addCommandStackListener(CommandStackListener listener)
listener
- the listener to add.void removeCommandStackListener(CommandStackListener listener)
listener
- the listener to remove.
|
Copyright 2001-2012 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |