You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Ray <ra...@picis.com> on 2006/08/01 22:05:33 UTC

ID attribute on elements

I am working on a project where different SVGs are overlayed on an SVG
background at varying locations.  Currently there are two SVGs that can be
overlayed.  To accomplish this, I am using the following code:

Element grp = svgDoc.createElementNS(sessionMgr.getSvgNS(), "use");

grp.setAttributeNS(null, "id", p.getId());
grp.setAttributeNS(null, "x", xx);
grp.setAttributeNS(null, "y", yy);

if (p.getProperty("type").equals("1") {
  grp.setAttributeNS(sessionMgr.getXlinkNS(), "xlink:href", "#type1");
} else {
  grp.setAttributeNS(sessionMgr.getXlinkNS(), "xlink:href", "#type2");
}

The grp object is then appended to a <g> Element, which is then appended to
the document.  The overlayed SVGs show up as expected, and in their proper
locations.  The problem comes when I try to handle events for the overlayed
SVGs.  I *need* to get the ID of the overlayed SVG, but no matter what I do,
it's coming back empty.  I have tried both adding an eventListener to the
DocumentElement and setting up a MouseAndNodeEventHandler that gets the
Element from the bridgeContext using
GraphicsNodeMouseEvent.getGraphicsNode().
-- 
View this message in context: http://www.nabble.com/ID-attribute-on-%3Cuse%3E-elements-tf2035904.html#a5602053
Sent from the Batik - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org