@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) { final GridColumn<?> gridColumn = uiModel.getColumns().get(uiColumnIndex); uiModel.deleteColumn(gridColumn); updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModel.insertColumn(uiColumnIndex, oldUiModelColumn); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; }
DeleteRelationColumnCommand 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) { final GridColumn<?> gridColumn = uiModel.getColumns().get(uiColumnIndex); uiModel.deleteColumn(gridColumn); updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModel.insertColumn(uiColumnIndex, oldUiModelColumn); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } }
DeleteRelationColumnCommand 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) { final GridColumn<?> gridColumn = uiModel.getColumns().get(uiColumnIndex); uiModel.deleteColumn(gridColumn); updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModel.insertColumn(uiColumnIndex, oldUiModelColumn); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } DeleteRelationColumnCommand(final Relation relation,
                                       final GridData uiModel,
                                       final int uiColumnIndex,
                                       final RelationUIModelMapper uiModelMapper,
                                       final org.uberfire.mvp.Command executeCanvasOperation,
                                       final org.uberfire.mvp.Command undoCanvasOperation); }
DeleteRelationColumnCommand 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) { final GridColumn<?> gridColumn = uiModel.getColumns().get(uiColumnIndex); uiModel.deleteColumn(gridColumn); updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModel.insertColumn(uiColumnIndex, oldUiModelColumn); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } DeleteRelationColumnCommand(final Relation relation,
                                       final GridData uiModel,
                                       final int uiColumnIndex,
                                       final RelationUIModelMapper uiModelMapper,
                                       final org.uberfire.mvp.Command executeCanvasOperation,
                                       final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation(); }
DeleteRelationColumnCommand 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) { final GridColumn<?> gridColumn = uiModel.getColumns().get(uiColumnIndex); uiModel.deleteColumn(gridColumn); updateParentInformation(); executeCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler handler) { uiModel.insertColumn(uiColumnIndex, oldUiModelColumn); for (int rowIndex = 0; rowIndex < relation.getRow().size(); rowIndex++) { uiModelMapper.fromDMNModel(rowIndex, uiColumnIndex); } updateParentInformation(); undoCanvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } DeleteRelationColumnCommand(final Relation relation,
                                       final GridData uiModel,
                                       final int uiColumnIndex,
                                       final RelationUIModelMapper uiModelMapper,
                                       final org.uberfire.mvp.Command executeCanvasOperation,
                                       final org.uberfire.mvp.Command undoCanvasOperation); void updateParentInformation();  }