Class RedoCommandHandler<C extends org.kie.workbench.common.stunner.core.command.Command>

  • 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 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.
    • 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()