@Test public void testGraphCommandExecuteInsertToFirstPlace() { final Binding firstBinding = new Binding(); final Binding secondBinding = new Binding(); invocation.getBinding().add(firstBinding); invocation.getBinding().add(secondBinding); makeCommand(0); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertBindingDefinitions(binding, firstBinding, secondBinding); assertEquals(invocation, binding.getParent()); assertEquals(binding, binding.getParameter().getParent()); }
@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) { invocation.getBinding().add(uiRowIndex, binding); final InformationItem informationItem = binding.getParameter(); informationItem.getName().setValue(name); binding.setParent(invocation); binding.getParameter().setParent(binding); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { invocation.getBinding().remove(binding); return GraphCommandResultBuilder.SUCCESS; } }; }
AddParameterBindingCommand 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) { invocation.getBinding().add(uiRowIndex, binding); final InformationItem informationItem = binding.getParameter(); informationItem.getName().setValue(name); binding.setParent(invocation); binding.getParameter().setParent(binding); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { invocation.getBinding().remove(binding); return GraphCommandResultBuilder.SUCCESS; } }; } }
AddParameterBindingCommand 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) { invocation.getBinding().add(uiRowIndex, binding); final InformationItem informationItem = binding.getParameter(); informationItem.getName().setValue(name); binding.setParent(invocation); binding.getParameter().setParent(binding); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { invocation.getBinding().remove(binding); return GraphCommandResultBuilder.SUCCESS; } }; } AddParameterBindingCommand(final Invocation invocation,
                                      final Binding binding,
                                      final GridData uiModel,
                                      final GridRow uiModelRow,
                                      final int uiRowIndex,
                                      final InvocationUIModelMapper uiModelMapper,
                                      final org.uberfire.mvp.Command canvasOperation); }
AddParameterBindingCommand 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) { invocation.getBinding().add(uiRowIndex, binding); final InformationItem informationItem = binding.getParameter(); informationItem.getName().setValue(name); binding.setParent(invocation); binding.getParameter().setParent(binding); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { invocation.getBinding().remove(binding); return GraphCommandResultBuilder.SUCCESS; } }; } AddParameterBindingCommand(final Invocation invocation,
                                      final Binding binding,
                                      final GridData uiModel,
                                      final GridRow uiModelRow,
                                      final int uiRowIndex,
                                      final InvocationUIModelMapper uiModelMapper,
                                      final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
AddParameterBindingCommand 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) { invocation.getBinding().add(uiRowIndex, binding); final InformationItem informationItem = binding.getParameter(); informationItem.getName().setValue(name); binding.setParent(invocation); binding.getParameter().setParent(binding); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { invocation.getBinding().remove(binding); return GraphCommandResultBuilder.SUCCESS; } }; } AddParameterBindingCommand(final Invocation invocation,
                                      final Binding binding,
                                      final GridData uiModel,
                                      final GridRow uiModelRow,
                                      final int uiRowIndex,
                                      final InvocationUIModelMapper uiModelMapper,
                                      final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }