Search in sources :

Example 1 with DMNDecisionServiceDividerLine

use of org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine in project kie-wb-common by kiegroup.

the class DMNMarshallerStandalone method stunnerToDDExt.

@SuppressWarnings("unchecked")
private static DMNShape stunnerToDDExt(final Definitions definitions, final View<? extends DMNElement> v) {
    final DMNShape result = new org.kie.dmn.model.v1_2.dmndi.DMNShape();
    result.setId("dmnshape-" + v.getDefinition().getId().getValue());
    result.setDmnElementRef(getDmnElementRef(definitions, v));
    final Bounds bounds = new org.kie.dmn.model.v1_2.dmndi.Bounds();
    result.setBounds(bounds);
    bounds.setX(xOfBound(upperLeftBound(v)));
    bounds.setY(yOfBound(upperLeftBound(v)));
    result.setStyle(new org.kie.dmn.model.v1_2.dmndi.DMNStyle());
    result.setDMNLabel(new org.kie.dmn.model.v1_2.dmndi.DMNLabel());
    if (v.getDefinition() instanceof Decision) {
        final Decision d = (Decision) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof InputData) {
        final InputData d = (InputData) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof BusinessKnowledgeModel) {
        final BusinessKnowledgeModel d = (BusinessKnowledgeModel) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof KnowledgeSource) {
        final KnowledgeSource d = (KnowledgeSource) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof TextAnnotation) {
        final TextAnnotation d = (TextAnnotation) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof DecisionService) {
        final DecisionService d = (DecisionService) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
        final DMNDecisionServiceDividerLine dl = new org.kie.dmn.model.v1_2.dmndi.DMNDecisionServiceDividerLine();
        final org.kie.dmn.model.api.dmndi.Point leftPoint = new org.kie.dmn.model.v1_2.dmndi.Point();
        leftPoint.setX(v.getBounds().getUpperLeft().getX());
        final double dlY = v.getBounds().getUpperLeft().getY() + d.getDividerLineY().getValue();
        leftPoint.setY(dlY);
        dl.getWaypoint().add(leftPoint);
        final org.kie.dmn.model.api.dmndi.Point rightPoint = new org.kie.dmn.model.v1_2.dmndi.Point();
        rightPoint.setX(v.getBounds().getLowerRight().getX());
        rightPoint.setY(dlY);
        dl.getWaypoint().add(rightPoint);
        result.setDMNDecisionServiceDividerLine(dl);
    }
    return result;
}
Also used : Bounds(org.kie.dmn.model.api.dmndi.Bounds) DMNDecisionServiceDividerLine(org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine) Point(org.kie.dmn.model.api.dmndi.Point) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) DMNShape(org.kie.dmn.model.api.dmndi.DMNShape) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)

Aggregations

Bounds (org.kie.dmn.model.api.dmndi.Bounds)1 DMNDecisionServiceDividerLine (org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine)1 DMNShape (org.kie.dmn.model.api.dmndi.DMNShape)1 Point (org.kie.dmn.model.api.dmndi.Point)1 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)1 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)1 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)1 InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)1 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource)1 TextAnnotation (org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)1 ControlPoint (org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint)1