Button.doClick() analogue in Vaadin

Dear Vaadin users,

I really miss the functionality which in Swing terms is
, which actually emulates the click on the button, e.g. notifies all listeners. Of course I can store the listeners somewhere separately in my code…

Does it make sense to have such helper function? Perhaps making
public is quickfix for that.

Here is a dirty one liner to get the job done without extending the button:

 button.changeVariables(button, Collections.singletonMap("state", (Object)true));

If you want a cleaner solution, then extending the Button and opening up the fireClick() would probably be it.

One thing to remember though is that if you are calling this from a server side thread you will need to push the changes to the client side as well.

Yes - we really should have Button.doClick() as outlined here:

Does the solution John gave work? If I remember correctly, this might throw NPE… See
for another example.