Hi I have a trouble with USE elements and listeners. I'm writing a swing application which visualizes a road map and when I get an onMouseOver on a work sign a window should open and show the user the info about works.
Everything works good except that I can't set attributes on the signs that I place on the map (which are the "use" elements). I've attached a file http://old.nabble.com/file/p28042452/my.svg my.svg that is a part of an export of my map, so that the DOM tree is known (with Inkscape or else). Inside the DOM my sign are enclosed in the "Symbols" "g" group and divided into other "g" subgroups, each of them should have his own attributes. How can I do? I tried adding attributes when building my DOM but I can't get them. I attach also my code. Thanks private void registerListeners() { ... NodeList symbolList = canvas.getSVGDocument().getElementsByTagName(SVG_USE_TAG);// ??? // For each symbol... for (int i = 0; i < symbolList.getLength(); i++) { EventTarget t = (EventTarget) symbolList.item(i); // onMouseOut listener t.addEventListener("mouseout", new OnSymbolMouseOut(), false); // onMouseOver listener t.addEventListener("mouseover", new OnSymbolMouseOver(), false); } } private class OnSymbolMouseOver implements EventListener { @Override public void handleEvent(Event evt) { EventTarget evtTarget = evt.getTarget(); //EventTarget evtTarget = evt.getCurrentTarget(); final Element elem = (Element) evtTarget; myWindow.setValue(elem.getAttribute("AN ATTRIBUTE"), elem.getAttribute("ANOTHER ATTRIBUTE"));// ??? myWindow.setVisible(true); } } public class OnSymbolMouseOut implements EventListener { @Override public void handleEvent(Event evt) { myWindow.setVisible(false); } } -- View this message in context: http://old.nabble.com/Use-Elements-Attributes-tp28042452p28042452.html Sent from the Batik - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org