- Type Parameters:
C - The command type.
@Dependent
public class RedoCommandHandler<C extends Command>
extends Object
This handler is an util class that achieves command "re-do" features.
It's behaviour is to keep in a command registry (usually a in-memory registry), the commands that have been
"undone" for a given context. It allows further re-do ( re-execution ) of that commands. If at some point
the user undo some commands and executes whatever new action that produces a new command, this registry is cleared
so you cannot redo older commands.
It can be used as:
Inputs
- Capture undo operations for commands and call the onUndoCommandExecuted method
- Capture regular command executions and call the onCommandExecuted method
Output
- Check isEnabled to figure out if a re-do operation can be done.
- Call clear to clear the internal commands registry and reset the re-do status.
- If isEnabled is true, you can run the execute method. It runs last undone command on found this handler's registry.