use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class DecisionTableGrid method addInputClause.
void addInputClause(final int index) {
expression.ifPresent(dtable -> {
final InputClause clause = new InputClause();
final LiteralExpression le = new LiteralExpression();
le.setText("input");
clause.setInputExpression(le);
sessionCommandManager.execute((AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(), new AddInputClauseCommand(dtable, clause, model, makeInputClauseColumn(clause), index, uiModelMapper, () -> synchroniseViewWhenExpressionEditorChanged(this)));
});
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class RelationUIModelMapperTest method setup.
@Before
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiRelationColumn1);
this.uiModel.appendColumn(uiRelationColumn2);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiRelationColumn1).getIndex();
doReturn(2).when(uiRelationColumn2).getIndex();
this.relation = new Relation();
this.relation.getColumn().add(new InformationItem());
this.relation.getColumn().add(new InformationItem());
this.relation.getRow().add(new List() {
{
getExpression().add(new LiteralExpression() {
{
setText("le(1,0)");
}
});
getExpression().add(new LiteralExpression() {
{
setText("le(2,0)");
}
});
}
});
this.relation.getRow().add(new List() {
{
getExpression().add(new LiteralExpression() {
{
setText("le(1,1)");
}
});
getExpression().add(new LiteralExpression() {
{
setText("le(2,1)");
}
});
}
});
this.mapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
this.cellValueSupplier = Optional::empty;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class RelationUIModelMapperTest method testToDMNModelLiteralExpressionsNonEmptyValue.
@Test
public void testToDMNModelLiteralExpressionsNonEmptyValue() {
for (int uiRowIndex = 0; uiRowIndex < uiModel.getRowCount(); uiRowIndex++) {
for (int uiColumnIndex = 1; uiColumnIndex < uiModel.getColumnCount(); uiColumnIndex++) {
final String value = "(" + uiColumnIndex + "," + uiRowIndex + ")";
cellValueSupplier = () -> Optional.of(new BaseGridCellValue<>(value));
mapper.toDMNModel(uiRowIndex, uiColumnIndex, cellValueSupplier);
final LiteralExpression le = (LiteralExpression) relation.getRow().get(uiRowIndex).getExpression().get(uiColumnIndex - RelationUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT);
assertEquals(value, le.getText());
}
}
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class BaseExpressionGridCacheTest method getGrid.
@Override
@SuppressWarnings("unchecked")
public BaseExpressionGrid getGrid() {
final HasExpression hasExpression = mock(HasExpression.class);
final Optional<LiteralExpression> expression = Optional.of(mock(LiteralExpression.class));
final Optional<HasName> hasName = Optional.of(mock(HasName.class));
return new BaseExpressionGrid(parentCell, Optional.empty(), hasExpression, expression, hasName, gridPanel, gridLayer, cacheResult, renderer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService, 0) {
@Override
protected BaseUIModelMapper makeUiModelMapper() {
return mapper;
}
@Override
protected void initialiseUiColumns() {
model.appendColumn(uiColumn);
}
@Override
protected void initialiseUiModel() {
model.appendRow(uiRow);
}
@Override
protected boolean isHeaderHidden() {
return false;
}
};
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method getGrid.
@Override
@SuppressWarnings("unchecked")
public BaseExpressionGrid getGrid() {
final HasExpression hasExpression = mock(HasExpression.class);
final Optional<LiteralExpression> expression = Optional.of(mock(LiteralExpression.class));
final Optional<HasName> hasName = Optional.of(mock(HasName.class));
return new BaseExpressionGrid(parentCell, Optional.empty(), hasExpression, expression, hasName, gridPanel, gridLayer, new GridDataCache.CacheResult(new DMNGridData(), false), renderer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService, 0) {
@Override
protected BaseUIModelMapper makeUiModelMapper() {
return mapper;
}
@Override
protected void initialiseUiColumns() {
// Nothing for this test
}
@Override
protected void initialiseUiModel() {
// Nothing for this test
}
@Override
protected boolean isHeaderHidden() {
return false;
}
};
}
Aggregations