use of org.kie.workbench.common.dmn.api.property.styling.BgColour in project kie-wb-common by kiegroup.
the class DMNMarshallerStandalone method internalAugment.
@SuppressWarnings("unchecked")
private void internalAugment(final Stream<DMNShape> drgShapeStream, final Id id, final Bound ulBound, final RectangleDimensionsSet dimensionsSet, final Bound lrBound, final StylingSet stylingSet, final DoubleConsumer decisionServiceDividerLineYSetter) {
final Optional<DMNShape> drgShapeOpt = drgShapeStream.filter(shape -> shape.getDmnElementRef().getLocalPart().endsWith(id.getValue())).findFirst();
if (!drgShapeOpt.isPresent()) {
return;
}
final DMNShape drgShape = drgShapeOpt.get();
if (ulBound != null) {
ulBound.setX(xOfShape(drgShape));
ulBound.setY(yOfShape(drgShape));
}
dimensionsSet.setWidth(new Width(widthOfShape(drgShape)));
dimensionsSet.setHeight(new Height(heightOfShape(drgShape)));
if (lrBound != null) {
lrBound.setX(xOfShape(drgShape) + widthOfShape(drgShape));
lrBound.setY(yOfShape(drgShape) + heightOfShape(drgShape));
}
final DMNStyle dmnStyleOfDrgShape = drgShape.getStyle() instanceof DMNStyle ? (DMNStyle) drgShape.getStyle() : null;
if (dmnStyleOfDrgShape != null) {
if (null != dmnStyleOfDrgShape.getFillColor()) {
stylingSet.setBgColour(new BgColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getFillColor())));
}
if (null != dmnStyleOfDrgShape.getStrokeColor()) {
stylingSet.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getStrokeColor())));
}
}
final StylingSet fontSet = new StylingSet();
if (dmnStyleOfDrgShape != null) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN(dmnStyleOfDrgShape));
}
if (drgShape.getDMNLabel() != null && drgShape.getDMNLabel().getSharedStyle() instanceof DMNStyle) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN((DMNStyle) drgShape.getDMNLabel().getSharedStyle()));
}
if (drgShape.getDMNLabel() != null && drgShape.getDMNLabel().getStyle() instanceof DMNStyle) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN((DMNStyle) drgShape.getDMNLabel().getStyle()));
}
mergeFontSet(stylingSet, fontSet);
if (drgShape.getDMNDecisionServiceDividerLine() != null) {
decisionServiceDividerLineYSetter.accept(drgShape.getDMNDecisionServiceDividerLine().getWaypoint().get(0).getY());
}
}
use of org.kie.workbench.common.dmn.api.property.styling.BgColour in project kie-wb-common by kiegroup.
the class StunnerConverter method internalAugmentStyles.
private void internalAugmentStyles(final JSIDMNShape drgShape, final StylingSet stylingSet) {
final JSIStyle jsiStyle = drgShape.getStyle();
if (Objects.isNull(jsiStyle)) {
return;
}
final JSIStyle drgStyle = getUnwrappedJSIStyle(jsiStyle);
final JSIDMNStyle dmnStyleOfDrgShape = isJSIDMNStyle(drgStyle) ? getJSIDmnStyle(drgStyle) : null;
if (Objects.nonNull(dmnStyleOfDrgShape)) {
if (Objects.nonNull(dmnStyleOfDrgShape.getFillColor())) {
stylingSet.setBgColour(new BgColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getFillColor())));
}
if (Objects.nonNull(dmnStyleOfDrgShape.getStrokeColor())) {
stylingSet.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getStrokeColor())));
}
}
final StylingSet fontStylingSet = new StylingSet();
if (Objects.nonNull(dmnStyleOfDrgShape)) {
mergeFontStylingSet(fontStylingSet, FontStylingSetPropertyConverter.wbFromDMN(dmnStyleOfDrgShape));
}
if (Objects.nonNull(drgShape.getDMNLabel())) {
final JSIDMNShape jsiLabel = Js.uncheckedCast(drgShape.getDMNLabel());
final JSIStyle jsiLabelStyle = jsiLabel.getStyle();
final Object jsiLabelSharedStyle = Js.uncheckedCast(jsiLabel.getSharedStyle());
if (Objects.nonNull(jsiLabelSharedStyle) && JSIDMNStyle.instanceOf(jsiLabelSharedStyle)) {
mergeFontStylingSet(fontStylingSet, FontStylingSetPropertyConverter.wbFromDMN((Js.uncheckedCast(jsiLabelSharedStyle))));
}
if (Objects.nonNull(jsiLabelStyle) && isJSIDMNStyle(jsiLabelStyle)) {
mergeFontStylingSet(fontStylingSet, FontStylingSetPropertyConverter.wbFromDMN(Js.uncheckedCast(jsiLabelStyle)));
}
}
mergeFontStylingSet(stylingSet, fontStylingSet);
}
Aggregations