Search in sources :

Example 11 with DMNStyle

use of org.kie.dmn.model.api.dmndi.DMNStyle in project drools by kiegroup.

the class DMNStyleConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    DMNStyle style = (DMNStyle) parent;
    String fontFamily = reader.getAttribute(FONT_FAMILY);
    String fontSize = reader.getAttribute(FONT_SIZE);
    String fontItalic = reader.getAttribute(FONT_ITALIC);
    String fontBold = reader.getAttribute(FONT_BOLD);
    String fontUnderline = reader.getAttribute(FONT_UNDERLINE);
    String fontStrikeThrough = reader.getAttribute(FONT_STRIKE_THROUGH);
    String labelHorizontalAlignement = reader.getAttribute(LABEL_HORIZONTAL_ALIGNMENT);
    String labelVerticalAlignment = reader.getAttribute(LABEL_VERTICAL_ALIGNMENT);
    if (fontFamily != null) {
        style.setFontFamily(fontFamily);
    }
    if (fontSize != null) {
        style.setFontSize(Double.valueOf(fontSize));
    }
    if (fontItalic != null) {
        style.setFontItalic(Boolean.valueOf(fontItalic));
    }
    if (fontBold != null) {
        style.setFontBold(Boolean.valueOf(fontBold));
    }
    if (fontUnderline != null) {
        style.setFontUnderline(Boolean.valueOf(fontUnderline));
    }
    if (fontStrikeThrough != null) {
        style.setFontStrikeThrough(Boolean.valueOf(fontStrikeThrough));
    }
    if (labelHorizontalAlignement != null) {
        style.setLabelHorizontalAlignement(AlignmentKind.valueOf(labelHorizontalAlignement));
    }
    if (labelVerticalAlignment != null) {
        style.setLabelVerticalAlignment(AlignmentKind.valueOf(labelVerticalAlignment));
    }
}
Also used : DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Example 12 with DMNStyle

use of org.kie.dmn.model.api.dmndi.DMNStyle in project drools by kiegroup.

the class DMNDIConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DMNDI list = (DMNDI) parent;
    for (DMNDiagram e : list.getDMNDiagram()) {
        writeChildrenNode(writer, context, e, DMN_DIAGRAM);
    }
    for (DMNStyle e : list.getDMNStyle()) {
        writeChildrenNode(writer, context, e, DMN_STYLE);
    }
}
Also used : DMNDiagram(org.kie.dmn.model.api.dmndi.DMNDiagram) DMNDI(org.kie.dmn.model.api.dmndi.DMNDI) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Example 13 with DMNStyle

use of org.kie.dmn.model.api.dmndi.DMNStyle in project drools by kiegroup.

the class DMNStyleConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DMNStyle style = (DMNStyle) parent;
    if (style.getFillColor() != null) {
        writeChildrenNode(writer, context, style.getFillColor(), FILL_COLOR);
    }
    if (style.getStrokeColor() != null) {
        writeChildrenNode(writer, context, style.getStrokeColor(), STROKE_COLOR);
    }
    if (style.getFontColor() != null) {
        writeChildrenNode(writer, context, style.getFontColor(), FONT_COLOR);
    }
}
Also used : DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Example 14 with DMNStyle

use of org.kie.dmn.model.api.dmndi.DMNStyle in project drools by kiegroup.

the class DMNStyleConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    DMNStyle style = (DMNStyle) parent;
    if (style.getFontFamily() != null) {
        writer.addAttribute(FONT_FAMILY, style.getFontFamily());
    }
    if (style.getFontSize() != null) {
        writer.addAttribute(FONT_SIZE, FormatUtils.manageDouble(style.getFontSize()));
    }
    if (style.isFontItalic() != null) {
        writer.addAttribute(FONT_ITALIC, style.isFontItalic().toString());
    }
    if (style.isFontBold() != null) {
        writer.addAttribute(FONT_BOLD, style.isFontBold().toString());
    }
    if (style.isFontUnderline() != null) {
        writer.addAttribute(FONT_UNDERLINE, style.isFontUnderline().toString());
    }
    if (style.isFontStrikeThrough() != null) {
        writer.addAttribute(FONT_STRIKE_THROUGH, style.isFontStrikeThrough().toString());
    }
    if (style.getLabelHorizontalAlignement() != null) {
        writer.addAttribute(LABEL_HORIZONTAL_ALIGNMENT, style.getLabelHorizontalAlignement().toString());
    }
    if (style.getLabelVerticalAlignment() != null) {
        writer.addAttribute(LABEL_VERTICAL_ALIGNMENT, style.getLabelVerticalAlignment().toString());
    }
}
Also used : DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Example 15 with DMNStyle

use of org.kie.dmn.model.api.dmndi.DMNStyle in project drools by kiegroup.

the class DMNDI method replaceSharedStyleIfStubbed.

private void replaceSharedStyleIfStubbed(DiagramElement element, Map<String, DMNStyle> styleById) {
    if (element.getSharedStyle() instanceof IDREFStubStyle) {
        DMNStyle locatedStyle = styleById.get(element.getSharedStyle().getId());
        element.setSharedStyle(locatedStyle);
    }
}
Also used : IDREFStubStyle(org.kie.dmn.model.v1_3.dmndi.Style.IDREFStubStyle) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle)

Aggregations

DMNStyle (org.kie.dmn.model.api.dmndi.DMNStyle)15 DMNDiagram (org.kie.dmn.model.api.dmndi.DMNDiagram)4 InputStreamReader (java.io.InputStreamReader)2 Color (org.kie.dmn.model.api.dmndi.Color)2 DMNDI (org.kie.dmn.model.api.dmndi.DMNDI)2 DMNShape (org.kie.dmn.model.api.dmndi.DMNShape)2 DiagramElement (org.kie.dmn.model.api.dmndi.DiagramElement)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 SimpleEntry (java.util.AbstractMap.SimpleEntry)1 ArrayList (java.util.ArrayList)1 Collections.emptyList (java.util.Collections.emptyList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Set (java.util.Set)1