xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tilo Behrmann" <T.behrm...@gmx.net>
Subject AW: remove onClickListener
Date Wed, 04 Jan 2006 14:43:12 GMT
Thanks Thomas,

i have done this with a HashMap, it works . I've think it gose without a
reference holder.

-----Urspr√ľngliche Nachricht-----
Von: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
Gesendet: Mittwoch, 4. Januar 2006 14:53
An: batik-users@xmlgraphics.apache.org
Betreff: Re: remove onClickListener


Hi Tilo,

"Tilo Behrmann" <T.behrmann@gmx.net> wrote on 01/04/2006 08:14:57 AM:

> can anybode tell me how i can remove a onClickListener from a circle
> element?

   The listener passed to removeEventListener must be the
actual listener that was passed to addEventListener, not simply
one that is similar:

>           t.removeEventListener("click",
>                                 new
OnClickLocationAction(e.getLocation().
>               getDistrict().getName(), e.getLocationOldName(), disTree),
> false);

   You will likely need to build a hash table with circle elements
as keys and the registered listener as values.  You might consider
using a weak hash table if the circle elements are likely to be added
and removed 'on the fly'.

   Also your code is very inefficient.  So a few pointers,
first, the DOMEvent passed to your 'OnClickLocationAction' includes
the circle that was clicked so you shouldn't have to check every circle
in the document.  Second, I've told you before that you should only
call getElementsByTagNameNS _once_, your code continues to call this
for every iteration of the loop.

>       int length =
> this.doc.getDocumentElement().getElementsByTagNameNS(this.
>           svgNS, "circle").getLength();
>       for (int i = 0; i < length; i++) {
>         Element elm2 = (Element)this.doc.getDocumentElement().
>             getElementsByTagNameNS(this.
>                                    svgNS, "circle").item(i);

        I'm only bringing this up again because I don't want others
to think that this is "the right way" to do things.

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


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


Mime
View raw message