@Test public void testCanvasCommandAllow() { setupCommand(0, uiModel.getRow(0)); final Command<AbstractCanvasHandler, CanvasViolation> c = command.newCanvasCommand(handler); assertEquals(CanvasCommandResultBuilder.SUCCESS, c.allow(handler)); }
@Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler ach) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> allow(AbstractCanvasHandler context) { if (index == uiModel.getRowCount() - 1) { return CanvasCommandResultBuilder.failed(); } return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(index, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(oldIndex, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; }
MoveRowsCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                           VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler ach) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> allow(AbstractCanvasHandler context) { if (index == uiModel.getRowCount() - 1) { return CanvasCommandResultBuilder.failed(); } return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(index, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(oldIndex, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } }
MoveRowsCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                           VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler ach) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> allow(AbstractCanvasHandler context) { if (index == uiModel.getRowCount() - 1) { return CanvasCommandResultBuilder.failed(); } return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(index, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(oldIndex, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } MoveRowsCommand(final Invocation invocation,
                           final DMNGridData uiModel,
                           final int index,
                           final List<GridRow> uiRows,
                           final org.uberfire.mvp.Command canvasOperation); }
MoveRowsCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                           VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler ach) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> allow(AbstractCanvasHandler context) { if (index == uiModel.getRowCount() - 1) { return CanvasCommandResultBuilder.failed(); } return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(index, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(oldIndex, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } MoveRowsCommand(final Invocation invocation,
                           final DMNGridData uiModel,
                           final int index,
                           final List<GridRow> uiRows,
                           final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
MoveRowsCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                           VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler ach) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> allow(AbstractCanvasHandler context) { if (index == uiModel.getRowCount() - 1) { return CanvasCommandResultBuilder.failed(); } return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(index, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler ach) { uiModel.moveRowsTo(oldIndex, uiRows); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } MoveRowsCommand(final Invocation invocation,
                           final DMNGridData uiModel,
                           final int index,
                           final List<GridRow> uiRows,
                           final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }