@Test public void testClearExpressionType() { setupGrid(); final ClearExpressionTypeCommand clearExpressionTypeCommand = clearRowExpression(0); verify(grid).resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); verify(gridLayer).select(undefinedExpressionEditor); verify(undefinedExpressionEditor).selectFirstCell(); verify(gridLayer).batch(redrawCommandCaptor.capture()); redrawCommandCaptor.getValue().execute(); verify(gridLayer).draw(); reset(grid, gridLayer); clearExpressionTypeCommand.undo(canvasHandler); assertThat(grid.getModel().getColumns().get(EXPRESSION_COLUMN_INDEX).getWidth()).isEqualTo(ExpressionEditorColumn.DEFAULT_WIDTH); verify(grid).resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); verify(grid).selectExpressionEditorFirstCell(eq(0), eq(ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX)); verify(gridLayer).select(literalExpressionEditor); verify(literalExpressionEditor).selectFirstCell(); verify(gridLayer).batch(redrawCommandCaptor.capture()); assertThat(redrawCommandCaptor.getAllValues()).hasSize(2); redrawCommandCaptor.getAllValues().get(1).execute(); verify(gridLayer).draw(); }
void clearExpressionType(final int uiRowIndex) { final GridCellTuple gc = new GridCellTuple(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, this); getExpression().get().ifPresent(list -> { final HasExpression hasExpression = list.getExpression().get(uiRowIndex); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, hasExpression, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); })); }); }
ListGrid extends BaseExpressionGrid<List, ListGridData, ListUIModelMapper> implements HasListSelectorControl { void clearExpressionType(final int uiRowIndex) { final GridCellTuple gc = new GridCellTuple(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, this); getExpression().get().ifPresent(list -> { final HasExpression hasExpression = list.getExpression().get(uiRowIndex); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, hasExpression, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); })); }); } }
ListGrid extends BaseExpressionGrid<List, ListGridData, ListUIModelMapper> implements HasListSelectorControl { void clearExpressionType(final int uiRowIndex) { final GridCellTuple gc = new GridCellTuple(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, this); getExpression().get().ifPresent(list -> { final HasExpression hasExpression = list.getExpression().get(uiRowIndex); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, hasExpression, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); })); }); } ListGrid(final GridCellTuple parent,
                    final Optional<String> nodeUUID,
                    final HasExpression hasExpression,
                    final Optional<HasName> hasName,
                    final DMNGridPanel gridPanel,
                    final DMNGridLayer gridLayer,
                    final ListGridData 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 ValueAndDataTypePopoverView.Presenter headerEditor,
                    final ReadOnlyProvider readOnlyProvider); }
ListGrid extends BaseExpressionGrid<List, ListGridData, ListUIModelMapper> implements HasListSelectorControl { void clearExpressionType(final int uiRowIndex) { final GridCellTuple gc = new GridCellTuple(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, this); getExpression().get().ifPresent(list -> { final HasExpression hasExpression = list.getExpression().get(uiRowIndex); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, hasExpression, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); })); }); } ListGrid(final GridCellTuple parent,
                    final Optional<String> nodeUUID,
                    final HasExpression hasExpression,
                    final Optional<HasName> hasName,
                    final DMNGridPanel gridPanel,
                    final DMNGridLayer gridLayer,
                    final ListGridData 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 ValueAndDataTypePopoverView.Presenter headerEditor,
                    final ReadOnlyProvider readOnlyProvider); @Override ListUIModelMapper makeUiModelMapper(); @Override void initialiseUiColumns(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override 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); }
ListGrid extends BaseExpressionGrid<List, ListGridData, ListUIModelMapper> implements HasListSelectorControl { void clearExpressionType(final int uiRowIndex) { final GridCellTuple gc = new GridCellTuple(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX, this); getExpression().get().ifPresent(list -> { final HasExpression hasExpression = list.getExpression().get(uiRowIndex); sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new ClearExpressionTypeCommand(gc, hasExpression, uiModelMapper, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); }, () -> { resize(BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); selectExpressionEditorFirstCell(uiRowIndex, ListUIModelMapperHelper.EXPRESSION_COLUMN_INDEX); })); }); } ListGrid(final GridCellTuple parent,
                    final Optional<String> nodeUUID,
                    final HasExpression hasExpression,
                    final Optional<HasName> hasName,
                    final DMNGridPanel gridPanel,
                    final DMNGridLayer gridLayer,
                    final ListGridData 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 ValueAndDataTypePopoverView.Presenter headerEditor,
                    final ReadOnlyProvider readOnlyProvider); @Override ListUIModelMapper makeUiModelMapper(); @Override void initialiseUiColumns(); @Override void initialiseUiRows(); @Override void initialiseUiCells(); @Override 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);  }