From: Leif Åstrand Date: Tue, 3 Jul 2012 10:27:47 +0000 (+0300) Subject: Run JavaScript RPC with this pointing to the connector wrapper (#9096) X-Git-Tag: 7.0.0.beta1~236^2~57 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab2846641bff895b9e82bfd8068c720e8132e297;p=vaadin-framework.git Run JavaScript RPC with this pointing to the connector wrapper (#9096) --- diff --git a/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java b/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java index 86c11fd26d..2b88867cfe 100644 --- a/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java +++ b/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java @@ -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); } }-*/; diff --git a/tests/testbench/com/vaadin/tests/minitutorials/v7a3/complex_types_connector.js b/tests/testbench/com/vaadin/tests/minitutorials/v7a3/complex_types_connector.js index 496afce432..85dfb1369b 100644 --- a/tests/testbench/com/vaadin/tests/minitutorials/v7a3/complex_types_connector.js +++ b/tests/testbench/com/vaadin/tests/minitutorials/v7a3/complex_types_connector.js @@ -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] + '"
'; message += 'stringMap.two = ' + stringMap.two + '
'; message += 'otherMap[1][1] = "' + otherMap[1][1] + '"
'; @@ -12,7 +11,7 @@ window.com_vaadin_tests_minitutorials_v7a3_ComplexTypesComponent = function() { message += 'matrix[0][1] = ' + matrix[0][1] + '
'; message += 'bean.bean.integer = ' + bean.bean.integer + '
'; - element.innerHTML = message; + this.getElement().innerHTML = message; } }); } \ No newline at end of file