@Test public void testOnItemSelectedExpressionColumnUndefinedExpressionType() { setupGrid(0); grid.getModel().setCellValue(0, 0, new ExpressionCellValue(Optional.empty())); assertNoListItems(grid.getItems(0, 0)); }
@Override @SuppressWarnings("unused") public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); final FunctionDefinition.Kind kind = KindUtilities.getKind(getExpression().get().get()); final GridCell<?> cell = model.getCell(uiRowIndex, uiColumnIndex); final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue(); if (!ecv.getValue().isPresent()) { return items; } final BaseExpressionGrid grid = ecv.getValue().get(); if (grid instanceof UndefinedExpressionGrid) { return items; } items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); gridPanel.setFocus(true); clearExpressionType(); })); return items; }
FunctionGrid extends BaseExpressionGrid<FunctionDefinition, DMNGridData, FunctionUIModelMapper> implements HasListSelectorControl,
                                                                                                                        HasParametersControl,
                                                                                                                        HasKindSelectControl { @Override @SuppressWarnings("unused") public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); final FunctionDefinition.Kind kind = KindUtilities.getKind(getExpression().get().get()); final GridCell<?> cell = model.getCell(uiRowIndex, uiColumnIndex); final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue(); if (!ecv.getValue().isPresent()) { return items; } final BaseExpressionGrid grid = ecv.getValue().get(); if (grid instanceof UndefinedExpressionGrid) { return items; } items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); gridPanel.setFocus(true); clearExpressionType(); })); return items; } }
FunctionGrid extends BaseExpressionGrid<FunctionDefinition, DMNGridData, FunctionUIModelMapper> implements HasListSelectorControl,
                                                                                                                        HasParametersControl,
                                                                                                                        HasKindSelectControl { @Override @SuppressWarnings("unused") public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); final FunctionDefinition.Kind kind = KindUtilities.getKind(getExpression().get().get()); final GridCell<?> cell = model.getCell(uiRowIndex, uiColumnIndex); final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue(); if (!ecv.getValue().isPresent()) { return items; } final BaseExpressionGrid grid = ecv.getValue().get(); if (grid instanceof UndefinedExpressionGrid) { return items; } items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); gridPanel.setFocus(true); clearExpressionType(); })); return items; } FunctionGrid(final GridCellTuple parent,
                        final Optional<String> nodeUUID,
                        final HasExpression hasExpression,
                        final Optional<HasName> hasName,
                        final DMNGridPanel gridPanel,
                        final DMNGridLayer gridLayer,
                        final DMNGridData 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 Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                        final Supplier<ExpressionEditorDefinitions> supplementaryEditorDefinitionsSupplier,
                        final ValueAndDataTypePopoverView.Presenter headerEditor,
                        final ParametersPopoverView.Presenter parametersEditor,
                        final KindPopoverView.Presenter kindEditor,
                        final ReadOnlyProvider readOnlyProvider); }
FunctionGrid extends BaseExpressionGrid<FunctionDefinition, DMNGridData, FunctionUIModelMapper> implements HasListSelectorControl,
                                                                                                                        HasParametersControl,
                                                                                                                        HasKindSelectControl { @Override @SuppressWarnings("unused") public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); final FunctionDefinition.Kind kind = KindUtilities.getKind(getExpression().get().get()); final GridCell<?> cell = model.getCell(uiRowIndex, uiColumnIndex); final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue(); if (!ecv.getValue().isPresent()) { return items; } final BaseExpressionGrid grid = ecv.getValue().get(); if (grid instanceof UndefinedExpressionGrid) { return items; } items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); gridPanel.setFocus(true); clearExpressionType(); })); return items; } FunctionGrid(final GridCellTuple parent,
                        final Optional<String> nodeUUID,
                        final HasExpression hasExpression,
                        final Optional<HasName> hasName,
                        final DMNGridPanel gridPanel,
                        final DMNGridLayer gridLayer,
                        final DMNGridData 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 Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                        final Supplier<ExpressionEditorDefinitions> supplementaryEditorDefinitionsSupplier,
                        final ValueAndDataTypePopoverView.Presenter headerEditor,
                        final ParametersPopoverView.Presenter parametersEditor,
                        final KindPopoverView.Presenter kindEditor,
                        final ReadOnlyProvider readOnlyProvider); @Override FunctionUIModelMapper makeUiModelMapper(); @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 List<InformationItem> getParameters(); @Override void addParameter(final Command onSuccess); @Override void removeParameter(final InformationItem parameter,
                                final Command onSuccess); @Override void updateParameterName(final InformationItem parameter,
                                    final String name,
                                    final Command onSuccess); @Override void updateParameterTypeRef(final InformationItem parameter,
                                       final QName typeRef); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex); @Override void setFunctionKind(final FunctionDefinition.Kind kind); }
FunctionGrid extends BaseExpressionGrid<FunctionDefinition, DMNGridData, FunctionUIModelMapper> implements HasListSelectorControl,
                                                                                                                        HasParametersControl,
                                                                                                                        HasKindSelectControl { @Override @SuppressWarnings("unused") public List<ListSelectorItem> getItems(final int uiRowIndex, final int uiColumnIndex) { final List<ListSelectorItem> items = new ArrayList<>(); final FunctionDefinition.Kind kind = KindUtilities.getKind(getExpression().get().get()); final GridCell<?> cell = model.getCell(uiRowIndex, uiColumnIndex); final ExpressionCellValue ecv = (ExpressionCellValue) cell.getValue(); if (!ecv.getValue().isPresent()) { return items; } final BaseExpressionGrid grid = ecv.getValue().get(); if (grid instanceof UndefinedExpressionGrid) { return items; } items.add(ListSelectorTextItem.build(translationService.format(DMNEditorConstants.ExpressionEditor_Clear), true, () -> { cellEditorControls.hide(); gridPanel.setFocus(true); clearExpressionType(); })); return items; } FunctionGrid(final GridCellTuple parent,
                        final Optional<String> nodeUUID,
                        final HasExpression hasExpression,
                        final Optional<HasName> hasName,
                        final DMNGridPanel gridPanel,
                        final DMNGridLayer gridLayer,
                        final DMNGridData 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 Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                        final Supplier<ExpressionEditorDefinitions> supplementaryEditorDefinitionsSupplier,
                        final ValueAndDataTypePopoverView.Presenter headerEditor,
                        final ParametersPopoverView.Presenter parametersEditor,
                        final KindPopoverView.Presenter kindEditor,
                        final ReadOnlyProvider readOnlyProvider); @Override FunctionUIModelMapper makeUiModelMapper(); @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 List<InformationItem> getParameters(); @Override void addParameter(final Command onSuccess); @Override void removeParameter(final InformationItem parameter,
                                final Command onSuccess); @Override void updateParameterName(final InformationItem parameter,
                                    final String name,
                                    final Command onSuccess); @Override void updateParameterTypeRef(final InformationItem parameter,
                                       final QName typeRef); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex); @Override void setFunctionKind(final FunctionDefinition.Kind kind);  }