@Test public void testFromDMNModelRowNumber() { mapper.fromDMNModel(0, 0); mapper.fromDMNModel(1, 0); assertEquals(1, uiModel.getCell(0, 0).getValue().getValue()); assertEquals(RowSelectionStrategy.INSTANCE, uiModel.getCell(0, 0).getSelectionStrategy()); assertEquals(2, uiModel.getCell(1, 0).getValue().getValue()); assertEquals(RowSelectionStrategy.INSTANCE, uiModel.getCell(1, 0).getSelectionStrategy()); }
@Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(relation -> { final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector, lineHeight)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case INFORMATION_ITEM: final org.kie.workbench.common.dmn.api.definition.model.List row = relation.getRow().get(rowIndex); final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, columnIndex); final HasExpression hasExpression = row.getExpression().get(iiIndex); final Expression e = hasExpression.getExpression(); final Optional<Expression> expression = Optional.ofNullable(e); expression.ifPresent(ex -> { final LiteralExpression le = (LiteralExpression) ex; uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(le.getText().getValue()), listSelector, lineHeight)); }); } }); }
RelationUIModelMapper extends BaseUIModelMapper<Relation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(relation -> { final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector, lineHeight)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case INFORMATION_ITEM: final org.kie.workbench.common.dmn.api.definition.model.List row = relation.getRow().get(rowIndex); final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, columnIndex); final HasExpression hasExpression = row.getExpression().get(iiIndex); final Expression e = hasExpression.getExpression(); final Optional<Expression> expression = Optional.ofNullable(e); expression.ifPresent(ex -> { final LiteralExpression le = (LiteralExpression) ex; uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(le.getText().getValue()), listSelector, lineHeight)); }); } }); } }
RelationUIModelMapper extends BaseUIModelMapper<Relation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(relation -> { final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector, lineHeight)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case INFORMATION_ITEM: final org.kie.workbench.common.dmn.api.definition.model.List row = relation.getRow().get(rowIndex); final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, columnIndex); final HasExpression hasExpression = row.getExpression().get(iiIndex); final Expression e = hasExpression.getExpression(); final Optional<Expression> expression = Optional.ofNullable(e); expression.ifPresent(ex -> { final LiteralExpression le = (LiteralExpression) ex; uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(le.getText().getValue()), listSelector, lineHeight)); }); } }); } RelationUIModelMapper(final Supplier<GridData> uiModel,
                                 final Supplier<Optional<Relation>> dmnModel,
                                 final ListSelectorView.Presenter listSelector,
                                 final double lineHeight); }
RelationUIModelMapper extends BaseUIModelMapper<Relation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(relation -> { final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector, lineHeight)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case INFORMATION_ITEM: final org.kie.workbench.common.dmn.api.definition.model.List row = relation.getRow().get(rowIndex); final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, columnIndex); final HasExpression hasExpression = row.getExpression().get(iiIndex); final Expression e = hasExpression.getExpression(); final Optional<Expression> expression = Optional.ofNullable(e); expression.ifPresent(ex -> { final LiteralExpression le = (LiteralExpression) ex; uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(le.getText().getValue()), listSelector, lineHeight)); }); } }); } RelationUIModelMapper(final Supplier<GridData> uiModel,
                                 final Supplier<Optional<Relation>> dmnModel,
                                 final ListSelectorView.Presenter listSelector,
                                 final double lineHeight); @Override void fromDMNModel(final int rowIndex,
                             final int columnIndex); @Override void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell); }
RelationUIModelMapper extends BaseUIModelMapper<Relation> { @Override public void fromDMNModel(final int rowIndex, final int columnIndex) { dmnModel.get().ifPresent(relation -> { final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, columnIndex); switch (section) { case ROW_INDEX: uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(rowIndex + 1), listSelector, lineHeight)); uiModel.get().getCell(rowIndex, columnIndex).setSelectionStrategy(RowSelectionStrategy.INSTANCE); break; case INFORMATION_ITEM: final org.kie.workbench.common.dmn.api.definition.model.List row = relation.getRow().get(rowIndex); final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, columnIndex); final HasExpression hasExpression = row.getExpression().get(iiIndex); final Expression e = hasExpression.getExpression(); final Optional<Expression> expression = Optional.ofNullable(e); expression.ifPresent(ex -> { final LiteralExpression le = (LiteralExpression) ex; uiModel.get().setCell(rowIndex, columnIndex, () -> new RelationGridCell<>(new BaseGridCellValue<>(le.getText().getValue()), listSelector, lineHeight)); }); } }); } RelationUIModelMapper(final Supplier<GridData> uiModel,
                                 final Supplier<Optional<Relation>> dmnModel,
                                 final ListSelectorView.Presenter listSelector,
                                 final double lineHeight); @Override void fromDMNModel(final int rowIndex,
                             final int columnIndex); @Override void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell);  }