Add/Remove style in thread

I am attempting to create a method that will spawn a new thread, add a style that will cause a div to blink for a certain number of seconds, then remove the style to stop the blinking. It currently adds the style but does not remove the style. I was wondering if this has to do with being in a thread and if a paint has to be forced? The code I am using is below.



I would maybe do something like use
to run a script that waits using
finds the elements with that class name with
in the callback parameter of setTimeout and then removes the class from those elements. You could get that same effect from server side using
Server Push
, but given that it’s only a cosmetic change, Push is probably overkill.

Best regards,
Olli Tietäväinen

As a temporary fix I ended up passing the UI to the class an running the UI.access method to update it after the time interval expired. Probably a better way to do it and JavaScrpt might be the answer. Thanks.

Yeah, since Vaadin 7.1,
UI.access() uses Server Push to move the changes to the client
, as long as the PushMode of the UI is AUTOMATIC (which it is by default). Push uses
Web Sockets
for transport by default if the browser supports them, or a fallback method if it doesn’t. Most of the time these should work fine, but if they for some reason don’t, debugging that can be a bit tricky if you don’t know where to look.

Good luck!