@Test @SuppressWarnings("unchecked") public void testClearExpressionType() { doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt()); setupGrid(0); grid.clearExpressionType(); verify(sessionCommandManager).execute(eq(canvasHandler), clearExpressionTypeCommandCaptor.capture()); final ClearExpressionTypeCommand clearExpressionTypeCommand = clearExpressionTypeCommandCaptor.getValue(); clearExpressionTypeCommand.execute(canvasHandler); verify(grid).resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); verify(gridLayer).select(literalExpressionEditor); verify(literalExpressionEditor).selectFirstCell(); verify(gridLayer).batch(redrawCommandCaptor.capture()); redrawCommandCaptor.getValue().execute(); verify(gridLayer).draw(); reset(grid, gridLayer); clearExpressionTypeCommand.undo(canvasHandler); assertThat(grid.getModel().getColumns().get(1).getWidth()).isEqualTo(UndefinedExpressionColumn.DEFAULT_WIDTH); verify(grid).resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); verify(grid).selectExpressionEditorFirstCell(eq(0), eq(1)); verify(gridLayer).select(literalExpressionEditor); verify(literalExpressionEditor, times(2)).selectFirstCell(); verify(gridLayer).batch(redrawCommandCaptor.capture()); assertThat(redrawCommandCaptor.getAllValues()).hasSize(2); redrawCommandCaptor.getAllValues().get(1).execute(); verify(gridLayer).draw(); }
void clearExpressionType() { getExpression().get().ifPresent(function -> { final GridCellTuple gc = new GridCellTuple(0, 1, this); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, function, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); })); }); }
FunctionGrid extends BaseExpressionGrid<FunctionDefinition, DMNGridData, FunctionUIModelMapper> implements HasListSelectorControl,
                                                                                                                        HasParametersControl,
                                                                                                                        HasKindSelectControl { void clearExpressionType() { getExpression().get().ifPresent(function -> { final GridCellTuple gc = new GridCellTuple(0, 1, this); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, function, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); })); }); } }
FunctionGrid extends BaseExpressionGrid<FunctionDefinition, DMNGridData, FunctionUIModelMapper> implements HasListSelectorControl,
                                                                                                                        HasParametersControl,
                                                                                                                        HasKindSelectControl { void clearExpressionType() { getExpression().get().ifPresent(function -> { final GridCellTuple gc = new GridCellTuple(0, 1, this); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, function, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); })); }); } 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 { void clearExpressionType() { getExpression().get().ifPresent(function -> { final GridCellTuple gc = new GridCellTuple(0, 1, this); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, function, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); })); }); } 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 { void clearExpressionType() { getExpression().get().ifPresent(function -> { final GridCellTuple gc = new GridCellTuple(0, 1, this); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, function, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(0, 1); })); }); } 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);  }