Search in sources :

Example 1 with TextFormat

use of org.kie.workbench.common.dmn.api.property.dmn.TextFormat 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 2 with TextFormat

use of org.kie.workbench.common.dmn.api.property.dmn.TextFormat 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 3 with TextFormat

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

the class TextAnnotationConverter method nodeFromDMN.

@Override
public Node<View<TextAnnotation>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.TextAnnotation dmn) {
    @SuppressWarnings("unchecked") Node<View<TextAnnotation>, ?> node = (Node<View<TextAnnotation>, ?>) factoryManager.newElement(dmn.getId(), TextAnnotation.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Text text = new Text(dmn.getText());
    TextFormat textFormat = new TextFormat(dmn.getTextFormat());
    TextAnnotation textAnnotation = new TextAnnotation(id, description, text, textFormat, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(textAnnotation);
    return node;
}
Also used : FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) Node(org.kie.workbench.common.stunner.core.graph.Node) 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) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) TextAnnotation(org.kie.workbench.common.dmn.api.definition.v1_1.TextAnnotation) View(org.kie.workbench.common.stunner.core.graph.content.view.View)

Example 4 with TextFormat

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

the class TextAnnotationConverter method nodeFromDMN.

@Override
public Node<View<TextAnnotation>, ?> nodeFromDMN(final org.kie.dmn.model.api.TextAnnotation dmn, final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer) {
    @SuppressWarnings("unchecked") final Node<View<TextAnnotation>, ?> node = (Node<View<TextAnnotation>, ?>) factoryManager.newElement(dmn.getId(), getDefinitionId(TextAnnotation.class)).asNode();
    final Id id = new Id(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());
    node.getContent().setDefinition(textAnnotation);
    return node;
}
Also used : 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) 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) View(org.kie.workbench.common.stunner.core.graph.content.view.View)

Aggregations

Description (org.kie.workbench.common.dmn.api.property.dmn.Description)4 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)4 TextFormat (org.kie.workbench.common.dmn.api.property.dmn.TextFormat)4 GeneralRectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet)3 StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)3 Node (org.kie.workbench.common.stunner.core.graph.Node)3 View (org.kie.workbench.common.stunner.core.graph.content.view.View)3 TextAnnotation (org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)2 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)2 Test (org.junit.Test)1 TextAnnotation (org.kie.workbench.common.dmn.api.definition.v1_1.TextAnnotation)1 BackgroundSet (org.kie.workbench.common.dmn.api.property.background.BackgroundSet)1 RectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet)1 FontSet (org.kie.workbench.common.dmn.api.property.font.FontSet)1 FontSize (org.kie.workbench.common.dmn.api.property.styling.FontSize)1 JSITTextAnnotation (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation)1