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);
}
}
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 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 UnmarshalMarshalTest method test_FontSize_sharedStyle.
@Test
public void test_FontSize_sharedStyle() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "test-FontSize-sharedStyle.dmn");
Definitions definitions = MARSHALLER.unmarshal(new InputStreamReader(this.getClass().getResourceAsStream("test-FontSize-sharedStyle.dmn")));
DMNShape shape0 = (DMNShape) definitions.getDMNDI().getDMNDiagram().get(0).getDMNDiagramElement().get(0);
DMNStyle shape0sharedStyle = (DMNStyle) shape0.getDMNLabel().getSharedStyle();
assertEquals("LS_4d396200-362f-4939-830d-32d2b4c87042_0", shape0sharedStyle.getId());
assertEquals(21d, shape0sharedStyle.getFontSize(), 0.0d);
}
Aggregations