Class RedoCommandHandler<C extends org.kie.workbench.common.stunner.core.command.Command>
- java.lang.Object
-
- org.kie.workbench.common.stunner.core.client.command.RedoCommandHandler<C>
-
- Type Parameters:
C- The command type.
@Dependent public class RedoCommandHandler<C extends org.kie.workbench.common.stunner.core.command.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 theonUndoCommandExecutedmethod - Capture regular command executions and call theonCommandExecutedmethod Output - CheckisEnabledto figure out if a re-do operation can be done. - Callclearto clear the internal commands registry and reset the re-do status. - IfisEnabledistrue, you can run theexecutemethod. It runs last undone command on found this handler's registry.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRedoCommandHandler()RedoCommandHandler(org.kie.workbench.common.stunner.core.client.api.SessionManager sessionManager, javax.enterprise.event.Event<org.kie.workbench.common.stunner.core.client.canvas.event.registration.RegisterChangedEvent> registerChangedEvent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()org.kie.workbench.common.stunner.core.command.CommandResult<?>execute(Object context, org.kie.workbench.common.stunner.core.command.CommandManager commandManager)protected org.appformer.client.stateControl.registry.Registry<C>getRegistry()booleanisEnabled()booleanonCommandExecuted(C command)booleanonUndoCommandExecuted(C command)voidsetSession(org.kie.workbench.common.stunner.core.client.session.ClientSession clientSession)
-
-
-
Constructor Detail
-
RedoCommandHandler
protected RedoCommandHandler()
-
RedoCommandHandler
@Inject public RedoCommandHandler(org.kie.workbench.common.stunner.core.client.api.SessionManager sessionManager, javax.enterprise.event.Event<org.kie.workbench.common.stunner.core.client.canvas.event.registration.RegisterChangedEvent> registerChangedEvent)
-
-
Method Detail
-
onUndoCommandExecuted
public boolean onUndoCommandExecuted(C command)
-
onCommandExecuted
public boolean onCommandExecuted(C command)
-
execute
public org.kie.workbench.common.stunner.core.command.CommandResult<?> execute(Object context, org.kie.workbench.common.stunner.core.command.CommandManager commandManager)
-
setSession
public void setSession(org.kie.workbench.common.stunner.core.client.session.ClientSession clientSession)
-
isEnabled
public boolean isEnabled()
-
clear
public void clear()
-
getRegistry
protected org.appformer.client.stateControl.registry.Registry<C> getRegistry()
-
-