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