Hi all.
I have a server/client online app/applet development.
To simplify my problem, the client get 2 commands from the server, one right after the other.
The 1st one is dispatched to a Timer to do a particular animation. The next is handled on the EDT.
Because the animation takes longer than the time difference between getting the 1st and 2nd commands, the 2nd command gets done way before the animation is over. However, I want the response from the 2nd command to begin ONLY when the animation is over.
I tried synchronizing the Timer but of course it only atomizes each call, in between which, the EDT does stuff from the 1st command response anyway.
(I could be wrong about this).
I prefer not to use delays as it would differ between machines.
I don't want to have the server wait till it gets an "endAnimation" signal from the client because EACH CLIENT MAY END AT A DIFFERENT TIME.
So it must be handled within each client independently.
Actually, there are many commands that the server sends right after the "doAnimation" one. By the time the animation is done, all the other command have already been done and were never seen, or they all appear at their end stages
(the server uses delays to space the sending of the commands after the animation command to slow down the appearance of these onscreen objects on the client-side. This is nullified as they all happen in the background while the animation was doing its thing).
I realize that this all sounds very complicated and that I may not be explaining myself properly.
So in a nutshell:
- [SERVER]->doAnimation_________[CLIENT] startAnimation
- [SERVER]->showScreenWidget1___[CLIENT] still doing animation
- [SERVER]Pause_________________[CLIENT] still doing animation
- [SERVER]->showScreenWidget2___[CLIENT] still doing animation
- [SERVER]Pause_________________[CLIENT] still doing animation
- [SERVER]->showScreenWidget3___[CLIENT] still doing animation
[CLIENT] done doing animation
[CLIENT] show all screen widgets at once
I realize also as I write this that whatever solution I use, the delays on the server side would become mute points so I'll have to find another way to pause between screen widgets. The priority, however, is to have the rest of the screen updates wait till the animation is over.
Any help would be appreciated.
Thank you.