@Test public void testOnItemSelectedDivider() { setupGrid(0); final ListSelectorDividerItem dItem = mock(ListSelectorDividerItem.class); grid.onItemSelected(dItem); verify(cellEditorControls, never()).hide(); verify(grid, never()).onExpressionTypeChanged(any(ExpressionType.class)); }
public void onExpressionTypeChanged(final ExpressionType type) { final Optional<Expression> expression = expressionEditorDefinitionsSupplier .get() .stream() .filter(e -> e.getType().equals(type)) .map(ExpressionEditorDefinition::getModelClass) .findFirst() .get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new SetCellValueCommand(parent, nodeUUID, hasExpression, () -> expression, expressionGridCache, (editor) -> { resize(BaseExpressionGrid.RESIZE_EXISTING); editor.ifPresent(BaseExpressionGrid::selectFirstCell); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectCell(0, 0, false, false); }, () -> { Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = Optional.empty(); if (nodeUUID.isPresent()) { final String uuid = nodeUUID.get(); editor = expressionGridCache.getExpressionGrid(uuid); } if (!editor.isPresent()) { ed.enrich(nodeUUID, hasExpression, expression); editor = ed.getEditor(parent, nodeUUID, hasExpression, hasName, isOnlyVisualChangeAllowed, nesting); } return editor; })); }); }
UndefinedExpressionGrid extends BaseDelegatingExpressionGrid<Expression, DMNGridData, UndefinedExpressionUIModelMapper> implements HasListSelectorControl { public void onExpressionTypeChanged(final ExpressionType type) { final Optional<Expression> expression = expressionEditorDefinitionsSupplier .get() .stream() .filter(e -> e.getType().equals(type)) .map(ExpressionEditorDefinition::getModelClass) .findFirst() .get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new SetCellValueCommand(parent, nodeUUID, hasExpression, () -> expression, expressionGridCache, (editor) -> { resize(BaseExpressionGrid.RESIZE_EXISTING); editor.ifPresent(BaseExpressionGrid::selectFirstCell); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectCell(0, 0, false, false); }, () -> { Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = Optional.empty(); if (nodeUUID.isPresent()) { final String uuid = nodeUUID.get(); editor = expressionGridCache.getExpressionGrid(uuid); } if (!editor.isPresent()) { ed.enrich(nodeUUID, hasExpression, expression); editor = ed.getEditor(parent, nodeUUID, hasExpression, hasName, isOnlyVisualChangeAllowed, nesting); } return editor; })); }); } }
UndefinedExpressionGrid extends BaseDelegatingExpressionGrid<Expression, DMNGridData, UndefinedExpressionUIModelMapper> implements HasListSelectorControl { public void onExpressionTypeChanged(final ExpressionType type) { final Optional<Expression> expression = expressionEditorDefinitionsSupplier .get() .stream() .filter(e -> e.getType().equals(type)) .map(ExpressionEditorDefinition::getModelClass) .findFirst() .get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new SetCellValueCommand(parent, nodeUUID, hasExpression, () -> expression, expressionGridCache, (editor) -> { resize(BaseExpressionGrid.RESIZE_EXISTING); editor.ifPresent(BaseExpressionGrid::selectFirstCell); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectCell(0, 0, false, false); }, () -> { Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = Optional.empty(); if (nodeUUID.isPresent()) { final String uuid = nodeUUID.get(); editor = expressionGridCache.getExpressionGrid(uuid); } if (!editor.isPresent()) { ed.enrich(nodeUUID, hasExpression, expression); editor = ed.getEditor(parent, nodeUUID, hasExpression, hasName, isOnlyVisualChangeAllowed, nesting); } return editor; })); }); } UndefinedExpressionGrid(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 UndefinedExpressionSelectorPopoverView.Presenter undefinedExpressionSelector,
                                   final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                   final ExpressionGridCache expressionGridCache,
                                   final ReadOnlyProvider readOnlyProvider); }
