Class CommandStack
java.lang.Object
de.hamstersimulator.objectsfirst.commands.CommandStack
- Direct Known Subclasses:
EditCommandStack
-
Property Summary
TypePropertyDescriptionGetter for the canRedo property true if the game is stopped / paused and there is at least one command to redoGetter for the canUndo property true if the game is stopped / paused and there is at least one command to undo -
Field Summary
Modifier and TypeFieldDescriptionprotected ReadOnlyBooleanWrapper
protected ReadOnlyBooleanWrapper
protected ReadOnlyBooleanWrapper
protected ReadOnlyBooleanWrapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGetter for the canRedo property true if the game is stopped / paused and there is at least one command to redoGetter for the canUndo property true if the game is stopped / paused and there is at least one command to undovoid
protected Lock
Gets a lock used to synchronize all state (mode, canUndo, canRedo) related methodsvoid
hard-resets the CommandStack.void
redo()
Redoes the oldest undone command, if possiblevoid
redoAll()
Redoes all commands which are currently undone, in the same order like they where executed firstvoid
undo()
Undoes the last executed command, if possiblevoid
undoAll()
Undoes all commands which are executed, in the inverse order than they where executed
-
Property Details
-
canUndo
Getter for the canUndo property true if the game is stopped / paused and there is at least one command to undo -
canRedo
Getter for the canRedo property true if the game is stopped / paused and there is at least one command to redo
-
-
Field Details
-
canUndo
-
canRedo
-
hasCommandToUndo
-
hasCommandToRedo
-
executedCommands
-
undoneCommands
-
-
Constructor Details
-
CommandStack
public CommandStack()
-
-
Method Details
-
execute
-
undoAll
public void undoAll()Undoes all commands which are executed, in the inverse order than they where executed -
redoAll
public void redoAll()Redoes all commands which are currently undone, in the same order like they where executed first -
undo
public void undo()Undoes the last executed command, if possible- Throws:
IllegalStateException
- if !canUndoProperty().get();
-
redo
public void redo()Redoes the oldest undone command, if possible- Throws:
IllegalStateException
- if !canRedoProperty().get();
-
hardReset
public void hardReset()hard-resets the CommandStack. it clears executedCommands and undoneCommands, however, it does NOT undo all commands. If this behaviour is desired, it is necessary to call undoAll first -
canUndoProperty
Getter for the canUndo property true if the game is stopped / paused and there is at least one command to undo -
canRedoProperty
Getter for the canRedo property true if the game is stopped / paused and there is at least one command to redo -
getStateLock
Gets a lock used to synchronize all state (mode, canUndo, canRedo) related methods- Returns:
- the lock (always the same instance)
-