import org.simantics.scl.runtime.function.Function1;
import org.simantics.scl.runtime.function.Function2;
import org.simantics.utils.threads.AWTThread;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
private static final long serialVersionUID = 8508750881358776559L;
+ private static final Logger LOGGER = LoggerFactory.getLogger(SVGNode.class);
protected String data = null;
protected String defaultData = null;
protected Point targetSize = null;
}
this.data = cached;
this.defaultData = cached;
+ cleanDiagramCache();
}
@SyncField("targetSize")
diagramCache = null;
}
- // Lets check for rootAssignment that contributes the whole SVG
+ // Lets check for rootAssignment that contributes the whole SVG
SVGNodeAssignment rootAssignment = null;
if (!assignments.isEmpty()) {
for (SVGNodeAssignment ass : assignments) {
} else {
e.setAttribute(ass.attributeNameOrId, ass.value);
}
+ } else {
+ LOGGER.warn("Element with id='" + ass.elementId + " was not found.");
}
}
boolean changed = false;
+ // Without this elements are sometimes not found by id!
+ diagram.updateTime(0);
+
for (SVGNodeAssignment ass : assignments) {
SVGElement e = diagram.getElement(ass.elementId);
if (e != null) {
}
}
+ // Without this the attribute values are not correctly reflected in rendering
+ diagram.updateTime(0);
+
return changed;
}
URI uri = univ.loadSVG(new ByteArrayInputStream(dataBytes), digest);
diagramCache = univ.getDiagram(uri, false);
if (diagramCache != null) {
- SVGRoot root = diagramCache.getRoot();
+ SVGRoot root = diagramCache.getRoot();
if (root == null) return new Rectangle2D.Double();
return (Rectangle2D)root.getBoundingBox().clone();
}
if (!data.equals(documentCache) || diagramCache == null) {
dataHash = parseSVG();
if (diagramCache == null) {
- System.err.println("UNABLE TO PARSE SVG:\n" + data);
+ LOGGER.warn("UNABLE TO PARSE SVG:\n" + data);
return;
}
}