use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape in project kie-wb-common by kiegroup.
the class NodeConnectorTest method createNodeEntryWithBounds.
NodeEntry createNodeEntryWithBounds(final double x, final double y, final double width, final double height) {
final NodeEntry nodeEntry = mock(NodeEntry.class);
final JSIDMNShape shape = mock(JSIDMNShape.class);
final JSIBounds bounds = mock(JSIBounds.class);
when(bounds.getHeight()).thenReturn(height);
when(bounds.getWidth()).thenReturn(width);
when(bounds.getX()).thenReturn(x);
when(bounds.getY()).thenReturn(y);
when(nodeEntry.getDmnShape()).thenReturn(shape);
when(shape.getBounds()).thenReturn(bounds);
return nodeEntry;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape in project kie-wb-common by kiegroup.
the class StunnerConverterTest method testDecision.
@Test
public void testDecision() {
final StylingSet decisionStylingSet = mock(StylingSet.class);
final Decision decision = spy(new Decision());
when(decision.getStylingSet()).thenReturn(decisionStylingSet);
final JSITDecision jsitDecision = mock(JSITDecision.class);
when(jsitDecision.getTYPE_NAME()).thenReturn(JSITDecision.TYPE);
final JSIStyle style = mock(JSIStyle.class);
final JSIDMNShape shape = mock(JSIDMNShape.class);
final JSIDMNStyle dmnStyleOfDrgShape = mock(JSIDMNStyle.class);
when(shape.getStyle()).thenReturn(style);
doReturn(style).when(converter).getUnwrappedJSIStyle(style);
doReturn(true).when(converter).isJSIDMNStyle(style);
doReturn(dmnStyleOfDrgShape).when(converter).getJSIDmnStyle(style);
final NodeEntry nodeEntry = mock(NodeEntry.class);
when(nodeEntry.getDmnElement()).thenReturn(jsitDecision);
when(nodeEntry.getId()).thenReturn("_id");
when(nodeEntry.getDmnShape()).thenReturn(shape);
final Element graphElement = mock(Element.class);
final Node graphNode = mock(Node.class);
final View content = mock(View.class);
when(factoryManager.newElement(anyString(), anyString())).thenReturn(graphElement);
when(graphElement.asNode()).thenReturn(graphNode);
when(graphNode.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(decision);
final JSIColor randomColor = mock(JSIColor.class);
when(randomColor.getRed()).thenReturn(12);
when(randomColor.getGreen()).thenReturn(34);
when(randomColor.getBlue()).thenReturn(56);
when(dmnStyleOfDrgShape.getFontColor()).thenReturn(randomColor);
when(dmnStyleOfDrgShape.getStrokeColor()).thenReturn(randomColor);
when(dmnStyleOfDrgShape.getFillColor()).thenReturn(randomColor);
when(dmnStyleOfDrgShape.getFontSize()).thenReturn(11d);
converter.make(nodeEntry);
verify(decisionStylingSet).setFontSize(fontSizeArgumentCaptor.capture());
Assertions.assertThat(fontSizeArgumentCaptor.getValue().getValue()).isEqualTo(11d);
verify(decisionStylingSet).setBorderColour(borderColourArgumentCaptor.capture());
Assertions.assertThat(borderColourArgumentCaptor.getValue().getValue()).isEqualTo("#0c2238");
verify(decisionStylingSet).setBgColour(bgColourArgumentCaptor.capture());
Assertions.assertThat(bgColourArgumentCaptor.getValue().getValue()).isEqualTo("#0c2238");
verify(decisionStylingSet).setFontColour(fontColourArgumentCaptor.capture());
Assertions.assertThat(fontColourArgumentCaptor.getValue().getValue()).isEqualTo("#0c2238");
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape 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());
}
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape in project kie-wb-common by kiegroup.
the class NodeEntriesBuilder method makeStandardShape.
private JSIDMNShape makeStandardShape() {
final JSIDMNShape jsidmnShape = new JSIDMNShape();
final JSIBounds boundsParam = new JSIBounds();
boundsParam.setX(0);
boundsParam.setY(0);
boundsParam.setWidth(100);
boundsParam.setHeight(50);
jsidmnShape.setBounds(boundsParam);
return jsidmnShape;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape in project kie-wb-common by kiegroup.
the class WrapperUtils method getWrappedJSIDMNShape.
public static JSIDMNShape getWrappedJSIDMNShape(final JSIDMNDiagram diagram, final List<String> dmnDiagramElementIds, final Definitions definitionsStunnerPojo, final View<? extends DMNElement> v, final String namespaceURI) {
final JSIDMNShape unwrappedJSIDMNShape = stunnerToDDExt(diagram, dmnDiagramElementIds, definitionsStunnerPojo, v, namespaceURI);
final JSIDMNShape toReturn = Js.uncheckedCast(JsUtils.getWrappedElement(unwrappedJSIDMNShape));
final JSIName jsiName = JSIDMNShape.getJSIName();
updateJSIName(jsiName, "dmndi", "DMNShape");
JsUtils.setNameOnWrapped(toReturn, jsiName);
return toReturn;
}
Aggregations