xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Armhold <armh...@cs.rutgers.edu>
Subject Re: JSVGComponent dynamic DOM update, invokeAndWait threading issue
Date Wed, 08 Oct 2003 17:59:56 GMT
I'm still struggling with threads in Batik.  A previously discussed
recommendation was to "leave the canvas alone until
gvtTreeRenderingComplete is fired".  However what does one do when the
requests for updating the canvas/DOM are firing from the Swing thread?
You can't block in the Swing thread, because the Batik events are
apparently fired from there as well, so I'll never see
gvtTreeRenderingComplete.  Here's the scenario:

1. Swing event triggers canvas.setSVGDocument(firstDoc).

2. manipulate firstDoc's DOM (in UpdateManger's thread) in response to
    Swing mouse clicks, etc.

3. Swing event calls canvas.getSVGDocument() to get the modified
    firstDoc back, and then canvas.setSVGDocument(secondDoc).

4. manipulate firstDoc's DOM in Swing thread.

I then get a NullPointerException, presumably because I am modifying
the firstDoc DOM outside of the UpdateManager thread. The kind of
situation that is triggering this behavior is when the user clicks the
"load next SVG document" button too quickly in succession.

Perhaps I am going about things the wrong way, because very often when
using the canvas I end up trying all sorts of threading chicanery to
simulate blocking for Batik's non-blocking methods.


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

View raw message