thanks, I would not have come to that idea.

would that, from the implementation point of view, mean that i will
again have elements extending component with appropriate fields,
something like
- isChangable : boolean [if timeNow > timeStarted + timeToBlink]
- timeStarted : long
- timeToBlink : int [10 sec]
- isVisible : boolean
- leaveInVisibiliyState : boolean [to show/not to show the component
after it has gone through timeToBlink]

that the timer should access to determine if the visibility of the
component should be changed?

I know that js is single-threaded. Aren't though timers executed in a
separate threads? Are there implications of having 2 or more timers
running on a single page (since my application uses another timer to
get new/updated table rows from the server)?

thanks

On 17 Mrz., 13:56, Ben Tilford <bentilf...@gmail.com> wrote:
> You could do it with a single timer then have your blinking components
> listen for a tick event that the timer would fire.
>
> On Tue, Mar 17, 2009 at 8:52 AM, denis56 <denis.ergashb...@gmail.com> wrote:
>
> > His,
>
> > if anyone could share experience with achieving blinking behavior for
> > several items on a page?
>
> > in my case there is a table being shown whose rows should have
> > multiple blinking elements (labels and images). Each of the blinking
> > elements has -its own- timeout value defined to stop blinking.
>
> > The way I have achieved it now, is by creating a composite (see sample
> > code below) that takes an image/label and adds a timer to it.
>
> > I am afraid that that is not a right approach as the table is
> > constantly being updated to add/delete rows with new blinking
> > components. That would lead to multiple timers being instantiated and
> > started  with .scheduleRepeating(XXX); method again and again without
> > page being reloaded (the page should stay open for a day and display
> > changing information).
>
> > Could anyone comment on my approach: is it memory-leak and performance
> > degradation prone? What would be a feasible alternative? maybe using
> > external library like prototype?
>
> > Many thanks,
> > denis
>
> > public class BlinkingCorner extends Composite {
>
> >    private boolean visible;
> >    private int blinkingTime = 5000;
> >    private long timeBlinkingStarted;
>
> >    public BlinkingCorner(final Image img) {
> >        timeBlinkingStarted = System.currentTimeMillis();
> >        new Timer() {
> >           �...@override
> >            public void run() {
> >                if (System.currentTimeMillis() <= timeBlinkingStarted
> >                        + blinkingTime) {
> >                    img.setVisible(visible);
> >                    GWT.log("visible=" + visible, null);
> >                    visible = !visible;
> >                } else {
> >                    GWT.log("cancel", null);
> >                    img.setVisible(false);
> >                    cancel();
> >                }
> >            }
> >        }.scheduleRepeating(500);
>
> >        initWidget(img);
> >    }
>
> > }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to