@Test public void testGetItems() { setupGrid(0); final java.util.List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 0); assertThat(items.size()).isEqualTo(8); assertListSelectorHeaderItem(items.get(HEADER_COLUMNS), DMNEditorConstants.RelationEditor_HeaderColumns); assertListSelectorTextItem(items.get(INSERT_COLUMN_BEFORE), DMNEditorConstants.RelationEditor_InsertColumnLeft); assertListSelectorTextItem(items.get(INSERT_COLUMN_AFTER), DMNEditorConstants.RelationEditor_InsertColumnRight); assertListSelectorTextItem(items.get(DELETE_COLUMN), DMNEditorConstants.RelationEditor_DeleteColumn); assertListSelectorHeaderItem(items.get(HEADER_ROWS), DMNEditorConstants.RelationEditor_HeaderRows); assertListSelectorTextItem(items.get(INSERT_ROW_ABOVE), DMNEditorConstants.RelationEditor_InsertRowAbove); assertListSelectorTextItem(items.get(INSERT_ROW_BELOW), DMNEditorConstants.RelationEditor_InsertRowBelow); assertListSelectorTextItem(items.get(DELETE_ROW), DMNEditorConstants.RelationEditor_DeleteRow); }
@Override @SuppressWarnings("unused") public java.util.List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final java.util.List<ListSelectorItem> items = new ArrayList<>(); addColumnItems(items, uiColumnIndex); final boolean isMultiRow = SelectionUtils.isMultiRow(model); items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.RelationEditor_HeaderRows))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowAbove), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowBelow), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex + 1)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_DeleteRow), !isMultiRow && model.getRowCount() > 1, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> deleteRow(uiRowIndex)); })); return items; }
RelationGrid extends BaseExpressionGrid<Relation, RelationGridData, RelationUIModelMapper> implements HasListSelectorControl { @Override @SuppressWarnings("unused") public java.util.List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final java.util.List<ListSelectorItem> items = new ArrayList<>(); addColumnItems(items, uiColumnIndex); final boolean isMultiRow = SelectionUtils.isMultiRow(model); items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.RelationEditor_HeaderRows))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowAbove), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowBelow), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex + 1)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_DeleteRow), !isMultiRow && model.getRowCount() > 1, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> deleteRow(uiRowIndex)); })); return items; } }
RelationGrid extends BaseExpressionGrid<Relation, RelationGridData, RelationUIModelMapper> implements HasListSelectorControl { @Override @SuppressWarnings("unused") public java.util.List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final java.util.List<ListSelectorItem> items = new ArrayList<>(); addColumnItems(items, uiColumnIndex); final boolean isMultiRow = SelectionUtils.isMultiRow(model); items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.RelationEditor_HeaderRows))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowAbove), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowBelow), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex + 1)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_DeleteRow), !isMultiRow && model.getRowCount() > 1, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> deleteRow(uiRowIndex)); })); return items; } RelationGrid(final GridCellTuple parent,
                        final Optional<String> nodeUUID,
                        final HasExpression hasExpression,
                        final Optional<HasName> hasName,
                        final DMNGridPanel gridPanel,
                        final DMNGridLayer gridLayer,
                        final RelationGridData 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 ManagedInstance<ValueAndDataTypePopoverView.Presenter> headerEditors,
                        final ReadOnlyProvider readOnlyProvider); }
RelationGrid extends BaseExpressionGrid<Relation, RelationGridData, RelationUIModelMapper> implements HasListSelectorControl { @Override @SuppressWarnings("unused") public java.util.List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final java.util.List<ListSelectorItem> items = new ArrayList<>(); addColumnItems(items, uiColumnIndex); final boolean isMultiRow = SelectionUtils.isMultiRow(model); items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.RelationEditor_HeaderRows))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowAbove), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowBelow), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex + 1)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_DeleteRow), !isMultiRow && model.getRowCount() > 1, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> deleteRow(uiRowIndex)); })); return items; } RelationGrid(final GridCellTuple parent,
                        final Optional<String> nodeUUID,
                        final HasExpression hasExpression,
                        final Optional<HasName> hasName,
                        final DMNGridPanel gridPanel,
                        final DMNGridLayer gridLayer,
                        final RelationGridData 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 ManagedInstance<ValueAndDataTypePopoverView.Presenter> headerEditors,
                        final ReadOnlyProvider readOnlyProvider); @Override RelationUIModelMapper makeUiModelMapper(); @Override void initialiseUiColumns(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override @SuppressWarnings("unused") java.util.List<ListSelectorItem> getItems(final int uiRowIndex,
                                                     final int uiColumnIndex); @Override void onItemSelected(final ListSelectorItem item); @Override void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex); }
RelationGrid extends BaseExpressionGrid<Relation, RelationGridData, RelationUIModelMapper> implements HasListSelectorControl { @Override @SuppressWarnings("unused") public java.util.List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final java.util.List<ListSelectorItem> items = new ArrayList<>(); addColumnItems(items, uiColumnIndex); final boolean isMultiRow = SelectionUtils.isMultiRow(model); items.add(ListSelectorHeaderItem.build(translationService.format(DMNEditorConstants.RelationEditor_HeaderRows))); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowAbove), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_InsertRowBelow), !isMultiRow, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> addRow(uiRowIndex + 1)); })); items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.RelationEditor_DeleteRow), !isMultiRow && model.getRowCount() > 1, () -> { cellEditorControls.hide(); getExpression().get().ifPresent(e -> deleteRow(uiRowIndex)); })); return items; } RelationGrid(final GridCellTuple parent,
                        final Optional<String> nodeUUID,
                        final HasExpression hasExpression,
                        final Optional<HasName> hasName,
                        final DMNGridPanel gridPanel,
                        final DMNGridLayer gridLayer,
                        final RelationGridData 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 ManagedInstance<ValueAndDataTypePopoverView.Presenter> headerEditors,
                        final ReadOnlyProvider readOnlyProvider); @Override RelationUIModelMapper makeUiModelMapper(); @Override void initialiseUiColumns(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override @SuppressWarnings("unused") java.util.List<ListSelectorItem> getItems(final int uiRowIndex,
                                                     final int uiColumnIndex); @Override void onItemSelected(final ListSelectorItem item); @Override void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex);  }