Hi,
I am using Batik 1.5b4b version.
Through the app i am developing i let the user select a svg file and open
it. It opens and renders properly. The app also allows user to add more
<text> nodes to the SVG document. I take the value for the text node in a
JTextArea and create a text node and append to the SVGDocument. My problem
is that even after appending the new <text> node it doesn't show up on the
JSVGCanvas.
I tried doing the following:
1) setSVGDocument(doc)
2) repaint() on JSVGCanvas
3) repaint() on UpdateManager of the canvas.
but nothing worked. If i try writing the SVGDocument to a file, it contains
the <text> node which i appened. If i reopen this file again thru my app the
text node shows up. But i don't want it that way. I need the canvas to
refresh when the SVGDocument changes.
Please help!
I have appended my method which creates the new text node below.
Thanks,
Geeta Shukla
Persistent Systems Ltd, Pune, India - 16
Ph: (020)5678900*671
Email: [EMAIL PROTECTED]
-----------------------------------------------------------------
Note: i have tried creating attribute and element with NS, without NS and
with a null NS.. nothing works
public void createAnnotationNode( String annotation, int x, int y, int
SVGWidth) throws Exception
{
SVGDocument document = this.getSVGDocument();
SVGSVGElement root = document.getRootElement();
int xScale = x + (annotation.length()*12);
if(xScale > SVGWidth)
{
root.setAttributeNS(null, "width", String.valueOf(xScale));
}
// create the text
Element text = document.createElementNS(null, "text");
text.setAttributeNS(null,"x", String.valueOf(x));
text.setAttributeNS(null,"y", String.valueOf(y));
text.setAttributeNS(null,"style", "font-size:12");
Text value = document.createTextNode(annotation);
text.appendChild(value);
// attach the text to the svg root element
root.appendChild(text);
this.setSVGDocument(document);
}//end of method createTextNode
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]