Thomas DeWeese wrote:

Reinhard Brandst�dter wrote:

So this means if I use the invokeLater() from the UpdateManager it's slower than directly modifying the document.


No, it just means that you may have two threads modifying the same
document at the same time. Once the document is associated with the Canvas
(and hence an UpdateManager) all modifications are tracked - it doesn't matter
what thread the changes are made in it tracks them. However if the modifications
aren't made in the UpdateManager thread you will have multi-threading issues.

Yep I've encountered some of these problems before ;-)


> As I mentioned before there
> is no need to immediately see the changes in the canvas as they are made.
> But somehow this interferes with Java Scripting and Event handling.


The update of the display is only ever done _after_ a Runnable completes
so if you moved the "reconstruction" of the document into a runnable no repaints
would happen until the runnable completed. This would also make your
document "play nicely" with JavaScript and Event handling. As it is
your JavaScript and Events may be running on the same Document as you
are constructing it!

Oh I see!


I would take one of three routes here:

1) Don't load the document with setURI (do you even need to load something
from a URI?[*]), but load the document yourself, modify it and then set it
with setSVGDocument.
2) Move all your code into a Runnable and run it in the UpdateManager Thread.
3) Load the document with setURI, then deep clone the Document, then modify
the clone (which doesn't have to be in the UpdateManager Thread and the
changes won't be tracked by the Canvas). Then you can set the clone document
on the canvas.

I think 2 is the best way to do it....but how would this perform if the code in the Runnable is quite big? No issues on that?


I've tried something like 1 (isn't that quite similar to the code I submitted in my original posting, except the setURI?)

[*] What is the document you are loading from the URI?  Is there any reason
    that the document from the URI needs to be related to the document you
    create on the fly?

This is from a older version when I used ECMA Script to handle events which was coded in a template file I loaded from URI.
As I said I'm playing around with different Script methods, so just now it makes no sense but I'm having ECMA Script and Java Script code...




--
Reinhard Brandstaedter   [EMAIL PROTECTED]  GPG: 0x033B81DB
-    Student of Computer Science - J.K. University of Linz     -
-        <ICQ: 73059068>    <Mobile: +43 699 12419541>         -
-                  http://adelaide.dnsalias.net                -


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to