Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
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.
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.