Search in sources :

Example 1 with FontSet

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

the class DecisionConverter method nodeFromDMN.

@Override
public Node<View<Decision>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.Decision dmn) {
    @SuppressWarnings("unchecked") Node<View<Decision>, ?> node = (Node<View<Decision>, ?>) factoryManager.newElement(dmn.getId(), Decision.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Name name = new Name(dmn.getName());
    InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
    Expression expression = ExpressionPropertyConverter.wbFromDMN(dmn.getExpression());
    Decision decision = new Decision(id, description, name, new Question(), new AllowedAnswers(), informationItem, expression, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(decision);
    return node;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Node(org.kie.workbench.common.stunner.core.graph.Node) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) AllowedAnswers(org.kie.workbench.common.dmn.api.property.dmn.AllowedAnswers) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Decision(org.kie.workbench.common.dmn.api.definition.v1_1.Decision) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) Expression(org.kie.workbench.common.dmn.api.definition.v1_1.Expression) Question(org.kie.workbench.common.dmn.api.property.dmn.Question) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 2 with FontSet

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

the class InputDataConverter method nodeFromDMN.

@Override
public Node<View<InputData>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.InputData dmn) {
    @SuppressWarnings("unchecked") Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(dmn.getId(), InputData.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Name name = new Name(dmn.getName());
    InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
    InputData inputData = new InputData(id, description, name, informationItem, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(inputData);
    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) InformationItem(org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) InputData(org.kie.workbench.common.dmn.api.definition.v1_1.InputData) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 3 with FontSet

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

the class KnowledgeSourceConverter method nodeFromDMN.

@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.KnowledgeSource dmn) {
    @SuppressWarnings("unchecked") Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(dmn.getId(), KnowledgeSource.class).asNode();
    Id id = new Id(dmn.getId());
    Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    Name name = new Name(dmn.getName());
    KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
    LocationURI locationURI = new LocationURI(dmn.getLocationURI());
    KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
    node.getContent().setDefinition(ks);
    return node;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) 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) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.v1_1.KnowledgeSource) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 4 with FontSet

use of org.kie.workbench.common.dmn.api.property.font.FontSet 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 5 with FontSet

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

the class DMNMarshaller method internalAugment.

