Search in sources :

Example 16 with StylingSet

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

the class InputDataTest 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 StylingSet stylingSet = mock(StylingSet.class);
    final GeneralRectangleDimensionsSet dimensionsSet = mock(GeneralRectangleDimensionsSet.class);
    final InformationItemPrimary variable = new InformationItemPrimary();
    final InputData expectedParent = new InputData(id, description, name, variable, 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) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) 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 17 with StylingSet

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

the class BusinessKnowledgeModelTest 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 FunctionDefinition functionDefinition = mock(FunctionDefinition.class);
    final StylingSet stylingSet = mock(StylingSet.class);
    final GeneralRectangleDimensionsSet dimensionsSet = mock(GeneralRectangleDimensionsSet.class);
    final InformationItemPrimary variable = new InformationItemPrimary();
    final BusinessKnowledgeModel expectedParent = new BusinessKnowledgeModel(id, description, name, variable, functionDefinition, 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) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) 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 18 with StylingSet

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

the class FontStylingSetPropertyConverterTest method testWbFromDMN.

@Test
public void testWbFromDMN() {
    final JSIDMNStyle jsiDmnStyle = mock(JSIDMNStyle.class);
    final JSIColor fontColor = mock(JSIColor.class);
    when(fontColor.getRed()).thenReturn(10);
    when(fontColor.getGreen()).thenReturn(20);
    when(fontColor.getBlue()).thenReturn(30);
    final String fontFamily = "Arial";
    final double fontSize = 11.0;
    when(jsiDmnStyle.getFontColor()).thenReturn(fontColor);
    when(jsiDmnStyle.getFontFamily()).thenReturn(fontFamily);
    when(jsiDmnStyle.getFontSize()).thenReturn(fontSize);
    final StylingSet convertedResult = FontStylingSetPropertyConverter.wbFromDMN(jsiDmnStyle);
    assertThat(convertedResult.getFontColour().getValue()).isEqualTo("#0a141e");
    assertThat(convertedResult.getFontFamily().getValue()).isEqualTo(fontFamily);
    assertThat(convertedResult.getFontSize().getValue()).isEqualTo(fontSize);
}
Also used : JSIColor(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dc.JSIColor) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) JSIDMNStyle(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNStyle) Test(org.junit.Test)

Example 19 with StylingSet

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

the class KnowledgeSourceConverter method nodeFromDMN.

@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
    final JSITKnowledgeSource dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
    @SuppressWarnings("unchecked") final Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(KnowledgeSource.class)).asNode();
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final Name name = new Name(dmn.getName());
    final KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
    final LocationURI locationURI = new LocationURI(dmn.getLocationURI());
    final KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new StylingSet(), new GeneralRectangleDimensionsSet());
    ks.setDiagramId(nodeEntry.getDiagramId());
    node.getContent().setDefinition(ks);
    DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, ks);
    return node;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) JSITKnowledgeSource(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) 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) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) JSITKnowledgeSource(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) 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 20 with StylingSet

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

the class InputDataConverter method nodeFromDMN.

@Override
public Node<View<InputData>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
    final JSITInputData dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
    @SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(InputData.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 InputData inputData = new InputData(id, description, name, informationItem, new StylingSet(), new GeneralRectangleDimensionsSet());
    inputData.setDiagramId(nodeEntry.getDiagramId());
    node.getContent().setDefinition(inputData);
    if (Objects.nonNull(informationItem)) {
        informationItem.setParent(inputData);
    }
    DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData);
    return node;
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) 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) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)26 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)22 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)22 GeneralRectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet)18 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)18 Node (org.kie.workbench.common.stunner.core.graph.Node)14 View (org.kie.workbench.common.stunner.core.graph.content.view.View)14 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)13 Test (org.junit.Test)11 InformationItemPrimary (org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary)8 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)7 FontSize (org.kie.workbench.common.dmn.api.property.styling.FontSize)6 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)4 DecisionServiceDividerLineY (org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY)4 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)3 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)3 TextAnnotation (org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)3 AllowedAnswers (org.kie.workbench.common.dmn.api.property.dmn.AllowedAnswers)3 Question (org.kie.workbench.common.dmn.api.property.dmn.Question)3 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)3