I am trying to set the state in a Vaadin custom widget from a click generated by the user. In the component connector after instantiating the server rpc I get the GWT button and add an onclick method. In the method I set the state (getState.text = "new text";) but when I try to get it from the server side I get the original state text. The onStateChange method is not triggered.
Code in the connector:
getWidget().getSaveButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
alert("does it work without jquery?");
getState().text = "text changed from connector";
getWidget().getTextBox().setText(getState().text);
}
});
after clicking GWT button the textbox contains the text to "text changed from connector"
In the state:
public String text = "original state text";
The UI implementation to get the state:
vaadinButton.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
Notification.show(sig.getState().text);
}
});
When clicking the vaadin button after clicking the GWT button the notification still displays "original state text".
My question: How do I change the state in the connector so it triggers the onStateChange method and I get the text changes server side?