Search in sources :

Example 1 with TextAnnotation

use of org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation in project kie-wb-common by kiegroup.

the class ArtifactsConverter method toTextAnnotation.

private PropertyWriter toTextAnnotation(Node<View<TextAnnotation>, ?> node) {
    org.eclipse.bpmn2.TextAnnotation element = bpmn2.createTextAnnotation();
    element.setId(node.getUUID());
    TextAnnotationPropertyWriter writer = propertyWriterFactory.of(element);
    TextAnnotation definition = node.getContent().getDefinition();
    BPMNGeneralSet general = definition.getGeneral();
    writer.setName(general.getName().getValue());
    writer.setDocumentation(general.getDocumentation().getValue());
    writer.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
    writer.setAbsoluteBounds(node);
    return writer;
}
Also used : Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) TextAnnotation(org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation) TextAnnotationPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.TextAnnotationPropertyWriter)

Example 2 with TextAnnotation

use of org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation in project kie-wb-common by kiegroup.

the class ArtifactsConverter method toTextAnnotation.

private BpmnNode toTextAnnotation(org.eclipse.bpmn2.TextAnnotation element) {
    TextAnnotationPropertyReader p = propertyReaderFactory.of(element);
    Node<View<TextAnnotation>, Edge> node = typedFactoryManager.newNode(element.getId(), TextAnnotation.class);
    TextAnnotation definition = node.getContent().getDefinition();
    definition.setGeneral(new BPMNGeneralSet(new Name(p.getName()), new Documentation(p.getDocumentation())));
    node.getContent().setBounds(p.getBounds());
    definition.setDimensionsSet(p.getRectangleDimensionsSet());
    definition.setFontSet(p.getFontSet());
    definition.setBackgroundSet(p.getBackgroundSet());
    definition.setAdvancedData(new AdvancedData(p.getMetaDataAttributes()));
    return BpmnNode.of(node, p);
}
Also used : AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) TextAnnotationPropertyReader(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.TextAnnotationPropertyReader) Documentation(org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) TextAnnotation(org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Name(org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)

Example 3 with TextAnnotation

use of org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation in project kie-wb-common by kiegroup.

the class ArtifactsConverterTest method toTextAnnotationElement.

@Test
public void toTextAnnotationElement() {
    TextAnnotation textAnnotation = new TextAnnotation();
    textAnnotation.getGeneral().getDocumentation().setValue(DOC);
    textAnnotation.getGeneral().getName().setValue(NAME);
    textAnnotationNode = new NodeImpl<>(UUID.uuid());
    textAnnotationNode.setContent(textAnnotationView);
    when(textAnnotationView.getDefinition()).thenReturn(textAnnotation);
    when(propertyWriterFactory.of(any(org.eclipse.bpmn2.TextAnnotation.class))).thenReturn(textAnnotationWriter);
    artifactsConverter = new ArtifactsConverter(propertyWriterFactory);
    PropertyWriter propertyWriter = artifactsConverter.toElement(((NodeImpl) textAnnotationNode));
    verify(textAnnotationWriter).setName(NAME);
    verify(textAnnotationWriter).setDocumentation(DOC);
    verify(textAnnotationWriter).setAbsoluteBounds(textAnnotationNode);
    assertEquals(textAnnotationWriter, propertyWriter);
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) TextAnnotation(org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation) TextAnnotationPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.TextAnnotationPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter) DataObjectPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DataObjectPropertyWriter) Test(org.junit.Test)

Aggregations

TextAnnotation (org.kie.workbench.common.stunner.bpmn.definition.TextAnnotation)3 TextAnnotationPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.TextAnnotationPropertyWriter)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 Test (org.junit.Test)1 Factories.bpmn2 (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2)1 DataObjectPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.DataObjectPropertyWriter)1 PropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter)1 TextAnnotationPropertyReader (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.TextAnnotationPropertyReader)1 Documentation (org.kie.workbench.common.stunner.bpmn.definition.property.general.Documentation)1 Name (org.kie.workbench.common.stunner.bpmn.definition.property.general.Name)1 AdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)1