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