summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-12-19 14:33:42 +0200
committerVaadin Code Review <review@vaadin.com>2012-12-19 12:59:40 +0000
commit098eec1de7e5ba630ba3d16efd42081c006a66f5 (patch)
treed4b124e7008d9f99edea3e23a5a88d338ffe6dbe /client
parent8a264ec4052cbee467269824e6e9e7c76efd1d07 (diff)
downloadvaadin-framework-098eec1de7e5ba630ba3d16efd42081c006a66f5.tar.gz
vaadin-framework-098eec1de7e5ba630ba3d16efd42081c006a66f5.zip
Use JavaScriptMethodInvocation to detect js invocations (#10549)
Change-Id: Ib5c1f5c55f101ef51418b44dcfc9b4278f3ec313
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java5
-rw-r--r--client/src/com/vaadin/client/JavaScriptConnectorHelper.java7
-rw-r--r--client/src/com/vaadin/client/communication/JavaScriptMethodInvocation.java34
-rw-r--r--client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java4
4 files changed, 42 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 4a625383a5..63dfde795b 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -65,6 +65,7 @@ import com.vaadin.client.ApplicationConfiguration.ErrorMessage;
import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
import com.vaadin.client.ResourceLoader.ResourceLoadListener;
import com.vaadin.client.communication.HasJavaScriptConnectorHelper;
+import com.vaadin.client.communication.JavaScriptMethodInvocation;
import com.vaadin.client.communication.JsonDecoder;
import com.vaadin.client.communication.JsonEncoder;
import com.vaadin.client.communication.RpcManager;
@@ -2459,9 +2460,7 @@ public class ApplicationConnection {
}
private boolean isJavascriptRpc(MethodInvocation invocation) {
- String connectorId = invocation.getConnectorId();
- ServerConnector connector = connectorMap.getConnector(connectorId);
- return connector instanceof HasJavaScriptConnectorHelper;
+ return invocation instanceof JavaScriptMethodInvocation;
}
private boolean isLegacyVariableChange(MethodInvocation invocation) {
diff --git a/client/src/com/vaadin/client/JavaScriptConnectorHelper.java b/client/src/com/vaadin/client/JavaScriptConnectorHelper.java
index b275cd0a68..73752e4ddb 100644
--- a/client/src/com/vaadin/client/JavaScriptConnectorHelper.java
+++ b/client/src/com/vaadin/client/JavaScriptConnectorHelper.java
@@ -27,6 +27,7 @@ import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.user.client.Element;
+import com.vaadin.client.communication.JavaScriptMethodInvocation;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
import com.vaadin.shared.JavaScriptConnectorState;
@@ -258,8 +259,8 @@ public class JavaScriptConnectorHelper {
parameters[i] = argumentsArray.get(i);
}
connector.getConnection().addMethodInvocationToQueue(
- new MethodInvocation(connector.getConnectorId(), iface, method,
- parameters), false, false);
+ new JavaScriptMethodInvocation(connector.getConnectorId(),
+ iface, method, parameters), false, false);
}
private String findWildcardInterface(String method) {
@@ -286,7 +287,7 @@ public class JavaScriptConnectorHelper {
}
private void fireCallback(String name, JsArray<JavaScriptObject> arguments) {
- MethodInvocation invocation = new MethodInvocation(
+ MethodInvocation invocation = new JavaScriptMethodInvocation(
connector.getConnectorId(),
"com.vaadin.ui.JavaScript$JavaScriptCallbackRpc", "call",
new Object[] { name, new JSONArray(arguments) });
diff --git a/client/src/com/vaadin/client/communication/JavaScriptMethodInvocation.java b/client/src/com/vaadin/client/communication/JavaScriptMethodInvocation.java
new file mode 100644
index 0000000000..00f563e333
--- /dev/null
+++ b/client/src/com/vaadin/client/communication/JavaScriptMethodInvocation.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2012 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.client.communication;
+
+import com.vaadin.shared.communication.MethodInvocation;
+
+/**
+ * A {@link MethodInvocation} that originates from JavaScript. This means that
+ * there might not be any type information available on the client.
+ *
+ * @author Vaadin Ltd
+ * @since 7.0.0
+ */
+public class JavaScriptMethodInvocation extends MethodInvocation {
+
+ public JavaScriptMethodInvocation(String connectorId, String interfaceName,
+ String methodName, Object[] parameters) {
+ super(connectorId, interfaceName, methodName, parameters);
+ }
+}
diff --git a/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java b/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
index 2550fce208..078e19f73b 100644
--- a/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
+++ b/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
@@ -24,8 +24,8 @@ import com.google.gwt.core.client.JsArray;
import com.google.gwt.json.client.JSONArray;
import com.vaadin.client.ServerConnector;
import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.communication.JavaScriptMethodInvocation;
import com.vaadin.client.extensions.AbstractExtensionConnector;
-import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.shared.extension.javascriptmanager.ExecuteJavaScriptRpc;
import com.vaadin.shared.extension.javascriptmanager.JavaScriptManagerState;
import com.vaadin.shared.ui.Connect;
@@ -123,7 +123,7 @@ public class JavaScriptManagerConnector extends AbstractExtensionConnector {
* because of the JSONArray parameter
*/
getConnection().addMethodInvocationToQueue(
- new MethodInvocation(getConnectorId(),
+ new JavaScriptMethodInvocation(getConnectorId(),
"com.vaadin.ui.JavaScript$JavaScriptCallbackRpc",
"call", parameters), false, false);
}