]> source.dussan.org Git - vaadin-framework.git/commitdiff
Update mini tutorial code to use @OnStateChange
authorLeif Åstrand <leif@vaadin.com>
Thu, 15 May 2014 11:21:04 +0000 (14:21 +0300)
committerVaadin Code Review <review@vaadin.com>
Thu, 22 May 2014 08:49:21 +0000 (08:49 +0000)
Change-Id: I509213ade4ed9765db8a7773c42051f8f182b272

uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a2/MyComponentConnector.java

index 3b599bc668f627286f506fecbcad459960a564b7..36c54c8ee61a1465836c452034f8c680dc221f47 100644 (file)
@@ -4,8 +4,8 @@ import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.Window;
 import com.vaadin.client.MouseEventDetailsBuilder;
+import com.vaadin.client.annotations.OnStateChange;
 import com.vaadin.client.communication.RpcProxy;
-import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractComponentConnector;
 import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.Connect;
@@ -42,12 +42,9 @@ public class MyComponentConnector extends AbstractComponentConnector {
         return (MyComponentState) super.getState();
     }
 
-    @Override
-    public void onStateChanged(StateChangeEvent stateChangeEvent) {
-        super.onStateChanged(stateChangeEvent);
-
-        final String text = getState().text;
-        getWidget().setText(text);
+    @OnStateChange("text")
+    void updateText() {
+        getWidget().setText(getState().text);
     }
 
     @Override