private void internalAugment(Stream<DMNShape> drgShapeStream, Id id, Bound ul, RectangleDimensionsSet dimensionsSet, Bound lr, BackgroundSet bgset, Consumer<FontSet> fontSetSetter) {
    Optional<DMNShape> drgShapeOpt = drgShapeStream.filter(shape -> shape.getDmnElementRef().equals(id.getValue())).findFirst();
    if (!drgShapeOpt.isPresent()) {
        return;
    }
    DMNShape drgShape = drgShapeOpt.get();
    ((BoundImpl) ul).setX(drgShape.getBounds().getX());
    ((BoundImpl) ul).setY(drgShape.getBounds().getY());
    dimensionsSet.setWidth(new Width(drgShape.getBounds().getWidth()));
    dimensionsSet.setHeight(new Height(drgShape.getBounds().getHeight()));
    ((BoundImpl) lr).setX(drgShape.getBounds().getX() + drgShape.getBounds().getWidth());
    ((BoundImpl) lr).setY(drgShape.getBounds().getY() + drgShape.getBounds().getHeight());
    if (null != drgShape.getBgColor()) {
        bgset.setBgColour(new BgColour(ColorUtils.wbFromDMN(drgShape.getBgColor())));
    }
    if (null != drgShape.getBorderColor()) {
        bgset.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(drgShape.getBorderColor())));
    }
    if (null != drgShape.getBorderSize()) {
        bgset.setBorderSize(new BorderSize(drgShape.getBorderSize().getValue()));
    }
    if (null != drgShape.getFontStyle()) {
        fontSetSetter.accept(FontSetPropertyConverter.wbFromDMN(drgShape.getFontStyle()));
    }
}
Also used : DMNShape(org.kie.workbench.common.dmn.backend.definition.v1_1.dd.DMNShape) Arrays(java.util.Arrays) DecisionConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.DecisionConverter) Edge(org.kie.workbench.common.stunner.core.graph.Edge) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.v1_1.KnowledgeSource) UUID(org.kie.workbench.common.stunner.core.util.UUID) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) Definitions(org.kie.workbench.common.dmn.api.definition.v1_1.Definitions) TextAnnotationConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.TextAnnotationConverter) Bounds(org.kie.workbench.common.dmn.backend.definition.v1_1.dd.org.omg.spec.CMMN_20151109_DC.Bounds) Map(java.util.Map) DMNDiagram(org.kie.workbench.common.dmn.api.definition.v1_1.DMNDiagram) ServerMarshalling(org.jboss.errai.marshalling.server.ServerMarshalling) BgColour(org.kie.workbench.common.dmn.api.property.background.BgColour) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Height(org.kie.workbench.common.dmn.api.property.dimensions.Height) InputData(org.kie.workbench.common.dmn.api.definition.v1_1.InputData) DiagramMarshaller(org.kie.workbench.common.stunner.core.definition.service.DiagramMarshaller) BusinessKnowledgeModelConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.BusinessKnowledgeModelConverter) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) FontSet(org.kie.workbench.common.dmn.api.property.font.FontSet) Collectors(java.util.stream.Collectors) BorderColour(org.kie.workbench.common.dmn.api.property.background.BorderColour) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel) List(java.util.List) Stream(java.util.stream.Stream) DDExtensionsRegister(org.kie.workbench.common.dmn.backend.definition.v1_1.dd.DDExtensionsRegister) Entry(java.util.Map.Entry) DMNMarshallerFactory(org.kie.dmn.backend.marshalling.v1_1.DMNMarshallerFactory) Optional(java.util.Optional) DMNShape(org.kie.workbench.common.dmn.backend.definition.v1_1.dd.DMNShape) ApplicationScoped(javax.enterprise.context.ApplicationScoped) Decision(org.kie.workbench.common.dmn.api.definition.v1_1.Decision) Node(org.kie.workbench.common.stunner.core.graph.Node) Width(org.kie.workbench.common.dmn.api.property.dimensions.Width) DMNDefinitionSet(org.kie.workbench.common.dmn.api.DMNDefinitionSet) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) DefinitionsConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.DefinitionsConverter) HashMap(java.util.HashMap) DiagramMetadataMarshaller(org.kie.workbench.common.stunner.core.definition.service.DiagramMetadataMarshaller) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ColorUtils(org.kie.workbench.common.dmn.backend.definition.v1_1.dd.ColorUtils) Inject(javax.inject.Inject) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Bound(org.kie.workbench.common.stunner.core.graph.content.Bounds.Bound) DRGElement(org.kie.workbench.common.dmn.api.definition.v1_1.DRGElement) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) StreamSupport(java.util.stream.StreamSupport) SimpleEntry(java.util.AbstractMap.SimpleEntry) BindableAdapterUtils(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils) TextAnnotation(org.kie.workbench.common.dmn.api.definition.v1_1.TextAnnotation) XMLEncoderDiagramMetadataMarshaller(org.kie.workbench.common.stunner.core.backend.service.XMLEncoderDiagramMetadataMarshaller) BorderSize(org.kie.workbench.common.dmn.api.property.background.BorderSize) AssociationConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.AssociationConverter) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) IOException(java.io.IOException) InputStreamReader(java.io.InputStreamReader) Association(org.kie.workbench.common.dmn.api.definition.v1_1.Association) BackgroundSet(org.kie.workbench.common.dmn.api.property.background.BackgroundSet) FontSetPropertyConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.FontSetPropertyConverter) InputDataConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.InputDataConverter) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) Consumer(java.util.function.Consumer) KnowledgeSourceConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.KnowledgeSourceConverter) Graph(org.kie.workbench.common.stunner.core.graph.Graph) MagnetConnection(org.kie.workbench.common.stunner.core.graph.content.view.MagnetConnection) DMNElement(org.kie.workbench.common.dmn.api.definition.v1_1.DMNElement) InputStream(java.io.InputStream) BgColour(org.kie.workbench.common.dmn.api.property.background.BgColour) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) Height(org.kie.workbench.common.dmn.api.property.dimensions.Height) BorderSize(org.kie.workbench.common.dmn.api.property.background.BorderSize) Width(org.kie.workbench.common.dmn.api.property.dimensions.Width) BorderColour(org.kie.workbench.common.dmn.api.property.background.BorderColour)

Aggregations

BackgroundSet (org.kie.workbench.common.dmn.api.property.background.BackgroundSet)6 RectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet)6 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)6 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)6 FontSet (org.kie.workbench.common.dmn.api.property.font.FontSet)6 Node (org.kie.workbench.common.stunner.core.graph.Node)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 InformationItem (org.kie.workbench.common.dmn.api.definition.v1_1.InformationItem)3 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)3 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel)2 Decision (org.kie.workbench.common.dmn.api.definition.v1_1.Decision)2 InputData (org.kie.workbench.common.dmn.api.definition.v1_1.InputData)2 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.v1_1.KnowledgeSource)2 TextAnnotation (org.kie.workbench.common.dmn.api.definition.v1_1.TextAnnotation)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 SimpleEntry (java.util.AbstractMap.SimpleEntry)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1