Search in sources :

Example 6 with Relation

use of org.kie.workbench.common.dmn.api.definition.model.Relation in project kie-wb-common by kiegroup.

the class ExpressionPropertyConverterTest method testDMNFromWB_RelationConversion.

@Test
public void testDMNFromWB_RelationConversion() {
    final Relation wb = new Relation();
    final List<Double> wbComponentWidths = wb.getComponentWidths();
    wbComponentWidths.set(0, 200.0);
    wb.getId().setValue(EXPRESSION_UUID);
    assertDMNFromWBConversion(wb, TRelation.class, 200.0);
}
Also used : TRelation(org.kie.dmn.model.v1_2.TRelation) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) Test(org.junit.Test)

Example 7 with Relation

use of org.kie.workbench.common.dmn.api.definition.model.Relation in project kie-wb-common by kiegroup.

the class RelationGrid method doAfterSelectionChange.

@Override
public void doAfterSelectionChange(final int uiRowIndex, final int uiColumnIndex) {
    if (hasAnyHeaderCellSelected() || hasMultipleCellsSelected()) {
        super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
        return;
    }
    if (getExpression().get().isPresent()) {
        final Relation relation = getExpression().get().get();
        final RelationUIModelMapperHelper.RelationSection section = RelationUIModelMapperHelper.getSection(relation, uiColumnIndex);
        if (section == RelationUIModelMapperHelper.RelationSection.INFORMATION_ITEM) {
            final int iiIndex = RelationUIModelMapperHelper.getInformationItemIndex(relation, uiColumnIndex);
            final HasExpression hasExpression = relation.getRow().get(uiRowIndex).getExpression().get(iiIndex);
            final Expression expression = hasExpression.getExpression();
            if (expression instanceof DomainObject) {
                final DomainObject domainObject = (DomainObject) expression;
                fireDomainObjectSelectionEvent(domainObject);
                return;
            }
        }
    }
    super.doAfterSelectionChange(uiRowIndex, uiColumnIndex);
}
Also used : HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) DomainObject(org.kie.workbench.common.stunner.core.domainobject.DomainObject)

Example 8 with Relation

use of org.kie.workbench.common.dmn.api.definition.model.Relation in project kie-wb-common by kiegroup.

the class AddRelationColumnCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.informationItem = new InformationItem();
    this.uiModel = new BaseGridData();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
    makeCommand(1);
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn).getIndex();
}
Also used : RelationUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 9 with Relation

use of org.kie.workbench.common.dmn.api.definition.model.Relation in project kie-wb-common by kiegroup.

the class AddRelationRowCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.row = new List();
    this.uiModelRow = new BaseGridRow();
    this.uiModel = new BaseGridData();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
    makeCommand(0);
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn).getIndex();
}
Also used : RelationUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper) Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) List(org.kie.workbench.common.dmn.api.definition.model.List) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Example 10 with Relation

use of org.kie.workbench.common.dmn.api.definition.model.Relation in project kie-wb-common by kiegroup.

the class MoveColumnsCommandTest method setup.

@Before
public void setup() {
    this.relation = new Relation();
    this.uiModel = new DMNGridData();
    doReturn(ruleManager).when(handler).getRuleManager();
    doReturn(0).when(uiRowNumberColumn).getIndex();
    doReturn(1).when(uiModelColumn1).getIndex();
    doReturn(2).when(uiModelColumn2).getIndex();
    addRelationColumn(II1);
    addRelationColumn(II2);
    addRelationRow(II1);
    addRelationRow(II2);
    addUiModelColumn(uiRowNumberColumn);
    addUiModelColumn(uiModelColumn1);
    addUiModelColumn(uiModelColumn2);
    addUiModelRow(0);
    addUiModelRow(1);
}
Also used : Relation(org.kie.workbench.common.dmn.api.definition.model.Relation) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) Before(org.junit.Before)

Aggregations

Relation (org.kie.workbench.common.dmn.api.definition.model.Relation)21 List (org.kie.workbench.common.dmn.api.definition.model.List)9 Before (org.junit.Before)7 InformationItem (org.kie.workbench.common.dmn.api.definition.model.InformationItem)7 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 HasComponentWidths (org.kie.workbench.common.dmn.api.definition.HasComponentWidths)4 Context (org.kie.workbench.common.dmn.api.definition.model.Context)4 DecisionTable (org.kie.workbench.common.dmn.api.definition.model.DecisionTable)4 FunctionDefinition (org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition)4 Invocation (org.kie.workbench.common.dmn.api.definition.model.Invocation)4 IsLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression)4 RelationUIModelMapper (org.kie.workbench.common.dmn.client.editors.expressions.types.relation.RelationUIModelMapper)4 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)4 TRelation (org.kie.dmn.model.v1_2.TRelation)3 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)3 JSITList (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITList)3 JSITRelation (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRelation)3 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)3