There are lots of things that could cause it to use 2.3Mb. Where do you register your event listeners? If you are registering individual event listeners on a large document (as per your example below it could take a bit).
Yes I register the mouse event like in my example...
It sounds to me like something is just taking a long time when the document is loaded.
Then, what's the best method ?
I so think that it's not a problem in my code (maybe I'm
wrong :-)), or
it's in a part that I don't know (this could be that :-)) (How do I trace... ?)
Well on Windows if you run Batik from a DOS window you can press something like ctrl-'break' (the break key) and it will dump the stack trace for all threads. So you can look at what it is doing for those few seconds (i.e. who's code is running).
ok I will try. It won't be easy, I must be fast :-)
Good luck :)
You can also just stick in System.err.println("Blah"); in your code to try and figure out when your code is called and when it finishes in relation to the updates happening.
This is not the method I use to highlight a shape but only the setAttributeNS part changes : elt.setAttributeNS(null, "class", "highlighted");
Hmm, I recently fixed a number of performance and propigation bugs in changing 'properties' in CSS. I am skeptical that the performance issues effect you since they would effect you for all changes not just the first one, but it is probably worth while to upgrade to current CVS if you are doing things like the above.
Well I've haven't access to the CVS port because of proxy... Is there another mean... ? (furthermore I prefer the binaries)
Not really, It would be nice if we provided a nightly source tar-ball :) As I said I don't think my fixes are important here.
OnAction onAction = new OnAction(dynUpdt, this);
Element gSets = svgDoc.getElementById("sets");
NodeList nodeList = gSets.getChildNodes();
Couple of points here. First off DOM Event 'bubble' through the DOM tree so if you just registered listeners on the gSets element you would recieve any events that happen on the child elements.
Well euh... because of not being english, I'm not sure to understand this sentence :-} (the beginning).
Sorry, the term 'bubble' comes from the DOM events specification, you may want to read it as there are lots of very useful non-obvious features in the specification.
Are telling me that by doing this, it could works ? : . register my onAction object on gSets . When onouseover event occured, the event object is for example a rect in the g parent element ? Not the g element itself ?
Correct, there are three element attributes on mouse events. currentTarget, target, relatedTarget.
In the above case ('rect' child of 'g') of one listener:
currentTarget = 'g' element. target = 'rect' element. relatedTarget = for mouseover/out is element left/entered. not used for all event types.
int i=0; Node elt; while ((elt = nodeList.item(i++)) != null) { if (elt.getNodeName() != "#text") {
A better check is: (elt.getNodeType() == Node.ELEMENT_NODE) This faster and means you won't get tripped by CData sections or Comments.
Ok thanks, indeed I found my method, too... too... dirty :-)
EventTarget t = (EventTarget)elt; t.addEventListener("mouseover", onAction.new Over(), false); t.addEventListener("mouseout", onAction.new Out(), false); t.addEventListener("click", onAction.new Click(), false);
Morever a better method would have been to have one of three objects in onAction, to avoid creating one on every element...
Thanks Olivier
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]