@Test public void testFromDMNModelLiteralExpression() { setup(new LiteralExpression(), false); list.getExpression().add(HasExpression.wrap(list, new LiteralExpression())); mapper.fromDMNModel(0, EXPRESSION_COLUMN_INDEX); assertFromDMNModelLiteralExpression(false); }
@Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(list -> { final ListUIModelMapperHelper.ListSection section = ListUIModelMapperHelper.getSection(columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case EXPRESSION: final HasExpression hasExpression = list.getExpression().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(hasExpression.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(), hasExpression, Optional.empty(), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); }
ListUIModelMapper extends BaseUIModelMapper<List> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(list -> { final ListUIModelMapperHelper.ListSection section = ListUIModelMapperHelper.getSection(columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case EXPRESSION: final HasExpression hasExpression = list.getExpression().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(hasExpression.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(), hasExpression, Optional.empty(), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } }
ListUIModelMapper extends BaseUIModelMapper<List> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(list -> { final ListUIModelMapperHelper.ListSection section = ListUIModelMapperHelper.getSection(columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case EXPRESSION: final HasExpression hasExpression = list.getExpression().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(hasExpression.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(), hasExpression, Optional.empty(), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } ListUIModelMapper(final GridWidget gridWidget,
                             final Supplier<GridData> uiModel,
                             final Supplier<Optional<List>> dmnModel,
                             final Supplier<Boolean> isOnlyVisualChangeAllowedSupplier,
                             final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                             final ListSelectorView.Presenter listSelector,
                             final int nesting); }
ListUIModelMapper extends BaseUIModelMapper<List> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(list -> { final ListUIModelMapperHelper.ListSection section = ListUIModelMapperHelper.getSection(columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case EXPRESSION: final HasExpression hasExpression = list.getExpression().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(hasExpression.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(), hasExpression, Optional.empty(), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } ListUIModelMapper(final GridWidget gridWidget,
                             final Supplier<GridData> uiModel,
                             final Supplier<Optional<List>> 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 void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell); }
ListUIModelMapper extends BaseUIModelMapper<List> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(list -> { final ListUIModelMapperHelper.ListSection section = ListUIModelMapperHelper.getSection(columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case EXPRESSION: final HasExpression hasExpression = list.getExpression().get(rowIndex); final Optional<Expression> expression = Optional.ofNullable(hasExpression.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(), hasExpression, Optional.empty(), isOnlyVisualChangeAllowed, nesting + 1); uiModel.get().setCell(rowIndex, columnIndex, () -> new ContextGridCell<>(new ExpressionCellValue(editor), listSelector)); }); } }); } ListUIModelMapper(final GridWidget gridWidget,
                             final Supplier<GridData> uiModel,
                             final Supplier<Optional<List>> 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 void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell);  }