@Test public void testAddParameterBinding() { setupGrid(0); addParameterBinding(0); verify(parent).proposeContainingColumnWidth(eq(grid.getWidth() + grid.getPadding() * 2), eq(BaseExpressionGrid.RESIZE_EXISTING)); verify(gridLayer).batch(redrawCommandCaptor.capture()); verify(gridPanel).refreshScrollPosition(); verify(gridPanel).updatePanelSize(); final GridLayerRedrawManager.PrioritizedCommand redrawCommand = redrawCommandCaptor.getValue(); redrawCommand.execute(); verify(gridLayer).draw(); verify(headerEditor).bind(any(HasValueAndTypeRef.class), eq(0), eq(1)); verify(cellEditorControls).show(eq(headerEditor), anyInt(), anyInt()); }
void addParameterBinding(final int index) { getExpression().get().ifPresent(invocation -> { final Binding binding = new Binding(); final InformationItem parameter = new InformationItem(); parameter.setName(new Name()); binding.setParameter(parameter); final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterBindingCommand(invocation, binding, model, new ExpressionEditorGridRow(), index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); if (!CommandUtils.isError(result)) { selectCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX, false, false); startEditingCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX); } }); }
InvocationGrid extends BaseExpressionGrid<Invocation, InvocationGridData, InvocationUIModelMapper> implements HasListSelectorControl { void addParameterBinding(final int index) { getExpression().get().ifPresent(invocation -> { final Binding binding = new Binding(); final InformationItem parameter = new InformationItem(); parameter.setName(new Name()); binding.setParameter(parameter); final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterBindingCommand(invocation, binding, model, new ExpressionEditorGridRow(), index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); if (!CommandUtils.isError(result)) { selectCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX, false, false); startEditingCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX); } }); } }
InvocationGrid extends BaseExpressionGrid<Invocation, InvocationGridData, InvocationUIModelMapper> implements HasListSelectorControl { void addParameterBinding(final int index) { getExpression().get().ifPresent(invocation -> { final Binding binding = new Binding(); final InformationItem parameter = new InformationItem(); parameter.setName(new Name()); binding.setParameter(parameter); final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterBindingCommand(invocation, binding, model, new ExpressionEditorGridRow(), index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); if (!CommandUtils.isError(result)) { selectCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX, false, false); startEditingCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX); } }); } InvocationGrid(final GridCellTuple parent,
                          final Optional<String> nodeUUID,
                          final HasExpression hasExpression,
                          final Optional<HasName> hasName,
                          final DMNGridPanel gridPanel,
                          final DMNGridLayer gridLayer,
                          final InvocationGridData 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); }
InvocationGrid extends BaseExpressionGrid<Invocation, InvocationGridData, InvocationUIModelMapper> implements HasListSelectorControl { void addParameterBinding(final int index) { getExpression().get().ifPresent(invocation -> { final Binding binding = new Binding(); final InformationItem parameter = new InformationItem(); parameter.setName(new Name()); binding.setParameter(parameter); final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterBindingCommand(invocation, binding, model, new ExpressionEditorGridRow(), index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); if (!CommandUtils.isError(result)) { selectCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX, false, false); startEditingCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX); } }); } InvocationGrid(final GridCellTuple parent,
                          final Optional<String> nodeUUID,
                          final HasExpression hasExpression,
                          final Optional<HasName> hasName,
                          final DMNGridPanel gridPanel,
                          final DMNGridLayer gridLayer,
                          final InvocationGridData 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 InvocationUIModelMapper 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 void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex); }
InvocationGrid extends BaseExpressionGrid<Invocation, InvocationGridData, InvocationUIModelMapper> implements HasListSelectorControl { void addParameterBinding(final int index) { getExpression().get().ifPresent(invocation -> { final Binding binding = new Binding(); final InformationItem parameter = new InformationItem(); parameter.setName(new Name()); binding.setParameter(parameter); final CommandResult<CanvasViolation> result = sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddParameterBindingCommand(invocation, binding, model, new ExpressionEditorGridRow(), index, uiModelMapper, () -> resize(BaseExpressionGrid.RESIZE_EXISTING))); if (!CommandUtils.isError(result)) { selectCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX, false, false); startEditingCell(index, InvocationUIModelMapper.BINDING_PARAMETER_COLUMN_INDEX); } }); } InvocationGrid(final GridCellTuple parent,
                          final Optional<String> nodeUUID,
                          final HasExpression hasExpression,
                          final Optional<HasName> hasName,
                          final DMNGridPanel gridPanel,
                          final DMNGridLayer gridLayer,
                          final InvocationGridData 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 InvocationUIModelMapper 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 void doAfterSelectionChange(final int uiRowIndex,
                                       final int uiColumnIndex); @Override void doAfterHeaderSelectionChange(final int uiHeaderRowIndex,
                                             final int uiHeaderColumnIndex);  }