@Test public void testGraphCommandUndoWithParameters() { final InformationItem otherParameter = new InformationItem(); function.getFormalParameter().add(otherParameter); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertFormalParameters(1, otherParameter); }
@Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().add(parameter); parameter.getName().setValue(name); parameter.setParent(function); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().remove(parameter); return GraphCommandResultBuilder.SUCCESS; } }; }
AddParameterCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                               VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().add(parameter); parameter.getName().setValue(name); parameter.setParent(function); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().remove(parameter); return GraphCommandResultBuilder.SUCCESS; } }; } }
AddParameterCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                               VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().add(parameter); parameter.getName().setValue(name); parameter.setParent(function); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().remove(parameter); return GraphCommandResultBuilder.SUCCESS; } }; } AddParameterCommand(final FunctionDefinition function,
                               final InformationItem parameter,
                               final org.uberfire.mvp.Command canvasOperation); }
AddParameterCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                               VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().add(parameter); parameter.getName().setValue(name); parameter.setParent(function); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().remove(parameter); return GraphCommandResultBuilder.SUCCESS; } }; } AddParameterCommand(final FunctionDefinition function,
                               final InformationItem parameter,
                               final org.uberfire.mvp.Command canvasOperation);  }
AddParameterCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                               VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { function.getFormalParameter().add(parameter); parameter.getName().setValue(name); parameter.setParent(function); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().remove(parameter); return GraphCommandResultBuilder.SUCCESS; } }; } AddParameterCommand(final FunctionDefinition function,
                               final InformationItem parameter,
                               final org.uberfire.mvp.Command canvasOperation);   }