UndefinedExpressionGrid extends BaseDelegatingExpressionGrid<Expression, DMNGridData, UndefinedExpressionUIModelMapper> implements HasListSelectorControl { public void onExpressionTypeChanged(final ExpressionType type) { final Optional<Expression> expression = expressionEditorDefinitionsSupplier .get() .stream() .filter(e -> e.getType().equals(type)) .map(ExpressionEditorDefinition::getModelClass) .findFirst() .get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new SetCellValueCommand(parent, nodeUUID, hasExpression, () -> expression, expressionGridCache, (editor) -> { resize(BaseExpressionGrid.RESIZE_EXISTING); editor.ifPresent(BaseExpressionGrid::selectFirstCell); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectCell(0, 0, false, false); }, () -> { Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = Optional.empty(); if (nodeUUID.isPresent()) { final String uuid = nodeUUID.get(); editor = expressionGridCache.getExpressionGrid(uuid); } if (!editor.isPresent()) { ed.enrich(nodeUUID, hasExpression, expression); editor = ed.getEditor(parent, nodeUUID, hasExpression, hasName, isOnlyVisualChangeAllowed, nesting); } return editor; })); }); } UndefinedExpressionGrid(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 UndefinedExpressionSelectorPopoverView.Presenter undefinedExpressionSelector,
                                   final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                   final ExpressionGridCache expressionGridCache,
                                   final ReadOnlyProvider readOnlyProvider); @Override List<NodeMouseEventHandler> getNodeMouseClickEventHandlers(final GridSelectionManager selectionManager); @Override List<NodeMouseEventHandler> getNodeMouseDoubleClickEventHandlers(final GridSelectionManager selectionManager,
                                                                            final GridPinnedModeManager pinnedModeManager); @Override UndefinedExpressionUIModelMapper makeUiModelMapper(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override double getPadding(); @Override boolean isCacheable(); void onExpressionTypeChanged(final ExpressionType type); @SuppressWarnings("unused") void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex); }
UndefinedExpressionGrid extends BaseDelegatingExpressionGrid<Expression, DMNGridData, UndefinedExpressionUIModelMapper> implements HasListSelectorControl { public void onExpressionTypeChanged(final ExpressionType type) { final Optional<Expression> expression = expressionEditorDefinitionsSupplier .get() .stream() .filter(e -> e.getType().equals(type)) .map(ExpressionEditorDefinition::getModelClass) .findFirst() .get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new SetCellValueCommand(parent, nodeUUID, hasExpression, () -> expression, expressionGridCache, (editor) -> { resize(BaseExpressionGrid.RESIZE_EXISTING); editor.ifPresent(BaseExpressionGrid::selectFirstCell); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectCell(0, 0, false, false); }, () -> { Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = Optional.empty(); if (nodeUUID.isPresent()) { final String uuid = nodeUUID.get(); editor = expressionGridCache.getExpressionGrid(uuid); } if (!editor.isPresent()) { ed.enrich(nodeUUID, hasExpression, expression); editor = ed.getEditor(parent, nodeUUID, hasExpression, hasName, isOnlyVisualChangeAllowed, nesting); } return editor; })); }); } UndefinedExpressionGrid(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 UndefinedExpressionSelectorPopoverView.Presenter undefinedExpressionSelector,
                                   final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                   final ExpressionGridCache expressionGridCache,
                                   final ReadOnlyProvider readOnlyProvider); @Override List<NodeMouseEventHandler> getNodeMouseClickEventHandlers(final GridSelectionManager selectionManager); @Override List<NodeMouseEventHandler> getNodeMouseDoubleClickEventHandlers(final GridSelectionManager selectionManager,
                                                                            final GridPinnedModeManager pinnedModeManager); @Override UndefinedExpressionUIModelMapper makeUiModelMapper(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override double getPadding(); @Override boolean isCacheable(); void onExpressionTypeChanged(final ExpressionType type); @SuppressWarnings("unused") void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex);  }