]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added AbstractConnector.getRpcProxy helper (#10143) 17/217/3
authorArtur Signell <artur@vaadin.com>
Tue, 6 Nov 2012 15:51:39 +0000 (17:51 +0200)
committerVaadin Code Review <review@vaadin.com>
Wed, 7 Nov 2012 12:40:32 +0000 (12:40 +0000)
Change-Id: I52ca9908763cc7416a2c50971252429cd8c294e8

19 files changed:
client/src/com/vaadin/client/ui/AbstractConnector.java
client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java
client/src/com/vaadin/client/ui/button/ButtonConnector.java
client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
client/src/com/vaadin/client/ui/csslayout/CssLayoutConnector.java
client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java
client/src/com/vaadin/client/ui/gridlayout/GridLayoutConnector.java
client/src/com/vaadin/client/ui/image/ImageConnector.java
client/src/com/vaadin/client/ui/nativebutton/NativeButtonConnector.java
client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
client/src/com/vaadin/client/ui/panel/PanelConnector.java
client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
client/src/com/vaadin/client/ui/splitpanel/AbstractSplitPanelConnector.java
client/src/com/vaadin/client/ui/ui/UIConnector.java
client/src/com/vaadin/client/ui/window/WindowConnector.java
uitest/src/com/vaadin/tests/widgetset/client/SerializerTestConnector.java
uitest/src/com/vaadin/tests/widgetset/client/helloworldfeature/HelloWorldExtensionConnector.java
uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7a3/RefresherConnector.java
uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v7b1/CapsLockWarningWithRpcConnector.java

index d0bba797e2376e46bdfb93e24e5e15ead1390732..aac9b76d59257897e3f5fcde37340c8dd0174f0d 100644 (file)
@@ -29,12 +29,14 @@ import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.ServerConnector;
 import com.vaadin.client.Util;
 import com.vaadin.client.VConsole;
+import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
 import com.vaadin.client.metadata.NoDataException;
 import com.vaadin.client.metadata.Type;
 import com.vaadin.client.metadata.TypeData;
 import com.vaadin.shared.communication.ClientRpc;
+import com.vaadin.shared.communication.ServerRpc;
 import com.vaadin.shared.communication.SharedState;
 import com.vaadin.shared.communication.URLReference;
 
@@ -59,6 +61,12 @@ public abstract class AbstractConnector implements ServerConnector,
     private SharedState state;
     private ServerConnector parent;
 
+    /**
+     * A map from client-to-server RPC interface class to the RPC proxy that
+     * sends outgoing RPC calls for that interface.
+     */
+    private Map<Class<?>, ServerRpc> rpcProxyMap = new HashMap<Class<?>, ServerRpc>();
+
     /**
      * Temporary storage for last enabled state to be able to see if it has
      * changed. Can be removed once we are able to listen specifically for
@@ -159,6 +167,24 @@ public abstract class AbstractConnector implements ServerConnector,
         }
     }
 
+    /**
+     * Returns an RPC proxy object which can be used to invoke the RPC method on
+     * the server.
+     * 
+     * @param <T>
+     *            The type of the ServerRpc interface
+     * @param rpcInterface
+     *            The ServerRpc interface to retrieve a proxy object for
+     * @return A proxy object which can be used to invoke the RPC method on the
+     *         server.
+     */
+    public <T extends ServerRpc> T getRpcProxy(Class<T> rpcInterface) {
+        if (!rpcProxyMap.containsKey(rpcInterface)) {
+            rpcProxyMap.put(rpcInterface, RpcProxy.create(rpcInterface, this));
+        }
+        return (T) rpcProxyMap.get(rpcInterface);
+    }
+
     @Override
     public <T extends ClientRpc> Collection<T> getRpcImplementations(
             String rpcInterfaceId) {
index e4b2440ef7e5893573d570f65dfdcdd50aa089eb..106aee7ace395a31fac1e42972c362fe62f7ede2 100644 (file)
@@ -23,7 +23,6 @@ import com.vaadin.client.ConnectorHierarchyChangeEvent;
 import com.vaadin.client.DirectionalManagedLayout;
 import com.vaadin.client.Util;
 import com.vaadin.client.VCaption;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
 import com.vaadin.client.ui.AbstractComponentContainerConnector;
@@ -52,7 +51,7 @@ public class AbsoluteLayoutConnector extends
 
         @Override
         protected LayoutClickRpc getLayoutClickRPC() {
-            return rpc;
+            return getRpcProxy(AbsoluteLayoutServerRpc.class);
         };
     };
 
@@ -72,8 +71,6 @@ public class AbsoluteLayoutConnector extends
         }
     };
 
