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));
}
}
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);
}
}
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);
}
}
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());
}
}
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);
}
}
Aggregations