GUI Commands User GuideVersion 2.1 |
||
Programmatic ExecutionCommands can be executed programmatically simply by invoking the
no-arg ActionCommand command = ...; command.execute(); This will invoke the command with an empty parameter map. This results in
methods such as Specifying Execution ParametersIf your code relies on certain parameters being correctly configured you'll need to populate the parameter map prior to each execution. The following demonstrates setting the invoker parameter: command.putParameter(ActionCommand.PARAMETER_INVOKER, invoker); command.execute(); In this above case the command checks if the invoker is a swing component and if it is it automatically configures the invoker window parameter. You can also configure the invoker window parameter manually as follows: command.putParameter(ActionCommand.PARAMETER_INVOKER_WINDOW, window); command.execute(); Invoking One Command From AnotherWhen invoking one command from another you can simply pass an entire parameter map to the execute method as follows: ActionCommand commandOne = ... ActionCommand commandTwo = ... commandTwo.execute(commandOne.getParameters()); In this case |
||