-    private AbsoluteLayoutServerRpc rpc;
-
     /*
      * (non-Javadoc)
      * 
@@ -82,7 +79,6 @@ public class AbsoluteLayoutConnector extends
     @Override
     protected void init() {
         super.init();
-        rpc = RpcProxy.create(AbsoluteLayoutServerRpc.class, this);
     }
 
     /**
index c3aa66b285e6d2cb9f46d0241e04f36ced29e4fa..bc1e7b0e69dc5fbf07016a5e2917bbac2c0080b0 100644 (file)
@@ -28,7 +28,6 @@ import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.DOM;
 import com.vaadin.client.EventHelper;
 import com.vaadin.client.MouseEventDetailsBuilder;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
 import com.vaadin.client.ui.AbstractComponentConnector;
@@ -47,10 +46,6 @@ import com.vaadin.ui.Button;
 public class ButtonConnector extends AbstractComponentConnector implements
         BlurHandler, FocusHandler, ClickHandler, ShortcutActionTarget {
 
-    private ButtonServerRpc rpc = RpcProxy.create(ButtonServerRpc.class, this);
-    private FocusAndBlurServerRpc focusBlurProxy = RpcProxy.create(
-            FocusAndBlurServerRpc.class, this);
-
     private HandlerRegistration focusHandlerRegistration = null;
     private HandlerRegistration blurHandlerRegistration = null;
 
@@ -143,14 +138,14 @@ public class ButtonConnector extends AbstractComponentConnector implements
     public void onFocus(FocusEvent event) {
         // EventHelper.updateFocusHandler ensures that this is called only when
         // there is a listener on server side
-        focusBlurProxy.focus();
+        getRpcProxy(FocusAndBlurServerRpc.class).focus();
     }
 
     @Override
     public void onBlur(BlurEvent event) {
         // EventHelper.updateFocusHandler ensures that this is called only when
         // there is a listener on server side
-        focusBlurProxy.blur();
+        getRpcProxy(FocusAndBlurServerRpc.class).blur();
     }
 
     @Override
@@ -163,14 +158,14 @@ public class ButtonConnector extends AbstractComponentConnector implements
             // generally supported.
             getState().enabled = false;
             super.updateEnabledState(false);
-            rpc.disableOnClick();
+            getRpcProxy(ButtonServerRpc.class).disableOnClick();
         }
 
         // Add mouse details
         MouseEventDetails details = MouseEventDetailsBuilder
                 .buildMouseEventDetails(event.getNativeEvent(), getWidget()
                         .getElement());
-        rpc.click(details);
+        getRpcProxy(ButtonServerRpc.class).click(details);
 
     }
 
index 35816039dabe9dfbe80b7ff5f9eb090664f14f05..cf771bed0d923bdae1ddce57d47859dd49c8cec7 100644 (file)
@@ -27,7 +27,6 @@ import com.google.gwt.user.client.Event;
 import com.vaadin.client.EventHelper;
 import com.vaadin.client.MouseEventDetailsBuilder;
 import com.vaadin.client.VTooltip;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractFieldConnector;
 import com.vaadin.client.ui.Icon;
@@ -45,11 +44,6 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
     private HandlerRegistration focusHandlerRegistration;
     private HandlerRegistration blurHandlerRegistration;
 
-    private CheckBoxServerRpc rpc = RpcProxy.create(CheckBoxServerRpc.class,
-            this);
-    private FocusAndBlurServerRpc focusBlurRpc = RpcProxy.create(
-            FocusAndBlurServerRpc.class, this);
-
     @Override
     public boolean delegateCaptionHandling() {
         return false;
@@ -132,14 +126,14 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
     public void onFocus(FocusEvent event) {
         // EventHelper.updateFocusHandler ensures that this is called only when
         // there is a listener on server side
-        focusBlurRpc.focus();
+        getRpcProxy(FocusAndBlurServerRpc.class).focus();
     }
 
     @Override
     public void onBlur(BlurEvent event) {
         // EventHelper.updateFocusHandler ensures that this is called only when
         // there is a listener on server side
-        focusBlurRpc.blur();
+        getRpcProxy(FocusAndBlurServerRpc.class).blur();
     }
 
     @Override
@@ -152,7 +146,8 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
         MouseEventDetails details = MouseEventDetailsBuilder
                 .buildMouseEventDetails(event.getNativeEvent(), getWidget()
                         .getElement());
-        rpc.setChecked(getWidget().getValue(), details);
+        getRpcProxy(CheckBoxServerRpc.class).setChecked(getWidget().getValue(),
+                details);
 
     }
 }
index cfdda3dd1c7b4f9f7fb1ff51a786133a09cce5a7..1a83ae90b40f49f886a5237c10cfe0b64a1f7f0b 100644 (file)
@@ -26,7 +26,6 @@ import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.ConnectorHierarchyChangeEvent;
 import com.vaadin.client.Util;
 import com.vaadin.client.VCaption;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractLayoutConnector;
 import com.vaadin.client.ui.LayoutClickEventHandler;
@@ -54,12 +53,10 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
 
         @Override
         protected LayoutClickRpc getLayoutClickRPC() {
-            return rpc;
+            return getRpcProxy(CssLayoutServerRpc.class);
         };
     };
 
-    private CssLayoutServerRpc rpc;
-
     private Map<ComponentConnector, VCaption> childToCaption = new HashMap<ComponentConnector, VCaption>();
 
     /*
@@ -70,7 +67,6 @@ public class CssLayoutConnector extends AbstractLayoutConnector {
     @Override
     protected void init() {
         super.init();
-        rpc = RpcProxy.create(CssLayoutServerRpc.class, this);
     }
 
     /*
index 1b56a56fe86dee016d27ce7a0cfd315ccba33b5a..a15803beb775aab17a1c830b370f61d83e5eb1a8 100644 (file)
@@ -32,7 +32,6 @@ import com.vaadin.client.Paintable;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.VConsole;
 import com.vaadin.client.VTooltip;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.ui.AbstractComponentConnector;
 import com.vaadin.client.ui.ClickEventHandler;
 import com.vaadin.shared.MouseEventDetails;
@@ -46,12 +45,9 @@ import com.vaadin.ui.Embedded;
 public class EmbeddedConnector extends AbstractComponentConnector implements
         Paintable {
 
-    EmbeddedServerRpc rpc;
-
     @Override
     protected void init() {
         super.init();
-        rpc = RpcProxy.create(EmbeddedServerRpc.class, this);
     }
 
     @Override
@@ -233,7 +229,7 @@ public class EmbeddedConnector extends AbstractComponentConnector implements
         @Override
         protected void fireClick(NativeEvent event,
                 MouseEventDetails mouseDetails) {
-            rpc.click(mouseDetails);
+            getRpcProxy(EmbeddedServerRpc.class).click(mouseDetails);
         }
 
     };
index d235413d8cc8e34311044de5e1a6f9d7c33722c1..1dfeadc1ffb31c1419c9d9581e1a6f61df682aca 100644 (file)
@@ -27,7 +27,6 @@ import com.vaadin.client.DirectionalManagedLayout;
 import com.vaadin.client.Paintable;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.VCaption;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractComponentContainerConnector;
 import com.vaadin.client.ui.LayoutClickEventHandler;
@@ -55,18 +54,16 @@ public class GridLayoutConnector extends AbstractComponentContainerConnector
 
         @Override
         protected LayoutClickRpc getLayoutClickRPC() {
-            return rpc;
+            return getRpcProxy(GridLayoutServerRpc.class);
         };
 
     };
 
-    private GridLayoutServerRpc rpc;
     private boolean needCaptionUpdate = false;
 
     @Override
     public void init() {
         super.init();
-        rpc = RpcProxy.create(GridLayoutServerRpc.class, this);
         getLayoutManager().registerDependency(this,
                 getWidget().spacingMeasureElement);
     }
index 17ce058c5de517ed769e7f4849a16b9398ebf04b..e3fdd74aabe5917442c84e43e203ad2561749950 100644 (file)
@@ -3,7 +3,6 @@ package com.vaadin.client.ui.image;
 import com.google.gwt.dom.client.NativeEvent;
 import com.google.gwt.event.dom.client.LoadEvent;
 import com.google.gwt.event.dom.client.LoadHandler;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractComponentConnector;
 import com.vaadin.client.ui.ClickEventHandler;
@@ -16,12 +15,9 @@ import com.vaadin.shared.ui.image.ImageState;
 @Connect(com.vaadin.ui.Image.class)
 public class ImageConnector extends AbstractComponentConnector {
 
-    ImageServerRpc rpc;
-
     @Override
     protected void init() {
         super.init();
-        rpc = RpcProxy.create(ImageServerRpc.class, this);
         getWidget().addHandler(new LoadHandler() {
 
             @Override
@@ -62,7 +58,7 @@ public class ImageConnector extends AbstractComponentConnector {
         @Override
         protected void fireClick(NativeEvent event,
                 MouseEventDetails mouseDetails) {
-            rpc.click(mouseDetails);
+            getRpcProxy(ImageServerRpc.class).click(mouseDetails);
         }
 
     };
index 6bcb2c8cbfbd85bb262b725b382bde4df1a7117c..fa523e65c59723ceeaa6e2f2aab6c9d3b454ffc3 100644 (file)
@@ -22,7 +22,6 @@ import com.google.gwt.event.dom.client.FocusHandler;
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.DOM;
 import com.vaadin.client.EventHelper;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractComponentConnector;
 import com.vaadin.client.ui.Icon;
@@ -39,15 +38,11 @@ public class NativeButtonConnector extends AbstractComponentConnector implements
     private HandlerRegistration focusHandlerRegistration;
     private HandlerRegistration blurHandlerRegistration;
 
-    private FocusAndBlurServerRpc focusBlurRpc = RpcProxy.create(
-            FocusAndBlurServerRpc.class, this);
-
     @Override
     public void init() {
         super.init();
 
-        getWidget().buttonRpcProxy = RpcProxy.create(ButtonServerRpc.class,
-                this);
+        getWidget().buttonRpcProxy = getRpcProxy(ButtonServerRpc.class);
         getWidget().client = getConnection();
         getWidget().paintableId = getConnectorId();
     }
@@ -123,14 +118,14 @@ public class NativeButtonConnector extends AbstractComponentConnector implements
     public void onFocus(FocusEvent event) {
         // EventHelper.updateFocusHandler ensures that this is called only when
         // there is a listener on server side
-        focusBlurRpc.focus();
+        getRpcProxy(FocusAndBlurServerRpc.class).focus();
     }
 
     @Override
     public void onBlur(BlurEvent event) {
         // EventHelper.updateFocusHandler ensures that this is called only when
         // there is a listener on server side
-        focusBlurRpc.blur();
+        getRpcProxy(FocusAndBlurServerRpc.class).blur();
     }
 
 }
index 8fb9f8c0e8df37dec329a7f6e938a2541f69bcbd..3b72af966b4716c62527d8cd97c25a286bfefbd9 100644 (file)
@@ -24,7 +24,6 @@ import com.google.gwt.user.client.Element;
 import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.ConnectorHierarchyChangeEvent;
 import com.vaadin.client.Util;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
 import com.vaadin.client.ui.AbstractFieldConnector;
@@ -49,8 +48,6 @@ import com.vaadin.shared.ui.orderedlayout.AbstractOrderedLayoutState;
 public abstract class AbstractOrderedLayoutConnector extends
         AbstractLayoutConnector {
 
-    AbstractOrderedLayoutServerRpc rpc;
-
     /*
      * Handlers & Listeners
      */
