@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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ii = 0; ii < relation.getColumn().size(); ii++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } 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; } }; }
AddRelationRowCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ii = 0; ii < relation.getColumn().size(); ii++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } 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; } }; } }
AddRelationRowCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ii = 0; ii < relation.getColumn().size(); ii++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } 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; } }; } AddRelationRowCommand(final Relation relation,
                                 final List row,
                                 final GridData uiModel,
                                 final GridRow uiModelRow,
                                 final int uiRowIndex,
                                 final RelationUIModelMapper uiModelMapper,
                                 final org.uberfire.mvp.Command canvasOperation); }
AddRelationRowCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ii = 0; ii < relation.getColumn().size(); ii++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } 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; } }; } AddRelationRowCommand(final Relation relation,
                                 final List row,
                                 final GridData uiModel,
                                 final GridRow uiModelRow,
                                 final int uiRowIndex,
                                 final RelationUIModelMapper uiModelMapper,
                                 final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
AddRelationRowCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ii = 0; ii < relation.getColumn().size(); ii++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } 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; } }; } AddRelationRowCommand(final Relation relation,
                                 final List row,
                                 final GridData uiModel,
                                 final GridRow uiModelRow,
                                 final int uiRowIndex,
                                 final RelationUIModelMapper uiModelMapper,
                                 final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }