Abraham,
Thanks for your input. The DOM Modification flow is basically:
1. create Element from the SVG DOM object and set attributes
2. navigate DOM to find specific Node
3. clone Node
4. navigate cloned Node and append Element to the cloned Node
5. replace Node with cloned Node in Update Manager
I verified that the cloned Node has the appropriate namespace, are you
suggesting that I need to declare it from the Element? And if yes, how?
Here are some snippets of the code:
//create Element from the SVG Document
Element animate = diagramSVG.createElement("animateColor"); //where
diagramSVG is Document type
//set attributes
animate.setAttribute( ...);
...
//Navigate DOM to find element to append to
...
Node aLink = ... ;
Node animatedALink = origNode.cloneNode(true);
//Navigate clonedNode and then append "animate" to a child of the cloned Node
...
(child of animatedALink).appendChild((Node)animate);
//UpdateManager code
Regards,
Marc> Date: Wed, 31 Oct 2007 14:14:29 +0000> From: [EMAIL PROTECTED]> To:
[email protected]; [EMAIL PROTECTED]> Subject: Re: JSVGCanvas
does not update with modified DOM using Update Manager> > Hi Marc,> > You don't
say how you are updating the SVGDOM, but I have a similar> problem using
Document Fragments. My XML file was right and worked in> Opera browser but not
in JSVGCanvas. The solution I came across was to> declare the svg name space in
the document (i.e xmlns:svg ...)and> use it when creating the new elements (i.e
svg:rect), so JSVGCanvas> will understand that the new elements were SVG
elements and not any> other XML flavor.> > > Hope it will helps> > > Abraham> >
On Oct 24, 2007 7:00 PM, Marc-Wayne M. Formales <[EMAIL PROTECTED]> wrote:> >>
> I'm fairly new to Swing/Batik/SVG so please bear with me.> >> > 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. 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?> >> > Here is a snippet from
the OnClickAction method:> >> >> > NodeList aLinks =
diagramSVG.getElementsByTagName("a");> > for (int i . . . ) {> > final Node
aLink = aLinks.item(i);> > .....> > Some code to find the element that was
clicked on> > clone the element> > append an animate node to the element> >
.....> > }> >> > UpdateManager um = BatikEWD.diaCanvas.getUpdateManager();> >
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);> >
canvas.updateUI(); //I've tried repaint too but nothing seems to> > work> >
panel.updateUI(); //I've tried repaint too but nothing seems to> > work> > }> >
});> >> >> > Regards,> >> > Marc> >> >
---------------------------------------------------------------------> To
unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL
PROTECTED]>