@Test public void testCanvasCommandAllow() throws Exception { makeCommand(DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT); final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler); assertEquals(CanvasCommandResultBuilder.SUCCESS, canvasCommand.allow(canvasHandler)); }
@Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler context) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < dtable.getRule().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; }
AddInputClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                 VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler context) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < dtable.getRule().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } }
AddInputClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                 VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler context) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < dtable.getRule().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddInputClauseCommand(final DecisionTable dtable,
                                 final InputClause inputClause,
                                 final GridData uiModel,
                                 final Supplier<InputClauseColumn> uiModelColumnSupplier,
                                 final int uiColumnIndex,
                                 final DecisionTableUIModelMapper uiModelMapper,
                                 final org.uberfire.mvp.Command executeCanvasOperation,
                                 final org.uberfire.mvp.Command undoCanvasOperation); }
AddInputClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                 VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler context) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < dtable.getRule().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddInputClauseCommand(final DecisionTable dtable,
                                 final InputClause inputClause,
                                 final GridData uiModel,
                                 final Supplier<InputClauseColumn> uiModelColumnSupplier,
                                 final int uiColumnIndex,
                                 final DecisionTableUIModelMapper uiModelMapper,
                                 final org.uberfire.mvp.Command executeCanvasOperation,
                                 final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); }
AddInputClauseCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                 VetoUndoCommand { @Override protected Command<AbstractCanvasHandler, CanvasViolation> newCanvasCommand(final AbstractCanvasHandler context) { return new AbstractCanvasCommand() { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < dtable.getRule().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddInputClauseCommand(final DecisionTable dtable,
                                 final InputClause inputClause,
                                 final GridData uiModel,
                                 final Supplier<InputClauseColumn> uiModelColumnSupplier,
                                 final int uiColumnIndex,
                                 final DecisionTableUIModelMapper uiModelMapper,
                                 final org.uberfire.mvp.Command executeCanvasOperation,
                                 final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation();  }