use of org.apache.batik.dom.svg.SVGDocumentFactory in project charts by vaadin.
the class PdfExportDemo method createSVGDocument.
private SVGDocument createSVGDocument(String svg, UserAgent agent) throws IOException {
SVGDocumentFactory documentFactory = new SAXSVGDocumentFactory(agent.getXMLParserClassName(), true);
SVGDocument svgdoc = documentFactory.createSVGDocument(null, new StringReader(svg));
return svgdoc;
}
use of org.apache.batik.dom.svg.SVGDocumentFactory in project charts by vaadin.
the class SwingDemo method display.
public static void display(Configuration conf) {
String svg = SVGGenerator.getInstance().generate(conf);
String parser = XMLResourceDescriptor.getXMLParserClassName();
SVGDocumentFactory documentFactory = new SAXSVGDocumentFactory(parser, true);
SVGDocument svgdoc;
try {
svgdoc = documentFactory.createSVGDocument(null, new StringReader(svg));
JSVGCanvas jsvgCanvas = new JSVGCanvas();
jsvgCanvas.setSVGDocument(svgdoc);
JFrame f = new JFrame();
f.setSize(600, 400);
f.getContentPane().add(jsvgCanvas);
f.pack();
f.setVisible(true);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Aggregations