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);
}
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);
}
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);
}
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;
}
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;
}
Aggregations