xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zze-DAROUX Olivier FTRD/DIH/GRE" <olivier.dar...@rd.francetelecom.com>
Subject RE: Lazy loading
Date Wed, 06 Aug 2003 11:07:01 GMT
>     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 :-)

> It's probably worth doing a few times to get a more accurate picture.
> 
> >>>Morever if I don't move the mouse over the canvas, updates made by 
> >>
> >> > java (using updatemanager) are not showed. (This my main problem,
> >> > the delay is accessory)
> >>
> >>   So this really sounds like you are not using the UpdateManager's
> >>RunnableQueue.  Can you post some code that shows how you post the
> >>runnable?  Also an example runnable would be useful (best of course
> >>is a standalone reproducable test case).
> > 
> > Well in fact I'm wrong, the updates are done, without moving on the
> > canvas.
> 
>      Ahh, that is good to hear.

:-)

>  The code below looks good to me.

Yes, of course, it comes from the mailing list :-)
Before 1.5 final, I haven't used updatemanager, but in the 1.5, without
it, nothing worked for me, no updates.

> 
> > For the runnable :
> > queueAction.invokeLater(
> >     new Runnable() {
> >        public void run() {
> >            elt.setAttributeNS(null, "visibility", "visible");
> >        }
> >     }
> > );
> 
> 
> 
> > where queueAction = 
> canvas.getUpdateManager().getUpdateRunnableQueue();
> > 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)

> > 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).
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 ?

> 
> > 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: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message