@@ -66,7 +63,7 @@ public abstract class AbstractOrderedLayoutConnector extends
 
         @Override
         protected LayoutClickRpc getLayoutClickRPC() {
-            return rpc;
+            return getRpcProxy(AbstractOrderedLayoutServerRpc.class);
         };
     };
 
@@ -182,7 +179,6 @@ public abstract class AbstractOrderedLayoutConnector extends
     @Override
     public void init() {
         super.init();
-        rpc = RpcProxy.create(AbstractOrderedLayoutServerRpc.class, this);
         getWidget().setLayoutManager(getLayoutManager());
     }
 
index 695e06e0f2c3b85e19a9ec3ded3a9556c8a73bf1..679a04651869af4b275c1995ed623c7f5d69e644 100644 (file)
@@ -25,7 +25,6 @@ import com.vaadin.client.ConnectorHierarchyChangeEvent;
 import com.vaadin.client.LayoutManager;
 import com.vaadin.client.Paintable;
 import com.vaadin.client.UIDL;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.ui.AbstractComponentContainerConnector;
 import com.vaadin.client.ui.ClickEventHandler;
 import com.vaadin.client.ui.PostLayoutListener;
@@ -51,18 +50,15 @@ public class PanelConnector extends AbstractComponentContainerConnector
         @Override
         protected void fireClick(NativeEvent event,
                 MouseEventDetails mouseDetails) {
-            rpc.click(mouseDetails);
+            getRpcProxy(PanelServerRpc.class).click(mouseDetails);
         }
     };
 
     private Integer uidlScrollLeft;
 
-    private PanelServerRpc rpc;
-
     @Override
     public void init() {
         super.init();
-        rpc = RpcProxy.create(PanelServerRpc.class, this);
         VPanel panel = getWidget();
         LayoutManager layoutManager = getLayoutManager();
 
index a92fea55f94b638a30c97f82d744ec60894edd85..6e7a556629c8c5da6692fae247e3eef69311bc98 100644 (file)
@@ -17,7 +17,6 @@
 package com.vaadin.client.ui.progressindicator;
 
 import com.google.gwt.user.client.Timer;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractFieldConnector;
 import com.vaadin.shared.ui.Connect;
@@ -33,14 +32,11 @@ public class ProgressIndicatorConnector extends AbstractFieldConnector {
         return (ProgressIndicatorState) super.getState();
     }
 
-    ProgressIndicatorServerRpc rpc = RpcProxy.create(
-            ProgressIndicatorServerRpc.class, this);
-
     private Timer poller = new Timer() {
 
         @Override
         public void run() {
-            rpc.poll();
+            getRpcProxy(ProgressIndicatorServerRpc.class).poll();
         }
 
     };
index 501752ed1800c0b905056a4748beddecf159b1cd..a4aac4fea3c8903fd22d5622da8ee234cd3a57c6 100644 (file)
@@ -29,7 +29,6 @@ import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.ConnectorHierarchyChangeEvent;
 import com.vaadin.client.LayoutManager;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractComponentContainerConnector;
 import com.vaadin.client.ui.ClickEventHandler;
@@ -45,12 +44,9 @@ import com.vaadin.shared.ui.splitpanel.AbstractSplitPanelState.SplitterState;
 public abstract class AbstractSplitPanelConnector extends
         AbstractComponentContainerConnector implements SimpleManagedLayout {
 
-    private AbstractSplitPanelRpc rpc;
-
     @Override
     protected void init() {
         super.init();
-        rpc = RpcProxy.create(AbstractSplitPanelRpc.class, this);
         // TODO Remove
         getWidget().client = getConnection();
 
@@ -71,7 +67,8 @@ public abstract class AbstractSplitPanelConnector extends
                             position.length() - 2));
                 }
 
-                rpc.setSplitterPosition(pos);
+                getRpcProxy(AbstractSplitPanelRpc.class).setSplitterPosition(
+                        pos);
             }
 
         }, SplitterMoveEvent.TYPE);
@@ -115,7 +112,8 @@ public abstract class AbstractSplitPanelConnector extends
         @Override
         protected void fireClick(NativeEvent event,
                 MouseEventDetails mouseDetails) {
-            rpc.splitterClick(mouseDetails);
+            getRpcProxy(AbstractSplitPanelRpc.class)
+                    .splitterClick(mouseDetails);
         }
 
     };
index f2c54c0a21da7ef8370f3bc0e85012b7f8baf8b8..e4da9afb241a426d7ec1ad67050de695d00e9312 100644 (file)
@@ -42,7 +42,6 @@ import com.vaadin.client.Focusable;
 import com.vaadin.client.Paintable;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.VConsole;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
 import com.vaadin.client.ui.AbstractComponentContainerConnector;
@@ -65,8 +64,6 @@ import com.vaadin.ui.UI;
 public class UIConnector extends AbstractComponentContainerConnector implements
         Paintable, MayScrollChildren {
 
-    private UIServerRpc rpc = RpcProxy.create(UIServerRpc.class, this);
-
     private HandlerRegistration childStateChangeHandlerRegistration;
 
     private final StateChangeHandler childStateChangeHandler = new StateChangeHandler() {
@@ -90,8 +87,9 @@ public class UIConnector extends AbstractComponentContainerConnector implements
         getWidget().addResizeHandler(new ResizeHandler() {
             @Override
             public void onResize(ResizeEvent event) {
-                rpc.resize(event.getHeight(), event.getWidth(),
-                        Window.getClientWidth(), Window.getClientHeight());
+                getRpcProxy(UIServerRpc.class).resize(event.getHeight(),
+                        event.getWidth(), Window.getClientWidth(),
+                        Window.getClientHeight());
                 if (getState().immediate) {
                     getConnection().sendPendingVariableChanges();
                 }
@@ -322,7 +320,7 @@ public class UIConnector extends AbstractComponentContainerConnector implements
         @Override
         protected void fireClick(NativeEvent event,
                 MouseEventDetails mouseDetails) {
-            rpc.click(mouseDetails);
+            getRpcProxy(UIServerRpc.class).click(mouseDetails);
         }
 
     };
index 3091ab82d0c1f6cd9bb6dcc76f1a56e14ebb4c8d..6b1f4b9697693acfeda3cc9787b1fecf93c34ca3 100644 (file)
@@ -31,7 +31,6 @@ import com.vaadin.client.ConnectorHierarchyChangeEvent;
 import com.vaadin.client.LayoutManager;
 import com.vaadin.client.Paintable;
 import com.vaadin.client.UIDL;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.ui.AbstractComponentContainerConnector;
 import com.vaadin.client.ui.ClickEventHandler;
 import com.vaadin.client.ui.PostLayoutListener;
@@ -53,12 +52,10 @@ public class WindowConnector extends AbstractComponentContainerConnector
         @Override
         protected void fireClick(NativeEvent event,
                 MouseEventDetails mouseDetails) {
-            rpc.click(mouseDetails);
+            getRpcProxy(WindowServerRpc.class).click(mouseDetails);
         }
     };
 
-    private WindowServerRpc rpc;
-
     boolean minWidthChecked = false;
 
     @Override
@@ -69,7 +66,6 @@ public class WindowConnector extends AbstractComponentContainerConnector
     @Override
     protected void init() {
         super.init();
-        rpc = RpcProxy.create(WindowServerRpc.class, this);
 
         getLayoutManager().registerDependency(this,
                 getWidget().contentPanel.getElement());
index 7783178a3beb4f58cf879a606fde0ebce64b06cb..6822edb34cb6f583dbe4f7938c8c8ec5202650d8 100644 (file)
@@ -26,7 +26,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.shared.Connector;
@@ -37,8 +36,7 @@ import com.vaadin.tests.widgetset.server.SerializerTestExtension;
 @Connect(SerializerTestExtension.class)
 public class SerializerTestConnector extends AbstractExtensionConnector {
 
-    private SerializerTestRpc rpc = RpcProxy.create(SerializerTestRpc.class,
-            this);
+    private SerializerTestRpc rpc = getRpcProxy(SerializerTestRpc.class);
 
     public SerializerTestConnector() {
         registerRpc(SerializerTestRpc.class, new SerializerTestRpc() {
index 76dbdd5370334befddb81281071431d21370c3ab..a0a6911eb20887d4c6f307c42092d3ea13b42e09 100644 (file)
@@ -19,14 +19,12 @@ import com.google.gwt.user.client.Window;
 import com.vaadin.client.ServerConnector;
 import com.vaadin.client.Util;
 import com.vaadin.client.VConsole;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.tests.extensions.HelloWorldExtension;
 
 @Connect(HelloWorldExtension.class)
 public class HelloWorldExtensionConnector extends AbstractExtensionConnector {
-    HelloWorldRpc rpc = RpcProxy.create(HelloWorldRpc.class, this);
 
     @Override
     public HelloWorldState getState() {
@@ -56,6 +54,6 @@ public class HelloWorldExtensionConnector extends AbstractExtensionConnector {
         VConsole.log(msg);
 
         String response = Window.prompt(msg, "");
-        rpc.onMessageSent(response);
+        getRpcProxy(HelloWorldRpc.class).onMessageSent(response);
     }
 }
index 26fa22a66786e2b5ff6b26e89a7e3a4c64400fde..2deef7e1bad2a9234cdc32c9cfcb3fec39ca47ea 100644 (file)
@@ -1,7 +1,6 @@
 package com.vaadin.tests.widgetset.client.minitutorials.v7a3;
 
 import com.google.gwt.user.client.Timer;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.shared.ui.Connect;
@@ -10,12 +9,10 @@ import com.vaadin.tests.minitutorials.v7a3.Refresher;
 @Connect(Refresher.class)
 public class RefresherConnector extends AbstractExtensionConnector {
 
-    private RefresherRpc rpc = RpcProxy.create(RefresherRpc.class, this);
-
     private Timer timer = new Timer() {
         @Override
         public void run() {
-            rpc.refresh();
+            getRpcProxy(RefresherRpc.class).refresh();
         }
     };
 
index b7dead981905aa6d798f659f94244a29bc1fd337..c587f539682d77a5755c32d3817de62eeb032679 100644 (file)
@@ -6,7 +6,6 @@ import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.ServerConnector;
-import com.vaadin.client.communication.RpcProxy;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.client.ui.VOverlay;
 import com.vaadin.shared.ui.Connect;
@@ -15,8 +14,7 @@ import com.vaadin.tests.minitutorials.v7b1.CapsLockWarningWithRpc;
 @Connect(CapsLockWarningWithRpc.class)
 public class CapsLockWarningWithRpcConnector extends AbstractExtensionConnector {
 
-    private CapsLockWarningRpc rpc = RpcProxy.create(CapsLockWarningRpc.class,
-            this);
+    private CapsLockWarningRpc rpc = getRpcProxy(CapsLockWarningRpc.class);
 
     @Override
     protected void extend(ServerConnector target) {