@Test public void testGetHeaderItemsOutputClauseColumn() { setupGrid(makeHasNameForDecision(), 0); assertOutputClauseItems(grid.getHeaderItems(0, 2)); }
@SuppressWarnings("unused") List<ListSelectorItem> getHeaderItems(final int uiHeaderRowIndex, final int uiHeaderColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); getExpression().get().ifPresent(dtable -> { final boolean isMultiHeaderColumn = SelectionUtils.isMultiHeaderColumn(model); final DecisionTableUIModelMapperHelper.DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, uiHeaderColumnIndex); switch (section) { case INPUT_CLAUSES: addInputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); break; case OUTPUT_CLAUSES: final List<GridColumn<?>> allColumns = model.getColumns(); final List<GridColumn.HeaderMetaData> headerMetaData = allColumns.get(uiHeaderColumnIndex).getHeaderMetaData(); final GridColumn.HeaderMetaData cellHeaderMetaData = headerMetaData.get(uiHeaderRowIndex); if (headerMetaData.size() - 1 == uiHeaderRowIndex) { addOutputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); } else { items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_OutputClauseHeader))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseLeft), true, () -> addOutputClause(getHeaderBlockStartColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex)))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseRight), true, () -> addOutputClause(getHeaderBlockEndColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex) + 1))); } break; case ANNOTATION_CLAUSES: addRuleAnnotationClauseItems(items, uiHeaderColumnIndex, dtable.getAnnotations().size() <= 1); } }); return items; }
DecisionTableGrid extends BaseExpressionGrid<DecisionTable, DecisionTableGridData, DecisionTableUIModelMapper> implements HasListSelectorControl,
                                                                                                                                       HasHitPolicyControl { @SuppressWarnings("unused") List<ListSelectorItem> getHeaderItems(final int uiHeaderRowIndex, final int uiHeaderColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); getExpression().get().ifPresent(dtable -> { final boolean isMultiHeaderColumn = SelectionUtils.isMultiHeaderColumn(model); final DecisionTableUIModelMapperHelper.DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, uiHeaderColumnIndex); switch (section) { case INPUT_CLAUSES: addInputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); break; case OUTPUT_CLAUSES: final List<GridColumn<?>> allColumns = model.getColumns(); final List<GridColumn.HeaderMetaData> headerMetaData = allColumns.get(uiHeaderColumnIndex).getHeaderMetaData(); final GridColumn.HeaderMetaData cellHeaderMetaData = headerMetaData.get(uiHeaderRowIndex); if (headerMetaData.size() - 1 == uiHeaderRowIndex) { addOutputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); } else { items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_OutputClauseHeader))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseLeft), true, () -> addOutputClause(getHeaderBlockStartColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex)))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseRight), true, () -> addOutputClause(getHeaderBlockEndColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex) + 1))); } break; case ANNOTATION_CLAUSES: addRuleAnnotationClauseItems(items, uiHeaderColumnIndex, dtable.getAnnotations().size() <= 1); } }); return items; } }
DecisionTableGrid extends BaseExpressionGrid<DecisionTable, DecisionTableGridData, DecisionTableUIModelMapper> implements HasListSelectorControl,
                                                                                                                                       HasHitPolicyControl { @SuppressWarnings("unused") List<ListSelectorItem> getHeaderItems(final int uiHeaderRowIndex, final int uiHeaderColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); getExpression().get().ifPresent(dtable -> { final boolean isMultiHeaderColumn = SelectionUtils.isMultiHeaderColumn(model); final DecisionTableUIModelMapperHelper.DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, uiHeaderColumnIndex); switch (section) { case INPUT_CLAUSES: addInputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); break; case OUTPUT_CLAUSES: final List<GridColumn<?>> allColumns = model.getColumns(); final List<GridColumn.HeaderMetaData> headerMetaData = allColumns.get(uiHeaderColumnIndex).getHeaderMetaData(); final GridColumn.HeaderMetaData cellHeaderMetaData = headerMetaData.get(uiHeaderRowIndex); if (headerMetaData.size() - 1 == uiHeaderRowIndex) { addOutputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); } else { items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_OutputClauseHeader))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseLeft), true, () -> addOutputClause(getHeaderBlockStartColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex)))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseRight), true, () -> addOutputClause(getHeaderBlockEndColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex) + 1))); } break; case ANNOTATION_CLAUSES: addRuleAnnotationClauseItems(items, uiHeaderColumnIndex, dtable.getAnnotations().size() <= 1); } }); return items; } 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 { @SuppressWarnings("unused") List<ListSelectorItem> getHeaderItems(final int uiHeaderRowIndex, final int uiHeaderColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); getExpression().get().ifPresent(dtable -> { final boolean isMultiHeaderColumn = SelectionUtils.isMultiHeaderColumn(model); final DecisionTableUIModelMapperHelper.DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, uiHeaderColumnIndex); switch (section) { case INPUT_CLAUSES: addInputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); break; case OUTPUT_CLAUSES: final List<GridColumn<?>> allColumns = model.getColumns(); final List<GridColumn.HeaderMetaData> headerMetaData = allColumns.get(uiHeaderColumnIndex).getHeaderMetaData(); final GridColumn.HeaderMetaData cellHeaderMetaData = headerMetaData.get(uiHeaderRowIndex); if (headerMetaData.size() - 1 == uiHeaderRowIndex) { addOutputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); } else { items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_OutputClauseHeader))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseLeft), true, () -> addOutputClause(getHeaderBlockStartColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex)))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseRight), true, () -> addOutputClause(getHeaderBlockEndColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex) + 1))); } break; case ANNOTATION_CLAUSES: addRuleAnnotationClauseItems(items, uiHeaderColumnIndex, dtable.getAnnotations().size() <= 1); } }); return items; } 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 { @SuppressWarnings("unused") List<ListSelectorItem> getHeaderItems(final int uiHeaderRowIndex, final int uiHeaderColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); getExpression().get().ifPresent(dtable -> { final boolean isMultiHeaderColumn = SelectionUtils.isMultiHeaderColumn(model); final DecisionTableUIModelMapperHelper.DecisionTableSection section = DecisionTableUIModelMapperHelper.getSection(dtable, uiHeaderColumnIndex); switch (section) { case INPUT_CLAUSES: addInputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); break; case OUTPUT_CLAUSES: final List<GridColumn<?>> allColumns = model.getColumns(); final List<GridColumn.HeaderMetaData> headerMetaData = allColumns.get(uiHeaderColumnIndex).getHeaderMetaData(); final GridColumn.HeaderMetaData cellHeaderMetaData = headerMetaData.get(uiHeaderRowIndex); if (headerMetaData.size() - 1 == uiHeaderRowIndex) { addOutputClauseItems(items, dtable, uiHeaderColumnIndex, isMultiHeaderColumn); } else { items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_OutputClauseHeader))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseLeft), true, () -> addOutputClause(getHeaderBlockStartColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex)))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.DecisionTableEditor_InsertOutputClauseRight), true, () -> addOutputClause(getHeaderBlockEndColumnIndex(allColumns, cellHeaderMetaData, uiHeaderRowIndex, uiHeaderColumnIndex) + 1))); } break; case ANNOTATION_CLAUSES: addRuleAnnotationClauseItems(items, uiHeaderColumnIndex, dtable.getAnnotations().size() <= 1); } }); return items; } 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);  }