You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Piyush Rai <ra...@yahoo.com> on 2004/07/07 16:40:35 UTC

invokeLater/invokeAndWait

Hi,
I have an SVG file containing some slides. Each slide
is defined as a group having an image and some marking
annotations defined by path elements. I want to show
these slides images and annotations one by one at
predefined timings on a JSVGCanvas. I tried something
like this:
for(int i=0;i<numberOfSlides;i++)
{
//Get the slide with index 'i'
//Wait till the slide begin time
//Get all the annotation paths in this slide
				
canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
Runnable()
{ public void run(){
	window.setInterval(new Animation(), 20);
}
}

The "Animation" routine is supposed to make some
changes in the path elements and show the updated
paths on the corresponding slide. However, when I try
running this code, all I can see is the last slide
only. Rest of the slides are not shown(perhaps because
invokeLater returns immediatedy and hence any changes
in previous slides do not take place at all. I tried
invokeAndWait also but in that case I can't see even
the last slide. Perhaps, in this case, one thread
keeps hold of the lock and other threads don't get
access to it.

Could someone please help me out?
Thanks,
--Piyush.


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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


Re: invokeLater/invokeAndWait

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Piyush,

    A common problem is that when modifying the document through
Java, Batik may consider the document to be static.  So you need
to set the canvas to 'ALWAYS_DYNAMIC' before loading the document.

    Also it isn't clear to me from the code below if you are
actually 'waiting' anywhere (you mention it in the comment
but I don't know if the comment is referring to the 'setInterval'
thingy or not).

    On the topic of the setInterval thingy, the code looks very
strange to me.  The code will currently trigger the Animation
callback every 20ms.

Piyush Rai wrote:
> Hi,
> I have an SVG file containing some slides. Each slide
> is defined as a group having an image and some marking
> annotations defined by path elements. I want to show
> these slides images and annotations one by one at
> predefined timings on a JSVGCanvas. I tried something
> like this:
> for(int i=0;i<numberOfSlides;i++)
> {
> //Get the slide with index 'i'
> //Wait till the slide begin time
> //Get all the annotation paths in this slide
> 				
> canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
> Runnable()
> { public void run(){
> 	window.setInterval(new Animation(), 20);
> }
> }
> 
> The "Animation" routine is supposed to make some
> changes in the path elements and show the updated
> paths on the corresponding slide. However, when I try
> running this code, all I can see is the last slide
> only. Rest of the slides are not shown(perhaps because
> invokeLater returns immediatedy and hence any changes
> in previous slides do not take place at all. I tried
> invokeAndWait also but in that case I can't see even
> the last slide. Perhaps, in this case, one thread
> keeps hold of the lock and other threads don't get
> access to it.
> 
> Could someone please help me out?
> Thanks,
> --Piyush.
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org


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