@Test public void testCanvasCommandAllow() throws Exception { makeCommand(0); 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ici = 0; ici < dtable.getInput().size(); ici++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int oci = 0; oci < dtable.getOutput().size(); oci++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int ani = 0; ani < dtable.getAnnotations().size(); ani++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModel.deleteRow(uiRowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; }
AddDecisionRuleCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ici = 0; ici < dtable.getInput().size(); ici++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int oci = 0; oci < dtable.getOutput().size(); oci++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int ani = 0; ani < dtable.getAnnotations().size(); ani++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModel.deleteRow(uiRowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } }
AddDecisionRuleCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ici = 0; ici < dtable.getInput().size(); ici++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int oci = 0; oci < dtable.getOutput().size(); oci++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int ani = 0; ani < dtable.getAnnotations().size(); ani++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModel.deleteRow(uiRowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddDecisionRuleCommand(final DecisionTable dtable,
                                  final DecisionRule rule,
                                  final GridData uiModel,
                                  final GridRow uiModelRow,
                                  final int uiRowIndex,
                                  final DecisionTableUIModelMapper uiModelMapper,
                                  final org.uberfire.mvp.Command canvasOperation); }
AddDecisionRuleCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ici = 0; ici < dtable.getInput().size(); ici++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int oci = 0; oci < dtable.getOutput().size(); oci++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int ani = 0; ani < dtable.getAnnotations().size(); ani++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModel.deleteRow(uiRowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddDecisionRuleCommand(final DecisionTable dtable,
                                  final DecisionRule rule,
                                  final GridData uiModel,
                                  final GridRow uiModelRow,
                                  final int uiRowIndex,
                                  final DecisionTableUIModelMapper uiModelMapper,
                                  final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
AddDecisionRuleCommand 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) { int columnIndex = 0; uiModel.insertRow(uiRowIndex, uiModelRow); uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); for (int ici = 0; ici < dtable.getInput().size(); ici++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int oci = 0; oci < dtable.getOutput().size(); oci++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } for (int ani = 0; ani < dtable.getAnnotations().size(); ani++) { uiModelMapper.fromDMNModel(uiRowIndex, columnIndex++); } updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } @Override public CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context) { uiModel.deleteRow(uiRowIndex); updateRowNumbers(); updateParentInformation(); canvasOperation.execute(); return CanvasCommandResultBuilder.SUCCESS; } }; } AddDecisionRuleCommand(final DecisionTable dtable,
                                  final DecisionRule rule,
                                  final GridData uiModel,
                                  final GridRow uiModelRow,
                                  final int uiRowIndex,
                                  final DecisionTableUIModelMapper uiModelMapper,
                                  final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }