Search in sources :

Example 6 with GeneralRectangleDimensionsSet

use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.

the class TextAnnotationTest method testDifferentStylingSet.

@Test
public void testDifferentStylingSet() {
    final TextAnnotation modelOne = new TextAnnotation(new Id("123"), new Description(), new Text(), new TextFormat(), new StylingSet(), new GeneralRectangleDimensionsSet());
    final TextAnnotation modelTwo = new TextAnnotation(new Id("123"), new Description(), new Text(), new TextFormat(), new StylingSet(), new GeneralRectangleDimensionsSet());
    assertEquals(modelOne, modelTwo);
    modelOne.getStylingSet().setFontSize(new FontSize(10.0));
    modelTwo.getStylingSet().setFontSize(new FontSize(11.0));
    assertNotEquals(modelOne, modelTwo);
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) FontSize(org.kie.workbench.common.dmn.api.property.styling.FontSize) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) GeneralRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet) TextFormat(org.kie.workbench.common.dmn.api.property.dmn.TextFormat) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Test(org.junit.Test)

Example 7 with GeneralRectangleDimensionsSet

use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.

the class BusinessKnowledgeModelConverter method nodeFromDMN.

@Override
public Node<View<BusinessKnowledgeModel>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
    final JSITBusinessKnowledgeModel dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
    @SuppressWarnings("unchecked") final Node<View<BusinessKnowledgeModel>, ?> node = (Node<View<BusinessKnowledgeModel>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(BusinessKnowledgeModel.class)).asNode();
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final Name name = new Name(dmn.getName());
    final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn);
    final JSITFunctionDefinition dmnFunctionDefinition = dmn.getEncapsulatedLogic();
    final FunctionDefinition functionDefinition = FunctionDefinitionPropertyConverter.wbFromDMN(dmnFunctionDefinition, nodeEntry.getComponentWidthsConsumer());
    final BusinessKnowledgeModel bkm = new BusinessKnowledgeModel(id, description, name, informationItem, functionDefinition, new StylingSet(), new GeneralRectangleDimensionsSet());
    bkm.setDiagramId(nodeEntry.getDiagramId());
    node.getContent().setDefinition(bkm);
    if (Objects.nonNull(informationItem)) {
        informationItem.setParent(bkm);
    }
    if (Objects.nonNull(functionDefinition)) {
        functionDefinition.setParent(bkm);
    }
    if (Objects.nonNull(dmnFunctionDefinition)) {
        nodeEntry.getComponentWidthsConsumer().accept(dmnFunctionDefinition.getId(), functionDefinition);
    }
    DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, bkm);
    return node;
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Node(org.kie.workbench.common.stunner.core.graph.Node) GeneralRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) IdUtils.getRawId(org.kie.workbench.common.dmn.client.marshaller.common.IdUtils.getRawId) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)

Example 8 with GeneralRectangleDimensionsSet

use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.

the class TextAnnotationConverter method nodeFromDMN.

@Override
public Node<View<TextAnnotation>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
    final JSITTextAnnotation dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
    @SuppressWarnings("unchecked") final Node<View<TextAnnotation>, ?> node = (Node<View<TextAnnotation>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(TextAnnotation.class)).asNode();
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final Text text = new Text(dmn.getText());
    final TextFormat textFormat = new TextFormat(dmn.getTextFormat());
    final TextAnnotation textAnnotation = new TextAnnotation(id, description, text, textFormat, new StylingSet(), new GeneralRectangleDimensionsSet());
    textAnnotation.setDiagramId(nodeEntry.getDiagramId());
    node.getContent().setDefinition(textAnnotation);
    return node;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation) Node(org.kie.workbench.common.stunner.core.graph.Node) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) GeneralRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet) TextFormat(org.kie.workbench.common.dmn.api.property.dmn.TextFormat) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation) View(org.kie.workbench.common.stunner.core.graph.content.view.View)

Example 9 with GeneralRectangleDimensionsSet

use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.

the class DecisionTest method testConstructor.

@Test
public void testConstructor() {
    final Id id = mock(Id.class);
    final Description description = mock(Description.class);
    final Name name = mock(Name.class);
    final Question question = mock(Question.class);
    final AllowedAnswers allowedAnswers = mock(AllowedAnswers.class);
    final Expression expression = mock(Expression.class);
    final StylingSet stylingSet = mock(StylingSet.class);
    final GeneralRectangleDimensionsSet dimensionsSet = mock(GeneralRectangleDimensionsSet.class);
    final InformationItemPrimary variable = new InformationItemPrimary();
    final Decision expectedParent = new Decision(id, description, name, question, allowedAnswers, variable, expression, stylingSet, dimensionsSet);
    final DMNModelInstrumentedBase actualParent = variable.getParent();
    assertEquals(expectedParent, actualParent);
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) GeneralRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet) Question(org.kie.workbench.common.dmn.api.property.dmn.Question) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) AllowedAnswers(org.kie.workbench.common.dmn.api.property.dmn.AllowedAnswers) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 10 with GeneralRectangleDimensionsSet

use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.

the class DecisionTest method testDifferentStylingSet.

@Test
public void testDifferentStylingSet() {
    final Decision modelOne = new Decision(new Id("123"), new Description(), new Name(), new Question(), new AllowedAnswers(), new InformationItemPrimary(new Id("346"), new Name(), new QName()), new FunctionDefinition(new Id("789"), new Description(), new QName(), null), new StylingSet(), new GeneralRectangleDimensionsSet());
    final Decision modelTwo = new Decision(new Id("123"), new Description(), new Name(), new Question(), new AllowedAnswers(), new InformationItemPrimary(new Id("346"), new Name(), new QName()), new FunctionDefinition(new Id("789"), new Description(), new QName(), null), new StylingSet(), new GeneralRectangleDimensionsSet());
    assertEquals(modelOne, modelTwo);
    modelOne.getStylingSet().setFontSize(new FontSize(10.0));
    modelTwo.getStylingSet().setFontSize(new FontSize(11.0));
    assertNotEquals(modelOne, modelTwo);
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) FontSize(org.kie.workbench.common.dmn.api.property.styling.FontSize) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) GeneralRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet) Question(org.kie.workbench.common.dmn.api.property.dmn.Question) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) AllowedAnswers(org.kie.workbench.common.dmn.api.property.dmn.AllowedAnswers) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Aggregations

GeneralRectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet)18 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)18 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)18 StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)18 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)15 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)10 Node (org.kie.workbench.common.stunner.core.graph.Node)10 View (org.kie.workbench.common.stunner.core.graph.content.view.View)10 Test (org.junit.Test)8 InformationItemPrimary (org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary)6 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)6 FontSize (org.kie.workbench.common.dmn.api.property.styling.FontSize)5 AllowedAnswers (org.kie.workbench.common.dmn.api.property.dmn.AllowedAnswers)4 Question (org.kie.workbench.common.dmn.api.property.dmn.Question)4 KnowledgeSourceType (org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType)3 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)3 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)3 TextFormat (org.kie.workbench.common.dmn.api.property.dmn.TextFormat)3 IdUtils.getRawId (org.kie.workbench.common.dmn.client.marshaller.common.IdUtils.getRawId)3 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)2