Search in sources :

Example 1 with JSIDMNDecisionServiceDividerLine

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDecisionServiceDividerLine in project kie-wb-common by kiegroup.

the class StunnerConverter method internalAugment.

private void internalAugment(final JSIDMNShape drgShape, final Bound ulBound, final RectangleDimensionsSet dimensionsSet, final Bound lrBound, final StylingSet stylingSet, final Consumer<Double> decisionServiceDividerLineYSetter) {
    if (Objects.nonNull(ulBound)) {
        ulBound.setX(xOfShape(drgShape));
        ulBound.setY(yOfShape(drgShape));
    }
    dimensionsSet.setWidth(new Width(widthOfShape(drgShape)));
    dimensionsSet.setHeight(new Height(heightOfShape(drgShape)));
    if (Objects.nonNull(lrBound)) {
        lrBound.setX(xOfShape(drgShape) + widthOfShape(drgShape));
        lrBound.setY(yOfShape(drgShape) + heightOfShape(drgShape));
    }
    internalAugmentStyles(drgShape, stylingSet);
    if (Objects.nonNull(drgShape.getDMNDecisionServiceDividerLine())) {
        final JSIDMNDecisionServiceDividerLine divider = Js.uncheckedCast(drgShape.getDMNDecisionServiceDividerLine());
        final List<JSIPoint> dividerPoints = divider.getWaypoint();
        final JSIPoint dividerY = Js.uncheckedCast(dividerPoints.get(0));
        decisionServiceDividerLineYSetter.accept(dividerY.getY());
    }
}
Also used : JSIDMNDecisionServiceDividerLine(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDecisionServiceDividerLine) JSIPoint(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dc.JSIPoint) Height(org.kie.workbench.common.dmn.api.property.dimensions.Height) Width(org.kie.workbench.common.dmn.api.property.dimensions.Width)

Example 2 with JSIDMNDecisionServiceDividerLine

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDecisionServiceDividerLine in project kie-wb-common by kiegroup.

the class WrapperUtils method stunnerToDDExt.

private static JSIDMNShape stunnerToDDExt(final JSIDMNDiagram diagram, final List<String> dmnDiagramElementIds, final Definitions definitionsStunnerPojo, final View<? extends DMNElement> v, final String namespaceURI) {
    final JSIDMNShape result = new JSIDMNShape();
    final DMNElement definition = v.getDefinition();
    final String dmnElementId = definition.getId().getValue();
    final String shapeId = getShapeId(diagram, dmnDiagramElementIds, dmnElementId);
    result.setId(shapeId);
    result.setDmnElementRef(getDmnElementRef(definitionsStunnerPojo, v, namespaceURI));
    final JSIBounds bounds = new JSIBounds();
    result.setBounds(bounds);
    bounds.setX(xOfBound(upperLeftBound(v)));
    bounds.setY(yOfBound(upperLeftBound(v)));
    result.setDMNLabel(new JSIDMNLabel());
    // TODO {gcardosi}: HARDCODED
    result.setIsCollapsed(false);
    final JSIDMNStyle style = new JSIDMNStyle();
    if (v.getDefinition() instanceof Decision) {
        final Decision d = (Decision) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyStylingStyles(d.getStylingSet(), style);
    } else if (v.getDefinition() instanceof InputData) {
        InputData d = (InputData) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyStylingStyles(d.getStylingSet(), style);
    } else if (v.getDefinition() instanceof BusinessKnowledgeModel) {
        final BusinessKnowledgeModel d = (BusinessKnowledgeModel) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyStylingStyles(d.getStylingSet(), style);
    } else if (v.getDefinition() instanceof KnowledgeSource) {
        final KnowledgeSource d = (KnowledgeSource) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyStylingStyles(d.getStylingSet(), style);
    } else if (v.getDefinition() instanceof TextAnnotation) {
        final TextAnnotation d = (TextAnnotation) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyStylingStyles(d.getStylingSet(), style);
    } else if (v.getDefinition() instanceof DecisionService) {
        final DecisionService d = (DecisionService) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyStylingStyles(d.getStylingSet(), style);
        final JSIDMNDecisionServiceDividerLine dl = new JSIDMNDecisionServiceDividerLine();
        final JSIPoint leftPoint = new JSIPoint();
        leftPoint.setX(v.getBounds().getUpperLeft().getX());
        final double dlY = v.getBounds().getUpperLeft().getY() + d.getDividerLineY().getValue();
        leftPoint.setY(dlY);
        dl.addWaypoint(leftPoint);
        final JSIPoint rightPoint = new JSIPoint();
        rightPoint.setX(v.getBounds().getLowerRight().getX());
        rightPoint.setY(dlY);
        dl.addWaypoint(rightPoint);
        result.setDMNDecisionServiceDividerLine(dl);
    }
    result.setStyle(getWrappedJSIDMNStyle(style));
    return result;
}
Also used : JSIDMNDecisionServiceDividerLine(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDecisionServiceDividerLine) JSIDMNShape(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape) JSIDMNStyle(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNStyle) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) JSIBounds(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dc.JSIBounds) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) DMNElement(org.kie.workbench.common.dmn.api.definition.model.DMNElement) JSIPoint(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dc.JSIPoint) JSIDMNLabel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNLabel) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation)

Aggregations

JSIPoint (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dc.JSIPoint)2 JSIDMNDecisionServiceDividerLine (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDecisionServiceDividerLine)2 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)1 DMNElement (org.kie.workbench.common.dmn.api.definition.model.DMNElement)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 Height (org.kie.workbench.common.dmn.api.property.dimensions.Height)1 Width (org.kie.workbench.common.dmn.api.property.dimensions.Width)1 JSIBounds (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dc.JSIBounds)1 JSITTextAnnotation (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation)1 JSIDMNLabel (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNLabel)1 JSIDMNShape (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape)1 JSIDMNStyle (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNStyle)1