xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas E Deweese <thomas.dewe...@kodak.com>
Subject RE: AW: Batik 2.0 / <defs><symbol><use> and events
Date Fri, 03 Jan 2003 17:27:41 GMT
>>>>> "CE" == Christian Enklaar <christian.enklaar@mbs-software.de> writes:

CE> Hello and thanx for your quick answers.  One problem is that I
CE> change elements in the displayed svg upon messages received from a
CE> server. My application is kind of monitoring the state of a system
CE> and usually the user has to note changes while performing other
CE> tasks.  But the dynamic update seems only to take place when the
CE> mouse is moved over the batik-application.
>>  I take it you are modifying the DOM from Java not from JavaScript
>> embedded in the document?  It sounds to me like you might not be
>> making your changes in the 'Update Thread'.  Our DOM implementation
>> is not thread safe (it is almost impossible to make a DOM thread
>> safe), so all changes to the DOM must be made in the 'Update
>> Thread'.

CE> Yes - you are right, I am modifying the DOM from Java.  I am not
CE> sure how to use the 'Update Thread' though ...  In fact I am using
CE> an applet (javax/swing/JApplet) which displays the svg-document in
CE> a svgCanvas. The applet starts a thread (runnable) that is waiting
CE> for changes and then calls an update function from the applet
CE> again to modify the DOM (depending on the changes).  Can you give
CE> me a hint, about how to use the 'Update Thread' ?

    Try something like:

import org.apache.batik.bridge.UpdateManager;
import org.apache.batik.util.RunnableQueue;


    JSVGCanvas svg;  // Your SVG Canvas.

    UpdateManager um = svg.getUpdateManager()
    RunnableQueue rq = um.getUpdateRunnableQueue();
    rq.invokeLater(new Runnable() {
    public void run() {
       // Code that modifies the DOM tree...

    I suspect (& hope) that this will solve many of your problems...

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

View raw message