@Test public void testCanvasCommandAllow() { 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) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; }
AddRelationColumnCommand 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) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } }
AddRelationColumnCommand 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) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
                                    final InformationItem informationItem,
                                    final GridData uiModel,
                                    final Supplier<RelationColumn> uiModelColumnSupplier,
                                    final int uiColumnIndex,
                                    final RelationUIModelMapper uiModelMapper,
                                    final org.uberfire.mvp.Command executeCanvasOperation,
                                    final org.uberfire.mvp.Command undoCanvasOperation); }
AddRelationColumnCommand 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) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
                                    final InformationItem informationItem,
                                    final GridData uiModel,
                                    final Supplier<RelationColumn> uiModelColumnSupplier,
                                    final int uiColumnIndex,
                                    final RelationUIModelMapper uiModelMapper,
                                    final org.uberfire.mvp.Command executeCanvasOperation,
                                    final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); }
AddRelationColumnCommand 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) { if (!uiModelColumn.isPresent()) { uiModelColumn = Optional.of(uiModelColumnSupplier.get()); } uiModel.insertColumn(uiColumnIndex, uiModelColumn.get()); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModelColumn.ifPresent(uiModel::deleteColumn); updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddRelationColumnCommand(final Relation relation,
                                    final InformationItem informationItem,
                                    final GridData uiModel,
                                    final Supplier<RelationColumn> uiModelColumnSupplier,
                                    final int uiColumnIndex,
                                    final RelationUIModelMapper uiModelMapper,
                                    final org.uberfire.mvp.Command executeCanvasOperation,
                                    final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation();  }