@Test public void testFromDMNModelRowNumber() { setup(false); mapper.fromDMNModel(0, 0); assertEquals(1, uiModel.getCell(0, 0).getValue().getValue()); assertEquals(RowSelectionStrategy.INSTANCE, uiModel.getCell(0, 0).getSelectionStrategy()); }
@Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(invocation -> { switch (columnIndex) { case ROW_NUMBER_COLUMN_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case BINDING_PARAMETER_COLUMN_INDEX: final InformationItem variable = invocation.getBinding().get(rowIndex).getParameter(); uiModel.get().setCell(rowIndex, columnIndex, () -> new InformationItemCell(() -> InformationItemCell.HasNameAndDataTypeCell.wrap(variable), listSelector)); break; case BINDING_EXPRESSION_COLUMN_INDEX: final Binding binding = invocation.getBinding().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(binding.getExpression()); final boolean isOnlyVisualChangeAllowed = this.isOnlyVisualChangeAllowedSupplier.get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ed.getEditor(new GridCellTuple(rowIndex, columnIndex, gridWidget), Optional.empty(), binding, Optional.ofNullable(binding.getParameter()), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); }
InvocationUIModelMapper extends BaseUIModelMapper<Invocation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(invocation -> { switch (columnIndex) { case ROW_NUMBER_COLUMN_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case BINDING_PARAMETER_COLUMN_INDEX: final InformationItem variable = invocation.getBinding().get(rowIndex).getParameter(); uiModel.get().setCell(rowIndex, columnIndex, () -> new InformationItemCell(() -> InformationItemCell.HasNameAndDataTypeCell.wrap(variable), listSelector)); break; case BINDING_EXPRESSION_COLUMN_INDEX: final Binding binding = invocation.getBinding().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(binding.getExpression()); final boolean isOnlyVisualChangeAllowed = this.isOnlyVisualChangeAllowedSupplier.get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ed.getEditor(new GridCellTuple(rowIndex, columnIndex, gridWidget), Optional.empty(), binding, Optional.ofNullable(binding.getParameter()), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } }
InvocationUIModelMapper extends BaseUIModelMapper<Invocation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(invocation -> { switch (columnIndex) { case ROW_NUMBER_COLUMN_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case BINDING_PARAMETER_COLUMN_INDEX: final InformationItem variable = invocation.getBinding().get(rowIndex).getParameter(); uiModel.get().setCell(rowIndex, columnIndex, () -> new InformationItemCell(() -> InformationItemCell.HasNameAndDataTypeCell.wrap(variable), listSelector)); break; case BINDING_EXPRESSION_COLUMN_INDEX: final Binding binding = invocation.getBinding().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(binding.getExpression()); final boolean isOnlyVisualChangeAllowed = this.isOnlyVisualChangeAllowedSupplier.get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ed.getEditor(new GridCellTuple(rowIndex, columnIndex, gridWidget), Optional.empty(), binding, Optional.ofNullable(binding.getParameter()), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } InvocationUIModelMapper(final GridWidget gridWidget,
                                   final Supplier<GridData> uiModel,
                                   final Supplier<Optional<Invocation>> dmnModel,
                                   final Supplier<Boolean> isOnlyVisualChangeAllowedSupplier,
                                   final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                   final ListSelectorView.Presenter listSelector,
                                   final int nesting); }
InvocationUIModelMapper extends BaseUIModelMapper<Invocation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(invocation -> { switch (columnIndex) { case ROW_NUMBER_COLUMN_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case BINDING_PARAMETER_COLUMN_INDEX: final InformationItem variable = invocation.getBinding().get(rowIndex).getParameter(); uiModel.get().setCell(rowIndex, columnIndex, () -> new InformationItemCell(() -> InformationItemCell.HasNameAndDataTypeCell.wrap(variable), listSelector)); break; case BINDING_EXPRESSION_COLUMN_INDEX: final Binding binding = invocation.getBinding().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(binding.getExpression()); final boolean isOnlyVisualChangeAllowed = this.isOnlyVisualChangeAllowedSupplier.get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ed.getEditor(new GridCellTuple(rowIndex, columnIndex, gridWidget), Optional.empty(), binding, Optional.ofNullable(binding.getParameter()), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } InvocationUIModelMapper(final GridWidget gridWidget,
                                   final Supplier<GridData> uiModel,
                                   final Supplier<Optional<Invocation>> dmnModel,
                                   final Supplier<Boolean> isOnlyVisualChangeAllowedSupplier,
                                   final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                   final ListSelectorView.Presenter listSelector,
                                   final int nesting); @Override void fromDMNModel(final int rowIndex,
                             final int columnIndex); @Override @SuppressWarnings("unchecked") void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell); }
InvocationUIModelMapper extends BaseUIModelMapper<Invocation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(invocation -> { switch (columnIndex) { case ROW_NUMBER_COLUMN_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case BINDING_PARAMETER_COLUMN_INDEX: final InformationItem variable = invocation.getBinding().get(rowIndex).getParameter(); uiModel.get().setCell(rowIndex, columnIndex, () -> new InformationItemCell(() -> InformationItemCell.HasNameAndDataTypeCell.wrap(variable), listSelector)); break; case BINDING_EXPRESSION_COLUMN_INDEX: final Binding binding = invocation.getBinding().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(binding.getExpression()); final boolean isOnlyVisualChangeAllowed = this.isOnlyVisualChangeAllowedSupplier.get(); final Optional<ExpressionEditorDefinition<Expression>> expressionEditorDefinition = expressionEditorDefinitionsSupplier.get().getExpressionEditorDefinition(expression); expressionEditorDefinition.ifPresent(ed -> { final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ed.getEditor(new GridCellTuple(rowIndex, columnIndex, gridWidget), Optional.empty(), binding, Optional.ofNullable(binding.getParameter()), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new InvocationGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } InvocationUIModelMapper(final GridWidget gridWidget,
                                   final Supplier<GridData> uiModel,
                                   final Supplier<Optional<Invocation>> dmnModel,
                                   final Supplier<Boolean> isOnlyVisualChangeAllowedSupplier,
                                   final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                                   final ListSelectorView.Presenter listSelector,
                                   final int nesting); @Override void fromDMNModel(final int rowIndex,
                             final int columnIndex); @Override @SuppressWarnings("unchecked") void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell); static final int ROW_NUMBER_COLUMN_INDEX; static final int BINDING_PARAMETER_COLUMN_INDEX; static final int BINDING_EXPRESSION_COLUMN_INDEX; }