|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.dlsc.flexgantt.command.DefaultCommandStack
public class DefaultCommandStack
The default command stack implementation manages a list of executed and undone commands. The stack has a default size of 20, which means that the last 20 commands can be undone. The stack size can be passed to the stack's constructor. Commands will be removed from the stack once the stack's limit is reached.
ICommand
,
ICommandStackListener
Constructor Summary | |
---|---|
DefaultCommandStack()
Creates a new command stack with a default size (number of undoable commands). |
|
DefaultCommandStack(int size)
Creates a new command stack. |
Method Summary | |
---|---|
void |
addCommandStackListener(ICommandStackListener l)
Adds a listener to the command stack. |
void |
clear()
Clears the command stack, which means that the list of executed and undone commands will be cleared and no further commands can be undone or redone. |
void |
execute(ICommand cmd,
IProgressMonitor monitor)
Executes the given command. |
protected void |
fireCommandStackChanged(CommandStackEvent event)
Used internally to inform stack listeners about executed, undone or redone commands. |
ICommandStackListener[] |
getCommandStackListeners()
Returns all command stack listeners. |
java.util.List<ICommand> |
getExecutedCommands()
Returns a copy of the list of executed commands. |
ICommand |
getRedoableCommand()
Returns the command, which would be redone if the application called the redo operation on the stack. |
int |
getSize()
Returns the stack size as defined via the constructor or default stack size value. |
ICommand |
getUndoableCommand()
Returns the command, which would be undone if the application called the undo operation on the stack. |
java.util.List<ICommand> |
getUndoneCommands()
Returns a copy of the list of undone commands. |
boolean |
isRedoable()
Determines whether the command stack currently supports the redo operation. |
boolean |
isUndoable()
Determines whether the command stack currently supports the undo operation. |
void |
redo(IProgressMonitor monitor)
If it is redoable then the last undone command can be redone by calling this method. |
void |
removeCommandStackListener(ICommandStackListener l)
Removes a listener from the command stack. |
void |
undo(IProgressMonitor monitor)
If it is undoable then the last executed command can be undone by calling this method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultCommandStack(int size)
size
- the maximum stack size and number of undoable commandspublic DefaultCommandStack()
Method Detail |
---|
public int getSize()
public void execute(ICommand cmd, IProgressMonitor monitor)
execute
in interface ICommandStack
cmd
- the command to executemonitor
- a monitor to report the command's progress toCommandStackEvent
public void undo(IProgressMonitor monitor)
undo
in interface ICommandStack
monitor
- a monitor for reporting progress of the undo operationICommandStack.undo(IProgressMonitor)
,
CommandStackEvent
public void redo(IProgressMonitor monitor)
redo
in interface ICommandStack
monitor
- a monitor for reporting the progress of the redo operationICommandStack.redo(IProgressMonitor)
,
CommandStackEvent
public void clear()
clear
in interface ICommandStack
ICommandStack.clear()
public boolean isUndoable()
isUndoable
in interface ICommandStack
ICommandStack.isUndoable()
public boolean isRedoable()
isRedoable
in interface ICommandStack
ICommandStack.isRedoable()
public void addCommandStackListener(ICommandStackListener l)
addCommandStackListener
in interface ICommandStack
l
- the listener to addICommandStack.addCommandStackListener(ICommandStackListener)
public void removeCommandStackListener(ICommandStackListener l)
removeCommandStackListener
in interface ICommandStack
l
- the listener to removeICommandStack.removeCommandStackListener(ICommandStackListener)
public ICommandStackListener[] getCommandStackListeners()
protected void fireCommandStackChanged(CommandStackEvent event)
event
- the event to send to the listenerspublic ICommand getUndoableCommand()
getUndoableCommand
in interface ICommandStack
ICommandStack.getUndoableCommand()
public ICommand getRedoableCommand()
getRedoableCommand
in interface ICommandStack
ICommandStack.getRedoableCommand()
public java.util.List<ICommand> getExecutedCommands()
public java.util.List<ICommand> getUndoneCommands()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |