xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "TJ Teegan" <tjtee...@hotmail.com>
Subject RE: Update of JSVGCanvas
Date Wed, 05 Jan 2005 16:20:45 GMT
Hello,

I am not quite sure if I fully understand the question, so I am just taking 
a guess here.  Hope it helps.  You might want to just use the 
java.util.Timer, or javax.swing.Timer, to count your five seconds.  My guess 
is the canvas does not like it when you put the thread to sleep in 
PeriodMarker (just a wild guess).  Then call your unmark method from within 
the canvas's update thread.  For example:

//Some timer event code.....

svgCanvas.getUpdateManager().getUpdateRunnableQueue().
    invokeLater(new Runnable() {
        public void run() {
            maker.unmark(elem);
        }
    });

//End timer code

Note that in the example above elem, and most likely marker, will have to be 
declared as final.

This should force your updates to show up on the screen instantly.  You 
might also want to call your mark method from within the canvas's update 
thread similiar to above.

For more information check out 
http://xml.apache.org/batik/javaScripting.html#Threads

Hope it helps,
TJ

PS: I am not an expert at using Batik, so there may be a better solution to 
your problem than what I am suggesting.

>From: Scheit Christoph <christoph.scheit@siemens.com>
>Reply-To: "Batik Users" <batik-users@xml.apache.org>
>To: batik-users@xml.apache.org
>Subject: Update of JSVGCanvas
>Date: Wed, 5 Jan 2005 16:34:10 +0100
>
>Hi all!
>
>I want to enable users to search element within an svg-document, which
>works fine. The problem is, that if an element is found, I want it to 
>change
>his stroke and stroke color for 5 seconds e.g..
>My Idea to this was to start a thread, which manipulates the attributes of
>the element, waits for five sec. and then undo's the manipulations. This
>didn't work and I found the answer to this in the FAQ's. Now I start the
>Thread like this:
>
>getUpdateManager().getUpdateRunnableQueue().
>invokeLater(new PeriodMarker(elem, new MarkerImpl() , 5000));
>
>where PeriodMarker is a class implementing Runnable.
>
>The run-method in PeriodMarker looks like this:
>
>    marker.mark(elemToMark);
>    try {
>     // sleep
>     Thread.sleep(time);
>       }
>       catch (InterruptedException ex) {
>       }
>    marker.unmark(elemToMark);
>
>where marker modifies the according attributes.
>
>What happens is, if I comment the last line out, that after five seconds I
>can
>see the changes...
>
>Any suggestions what to do?
>
>
>Thanks,
>
>Christoph

_________________________________________________________________
Donít just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


---------------------------------------------------------------------
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