How to change css on "onclic" event, on client side

I would like to change the aspect of a clickable layout on “onclic” event before server response.

The addStyleName become later on my process because I’d like to change style of my component on javascript clic event.

The return of my clic event change all the content of the page but I want to notify visually user that he had clicked on the component before.

How can I do that stuff ?

Two ways.

You go into client side coding and extend a layout to add the onCick logic into your application. You have to get a little bit used with GWT to do it. There’s a chapter on that in the Book of Vaadin.

The other way is to do the heavy operations in a separate thread. When the server-heavy click arrives, you add the style name and create a new thread that does the things you do now on click. Then you need either a push mechanism (like IcePush add-on) or poller (like Refresher add-on) to check when the thread is ready and update the UI.