@Test public void testGraphCommandExecuteMultipleRows() { addContextEntries(3); final ContextEntry firstEntry = context.getContextEntry().get(0); final ContextEntry lastEntry = context.getContextEntry().get(2); makeCommand(1); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); Assertions.assertThat(context.getContextEntry()).containsExactly(firstEntry, lastEntry); }
@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) { context.getContextEntry().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, oldContextEntry); return GraphCommandResultBuilder.SUCCESS; } }; }
DeleteContextEntryCommand 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) { context.getContextEntry().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, oldContextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } }
DeleteContextEntryCommand 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) { context.getContextEntry().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, oldContextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteContextEntryCommand(final Context context,
                                     final GridData uiModel,
                                     final int uiRowIndex,
                                     final org.uberfire.mvp.Command canvasOperation); }
DeleteContextEntryCommand 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) { context.getContextEntry().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, oldContextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteContextEntryCommand(final Context context,
                                     final GridData uiModel,
                                     final int uiRowIndex,
                                     final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
DeleteContextEntryCommand 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) { context.getContextEntry().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, oldContextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteContextEntryCommand(final Context context,
                                     final GridData uiModel,
                                     final int uiRowIndex,
                                     final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }