]> source.dussan.org Git - vaadin-framework.git/commitdiff
Run JavaScript RPC with this pointing to the connector wrapper (#9096)
authorLeif Åstrand <leif@vaadin.com>
Tue, 3 Jul 2012 10:27:47 +0000 (13:27 +0300)
committerLeif Åstrand <leif@vaadin.com>
Tue, 3 Jul 2012 10:27:47 +0000 (13:27 +0300)
src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java
tests/testbench/com/vaadin/tests/minitutorials/v7a3/complex_types_connector.js

index 86c11fd26d1359b2bedaacb12b273ea22c3478fe..2b88867cfe67d09776da10907cd31abe2d7d6b49 100644 (file)
@@ -331,9 +331,9 @@ public class JavaScriptConnectorHelper {
             invokeCallback(getConnectorWrapper(), callbackName, arguments);
         } else {
             JavaScriptObject arguments = parametersJson.getJavaScriptObject();
-            invokeJsRpc(rpcMap, iface, method, arguments);
+            invokeJsRpc(rpcMap, iface, method, arguments, getConnectorWrapper());
             // Also invoke wildcard interface
-            invokeJsRpc(rpcMap, "", method, arguments);
+            invokeJsRpc(rpcMap, "", method, arguments, getConnectorWrapper());
         }
     }
 
@@ -344,7 +344,8 @@ public class JavaScriptConnectorHelper {
     }-*/;
 
     private static native void invokeJsRpc(JavaScriptObject rpcMap,
-            String interfaceName, String methodName, JavaScriptObject parameters)
+            String interfaceName, String methodName,
+            JavaScriptObject parameters, JavaScriptObject connector)
     /*-{
         var targets = rpcMap[interfaceName];
         if (!targets) {
@@ -352,7 +353,7 @@ public class JavaScriptConnectorHelper {
         }
         for(var i = 0; i < targets.length; i++) {
             var target = targets[i];
-            target[methodName].apply(target, parameters);
+            target[methodName].apply(connector, parameters);
         }
     }-*/;
 
index 496afce432fc3ffd1e1f9d53dd177b262200da05..85dfb1369b034dd947d49ace3f970d10521dba52 100644 (file)
@@ -1,9 +1,8 @@
 window.com_vaadin_tests_minitutorials_v7a3_ComplexTypesComponent = function() {
-       var connectorId = this.getConnectorId();
-       var element = this.getElement();
-       
        this.registerRpc({
                sendComplexTypes: function(list, stringMap, otherMap, connectorMap, bits, matrix, bean) {
+                       var connectorId = this.getConnectorId();
+                       
                        var message = 'list[2]  = "' + list[2] + '"<br />';
                        message += 'stringMap.two = ' + stringMap.two + '<br />'; 
                        message += 'otherMap[1][1] = "' + otherMap[1][1] + '"<br />'; 
@@ -12,7 +11,7 @@ window.com_vaadin_tests_minitutorials_v7a3_ComplexTypesComponent = function() {
                        message += 'matrix[0][1] = ' + matrix[0][1] + '<br />'; 
                        message += 'bean.bean.integer = ' + bean.bean.integer + '<br />';
                        
-                       element.innerHTML = message;
+                       this.getElement().innerHTML = message;
                }
        });
 }
\ No newline at end of file