Sorry for dup message if any (Used the wrong email address to send to the
list) :/
> Hello,
> I'm quite newbie with Batik. I would like to know how I can change a
> style
> attribute from a given element. This element is out of a pre-loaded
> SVGDocument. What is the best way to do such a thing? I looked at the
> Mailing list archive and found a code sample using the SVGStylableSupport
> class which not seems to be ever in the Batik's API.
> I'm using Batik 1.5 beta4 :)
I managed to get some changes using a code similar to this :
svgPanel.addSVGDocumentLoaderListener(new SVGDocumentLoaderAdapter() {
public void documentLoadingCompleted(SVGDocumentLoaderEvent evt) {
SVGDocument svgDoc = svgPanel.getSVGDocument();
NodeList nl =
svgDoc.getElementsByTagNameNS(SVGDOMImplementation.SVG_NAMESPACE_URI,"path");
for(int i=0;i<nl.getLength();i++){
SVGOMPathElement svgpe = (SVGOMPathElement)nl.item(i);
svgpe.setAttribute("style","stroke:black;fill:green");
}
}
});
This is quite brute-force change whereas I would like to change only "fill:"
value.
I tried to get svgpe.getStyle() but I invariantly get an nullPointerException
while calling this method (getStyle() method is from SVGStylableElement class)
If I clearly understood JavaDocs, getStyle() returns a CSSStyleDeclaration
which I could apply the setProperty("fill","green","") on to get what I would
like...
So what's missing to get things work? Is there any resource I can consult to
be more efficient on the subject?
Thanx :)
--
Jean-Christophe ARNU
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]