xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc-Wayne M. Formales" <mforma...@msn.com>
Subject RE: JSVGCanvas does not update with modified DOM using Update Manager
Date Tue, 06 Nov 2007 16:20:52 GMT
Thanks for all your input.  It turns out that you were right about the setAttributeNS(null,
...,...) method.  Regards, Marc

To: batik-users@xmlgraphics.apache.orgCC: batik-users@xmlgraphics.apache.orgSubject: Re: JSVGCanvas
does not update with modified DOM using Update ManagerFrom: thomas.deweese@kodak.comDate:
Tue, 6 Nov 2007 06:17:00 -0500Hi Marc, "Marc-Wayne M. Formales" <mformales@msn.com>
wrote on 10/24/2007 03:00:33 PM:> I have a JApplet that loads an SVG via JSVGCanvas.>
setDocument(xmlDoc).  If a user clicks on a certain part of the > document (any <a>
tag), then I have some code that will animate that> node and replace it in the document
object.  I am doing this in the > update manager, which does run in the gvtRendering event,
but the UI> is not updated with the changes I made. >    um.getUpdateRunnableQueue().invokeLater(new
Runnable() {>      public void run() {>          System.out.println("connID: " + connID);>
         diagramSVG.getDocumentElement().replaceChild(animatedALink,> aLink);  //where
animatedALink is the modified>          canvas.setDocument(diagramSVG);    You should not
reset the document.  This will be _very_ slow. However if that did not work then there is
almost certainly something wrong with the elements you construct. > I know that the DOM
object is correct because if I write that > to the file system, the changes are there.
 Is there something > that I'm missing?   This test is almost useless for detecting namespace
problems. The majority of common namespace errors are corrected by writing the file and reparsing
it. "Tonny Kohar" <tonny.kohar@gmail.com> wrote on 11/01/2007 12:07:32 AM:> On 11/1/07,
Marc-Wayne M. Formales <mformales@msn.com> wrote:> >> >     Element animate
= diagramSVG.createElement("animateColor"); //where> > diagramSVG is Document type>
Batik is namespace aware, so you need to use namespace when creating> or set attribute
using the namespace aware methods> String svgNS = SVGConstants.SVG_NAMESPACE_URI;> diagramSVG.createElementNS(svgNS,...)
   Tonny is correct here.  'createElement("animateColor")' will not work.  It needs to be
'createElementNS(svgNS, "animateColor")'.     However: > >     //set attributes>
>     animate.setAttribute( ...);> > animate.setAttributeNS(svgNS,...)   This is
generally _not_ correct.  With the exception of the 'xlink' attributes (most notably xlink:href),
all attributes in SVN need to be set with:    animate.setAttributeNS(null, ...)   This could
be your problem as if you don't set any attributes on the animate element (which is what it
would look like to Batik if you put them all in the SVG Namespace instead of the null namespace).

View raw message