@Test public void testGraphCommandUndo() { final LiteralExpression literalExpression = new LiteralExpression(); literalExpression.getText().setValue(VALUE); list.getExpression().add(HasExpression.wrap(list, literalExpression)); makeCommand(0); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(2, list.getExpression().size()); assertEquals(VALUE, ((LiteralExpression) list.getExpression().get(1).getExpression()).getText().getValue()); }
@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) { list.getExpression().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { list.getExpression().add(uiRowIndex, oldHasExpression); return GraphCommandResultBuilder.SUCCESS; } }; }
DeleteListRowCommand 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) { list.getExpression().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { list.getExpression().add(uiRowIndex, oldHasExpression); return GraphCommandResultBuilder.SUCCESS; } }; } }
DeleteListRowCommand 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) { list.getExpression().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { list.getExpression().add(uiRowIndex, oldHasExpression); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteListRowCommand(final List list,
                                final GridData uiModel,
                                final int uiRowIndex,
                                final org.uberfire.mvp.Command canvasOperation); }
DeleteListRowCommand 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) { list.getExpression().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { list.getExpression().add(uiRowIndex, oldHasExpression); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteListRowCommand(final List list,
                                final GridData uiModel,
                                final int uiRowIndex,
                                final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
DeleteListRowCommand 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) { list.getExpression().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { list.getExpression().add(uiRowIndex, oldHasExpression); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteListRowCommand(final List list,
                                final GridData uiModel,
                                final int uiRowIndex,
                                final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }