@Test public void testCanvasCommandAllow() { makeCommand(); final Command<AbstractCanvasHandler, CanvasViolation> c = command.newCanvasCommand(handler); assertEquals(CanvasCommandResultBuilder.SUCCESS, c.allow(handler)); }
@Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.ROW_COLUMN_INDEX); if (Objects.isNull(uiExpressionEditor)) { uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); uiExpressionEditor = uiModel.getCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); } else { uiModel.setCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, () -> uiExpressionEditor); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; }
AddListRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                             VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.ROW_COLUMN_INDEX); if (Objects.isNull(uiExpressionEditor)) { uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); uiExpressionEditor = uiModel.getCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); } else { uiModel.setCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, () -> uiExpressionEditor); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } }
AddListRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                             VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.ROW_COLUMN_INDEX); if (Objects.isNull(uiExpressionEditor)) { uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); uiExpressionEditor = uiModel.getCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); } else { uiModel.setCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, () -> uiExpressionEditor); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddListRowCommand(final List list,
                             final HasExpression hasExpression,
                             final GridData uiModel,
                             final GridRow uiModelRow,
                             final int uiRowIndex,
                             final ListUIModelMapper uiModelMapper,
                             final org.uberfire.mvp.Command canvasOperation); }
AddListRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                             VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.ROW_COLUMN_INDEX); if (Objects.isNull(uiExpressionEditor)) { uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); uiExpressionEditor = uiModel.getCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); } else { uiModel.setCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, () -> uiExpressionEditor); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddListRowCommand(final List list,
                             final HasExpression hasExpression,
                             final GridData uiModel,
                             final GridRow uiModelRow,
                             final int uiRowIndex,
                             final ListUIModelMapper uiModelMapper,
                             final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
AddListRowCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                             VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler handler) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler handler) { uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.ROW_COLUMN_INDEX); if (Objects.isNull(uiExpressionEditor)) { uiModelMapper.fromDMNModel(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); uiExpressionEditor = uiModel.getCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); } else { uiModel.setCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, () -> uiExpressionEditor); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { final int rowIndex = uiModel.getRows().indexOf(uiModelRow); uiModel.deleteRow(rowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddListRowCommand(final List list,
                             final HasExpression hasExpression,
                             final GridData uiModel,
                             final GridRow uiModelRow,
                             final int uiRowIndex,
                             final ListUIModelMapper uiModelMapper,
                             final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }