@Test @SuppressWarnings("unchecked") public void testDuplicateDecisionRule() { setupGrid(makeHasNameForDecision(), 0); final DecisionTable dtable = grid.getExpression().get().get(); assertThat(dtable.getRule().size()).isEqualTo(1); final DecisionRule rule0 = dtable.getRule().get(0); assertThat(rule0.getInputEntry().size()).isEqualTo(1); assertThat(rule0.getOutputEntry().size()).isEqualTo(1); rule0.getInputEntry().get(0).getText().setValue("input"); rule0.getOutputEntry().get(0).getText().setValue("output"); rule0.getDescription().setValue("description"); grid.duplicateDecisionRule(0); verify(sessionCommandManager).execute(eq(canvasHandler), addDecisionRuleCommandCaptor.capture()); final AddDecisionRuleCommand addDecisionRuleCommand = addDecisionRuleCommandCaptor.getValue(); addDecisionRuleCommand.execute(canvasHandler); assertThat(dtable.getRule().size()).isEqualTo(2); final DecisionRule rule1 = dtable.getRule().get(1); assertThat(rule1.getInputEntry().size()).isEqualTo(1); assertThat(rule1.getOutputEntry().size()).isEqualTo(1); assertThat(rule0.getInputEntry().get(0).getText().getValue()).isEqualTo("input"); assertThat(rule0.getOutputEntry().get(0).getText().getValue()).isEqualTo("output"); assertThat(rule0.getDescription().getValue()).isEqualTo("description"); assertThat(rule1.getInputEntry().get(0).getText().getValue()).isEqualTo("input"); assertThat(rule1.getOutputEntry().get(0).getText().getValue()).isEqualTo("output"); assertThat(rule1.getDescription().getValue()).isEqualTo("description"); verifyCommandExecuteOperation(BaseExpressionGrid.RESIZE_EXISTING); }
void duplicateDecisionRule(final int index) { getExpression().get().ifPresent(dtable -> { final GridRow decisionTableRow = new LiteralExpressionGridRow(); final DecisionRule decisionRule = DecisionRuleFactory.duplicateDecisionRule(index, dtable); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); }); }
DecisionTableGrid extends BaseExpressionGrid<DecisionTable, DecisionTableGridData, DecisionTableUIModelMapper> implements HasListSelectorControl,
                                                                                                                                       HasHitPolicyControl { void duplicateDecisionRule(final int index) { getExpression().get().ifPresent(dtable -> { final GridRow decisionTableRow = new LiteralExpressionGridRow(); final DecisionRule decisionRule = DecisionRuleFactory.duplicateDecisionRule(index, dtable); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); }); } }
DecisionTableGrid extends BaseExpressionGrid<DecisionTable, DecisionTableGridData, DecisionTableUIModelMapper> implements HasListSelectorControl,
                                                                                                                                       HasHitPolicyControl { void duplicateDecisionRule(final int index) { getExpression().get().ifPresent(dtable -> { final GridRow decisionTableRow = new LiteralExpressionGridRow(); final DecisionRule decisionRule = DecisionRuleFactory.duplicateDecisionRule(index, dtable); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); }); } DecisionTableGrid(final GridCellTuple parent,
                             final Optional<String> nodeUUID,
                             final HasExpression hasExpression,
                             final Optional<HasName> hasName,
                             final DMNGridPanel gridPanel,
                             final DMNGridLayer gridLayer,
                             final DecisionTableGridData gridData,
                             final DefinitionUtils definitionUtils,
                             final SessionManager sessionManager,
                             final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
                             final DefaultCanvasCommandFactory canvasCommandFactory,
                             final Event<ExpressionEditorChanged> editorSelectedEvent,
                             final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent,
                             final Event<DomainObjectSelectionEvent> domainObjectSelectionEvent,
                             final CellEditorControlsView.Presenter cellEditorControls,
                             final ListSelectorView.Presenter listSelector,
                             final TranslationService translationService,
                             final boolean isOnlyVisualChangeAllowed,
                             final int nesting,
                             final HitPolicyPopoverView.Presenter hitPolicyEditor,
                             final ManagedInstance<ValueAndDataTypePopoverView.Presenter> headerEditors,
                             final ReadOnlyProvider readOnlyProvider); }
DecisionTableGrid extends BaseExpressionGrid<DecisionTable, DecisionTableGridData, DecisionTableUIModelMapper> implements HasListSelectorControl,
                                                                                                                                       HasHitPolicyControl { void duplicateDecisionRule(final int index) { getExpression().get().ifPresent(dtable -> { final GridRow decisionTableRow = new LiteralExpressionGridRow(); final DecisionRule decisionRule = DecisionRuleFactory.duplicateDecisionRule(index, dtable); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); }); } DecisionTableGrid(final GridCellTuple parent,
                             final Optional<String> nodeUUID,
                             final HasExpression hasExpression,
                             final Optional<HasName> hasName,
                             final DMNGridPanel gridPanel,
                             final DMNGridLayer gridLayer,
                             final DecisionTableGridData gridData,
                             final DefinitionUtils definitionUtils,
                             final SessionManager sessionManager,
                             final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
                             final DefaultCanvasCommandFactory canvasCommandFactory,
                             final Event<ExpressionEditorChanged> editorSelectedEvent,
                             final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent,
                             final Event<DomainObjectSelectionEvent> domainObjectSelectionEvent,
                             final CellEditorControlsView.Presenter cellEditorControls,
                             final ListSelectorView.Presenter listSelector,
                             final TranslationService translationService,
                             final boolean isOnlyVisualChangeAllowed,
                             final int nesting,
                             final HitPolicyPopoverView.Presenter hitPolicyEditor,
                             final ManagedInstance<ValueAndDataTypePopoverView.Presenter> headerEditors,
                             final ReadOnlyProvider readOnlyProvider); @Override DecisionTableUIModelMapper makeUiModelMapper(); @Override void initialiseUiColumns(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override @SuppressWarnings("unused") List<ListSelectorItem> getItems(final int uiRowIndex,
                                           final int uiColumnIndex); @Override void onItemSelected(final ListSelectorItem item); @Override HitPolicy getHitPolicy(); @Override BuiltinAggregator getBuiltinAggregator(); @Override void setHitPolicy(final HitPolicy hitPolicy,
                             final Command onSuccess); @Override void setBuiltinAggregator(final BuiltinAggregator aggregator); @Override void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex); }
DecisionTableGrid extends BaseExpressionGrid<DecisionTable, DecisionTableGridData, DecisionTableUIModelMapper> implements HasListSelectorControl,
                                                                                                                                       HasHitPolicyControl { void duplicateDecisionRule(final int index) { getExpression().get().ifPresent(dtable -> { final GridRow decisionTableRow = new LiteralExpressionGridRow(); final DecisionRule decisionRule = DecisionRuleFactory.duplicateDecisionRule(index, dtable); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddDecisionRuleCommand(dtable, decisionRule, model, decisionTableRow, index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); }); } DecisionTableGrid(final GridCellTuple parent,
                             final Optional<String> nodeUUID,
                             final HasExpression hasExpression,
                             final Optional<HasName> hasName,
                             final DMNGridPanel gridPanel,
                             final DMNGridLayer gridLayer,
                             final DecisionTableGridData gridData,
                             final DefinitionUtils definitionUtils,
                             final SessionManager sessionManager,
                             final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
                             final DefaultCanvasCommandFactory canvasCommandFactory,
                             final Event<ExpressionEditorChanged> editorSelectedEvent,
                             final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent,
                             final Event<DomainObjectSelectionEvent> domainObjectSelectionEvent,
                             final CellEditorControlsView.Presenter cellEditorControls,
                             final ListSelectorView.Presenter listSelector,
                             final TranslationService translationService,
                             final boolean isOnlyVisualChangeAllowed,
                             final int nesting,
                             final HitPolicyPopoverView.Presenter hitPolicyEditor,
                             final ManagedInstance<ValueAndDataTypePopoverView.Presenter> headerEditors,
                             final ReadOnlyProvider readOnlyProvider); @Override DecisionTableUIModelMapper makeUiModelMapper(); @Override void initialiseUiColumns(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override @SuppressWarnings("unused") List<ListSelectorItem> getItems(final int uiRowIndex,
                                           final int uiColumnIndex); @Override void onItemSelected(final ListSelectorItem item); @Override HitPolicy getHitPolicy(); @Override BuiltinAggregator getBuiltinAggregator(); @Override void setHitPolicy(final HitPolicy hitPolicy,
                             final Command onSuccess); @Override void setBuiltinAggregator(final BuiltinAggregator aggregator); @Override void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex);  }