Hi, I have written an applet which requests data from a server, which it then
recieves, decodes and builds an SVG DOM from scratch. However, I cant seem
to get the document to render. I've proven that the SVG is ok as I output it
to a text file and it renders fine in a browser. I did try implementing the
build listeners, and it seemed to be being built, but the render listeners
were never getting called. Could anyone shed any light on what's going
wrong?
Incidentally my DrawNode object just draws a rectangle on the SVG with a
label, and pnlSVGMain is directly on the applet.
m_objDomImpl = SVGDOMImplementation.getDOMImplementation();
m_objSVGDoc =
m_objDomImpl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, "svg",
null);
m_objSVGRoot = m_objSVGDoc.getDocumentElement();
m_objSVGRoot = m_objSVGDoc.getDocumentElement();
m_objSVGRoot.setAttributeNS(null, "width", "100%");
m_objSVGRoot.setAttributeNS(null, "height", "100%");
objSVGCanvas = new JSVGCanvas();
objSVGCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
pnlSVGMain.add("Center",objSVGCanvas);
CDrawNode testNode = new
CDrawNode("100","100",objStartNode.getAttributes().getNamedItem("id").getTextContent(),m_objSVGDoc,m_objSVGRoot);
objSVGCanvas.setSVGDocument((SVGDocument)m_objSVGDoc);
objSVGCanvas.repaint();
SVGGraphics2D svgGen = new SVGGraphics2D(m_objSVGDoc);
try
{
OutputStream os = new FileOutputStream("c:/systemdoc.svg");
Writer w = new OutputStreamWriter(os, "iso-8859-1");
svgGen.stream(m_objSVGRoot,w);
}
catch(Exception e)
{
System.out.println("Exception writing System SVG File: "+e);
}
this is the SVG output in the file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg contentScriptType="text/ecmascript" width="100%"
xmlns:xlink="http://www.w3.org/1999/xlink" zoomAndPan="magnify"
contentStyleType="text/css" height="100%" preserveAspectRatio="xMidYMid
meet" xmlns="http://www.w3.org/2000/svg" version="1.0"
><rect x="100" width="40" height="40" y="100" style="stroke:black;
fill:white;"
/><text x="100" y="100" style="fill:black" dx="2" dy="20"
lengthAdjust="spacingAndGlyphs" textLength="36"
>BactonTerminal</text
></svg
>
--
View this message in context:
http://www.nabble.com/Problem-rendering-an-SVG-DOM-built-on-the-fly-in-Applet-tp21571223p21571223.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]