summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-08-13 15:45:14 +0300
committerLeif Åstrand <leif@vaadin.com>2012-08-13 15:45:14 +0300
commitb998fd14b6453bf0a0da9a870d36ab2f0a7f9726 (patch)
treef9169afc54c0074ce9125584d66a4563fe3f29bc /src
parent2e6313e12b7c11706d154befd0cdf3a665f46365 (diff)
downloadvaadin-framework-b998fd14b6453bf0a0da9a870d36ab2f0a7f9726.tar.gz
vaadin-framework-b998fd14b6453bf0a0da9a870d36ab2f0a7f9726.zip
Rename JavaScriptCallback -> JavaScriptFunction (#9293)
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/AbstractJavaScriptExtension.java25
-rw-r--r--src/com/vaadin/terminal/JavaScriptCallbackHelper.java8
-rw-r--r--src/com/vaadin/ui/AbstractJavaScriptComponent.java25
-rw-r--r--src/com/vaadin/ui/JavaScript.java36
-rw-r--r--src/com/vaadin/ui/JavaScriptFunction.java (renamed from src/com/vaadin/ui/JavaScriptCallback.java)8
5 files changed, 50 insertions, 52 deletions
diff --git a/src/com/vaadin/terminal/AbstractJavaScriptExtension.java b/src/com/vaadin/terminal/AbstractJavaScriptExtension.java
index df44c3edd5..7bafb6d2b3 100644
--- a/src/com/vaadin/terminal/AbstractJavaScriptExtension.java
+++ b/src/com/vaadin/terminal/AbstractJavaScriptExtension.java
@@ -6,7 +6,7 @@ package com.vaadin.terminal;
import com.vaadin.shared.JavaScriptExtensionState;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
-import com.vaadin.ui.JavaScriptCallback;
+import com.vaadin.ui.JavaScriptFunction;
/**
* Base class for Extensions with all client-side logic implemented using
@@ -74,11 +74,11 @@ import com.vaadin.ui.JavaScriptCallback;
* the field, that function is called whenever the contents of the shared state
* is changed.</li>
* <li>Any field name corresponding to a call to
- * {@link #registerCallback(String, JavaScriptCallback)} on the server will
- * automatically be present as a function that triggers the registered callback
+ * {@link #addFunction(String, JavaScriptFunction)} on the server will
+ * automatically be present as a function that triggers the registered function
* on the server.</li>
* <li>Any field name referred to using
- * {@link #invokeCallback(String, Object...)} on the server will be called if a
+ * {@link #callFunction(String, Object...)} on the server will be called if a
* function has been assigned to the field.</li>
* </ul>
* <p>
@@ -122,22 +122,21 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension {
}
/**
- * Register a {@link JavaScriptCallback} that can be called from the
+ * Register a {@link JavaScriptFunction} that can be called from the
* JavaScript using the provided name. A JavaScript function with the
* provided name will be added to the connector wrapper object (initially
* available as <code>this</code>). Calling that JavaScript function will
- * cause the call method in the registered {@link JavaScriptCallback} to be
+ * cause the call method in the registered {@link JavaScriptFunction} to be
* invoked with the same arguments.
*
* @param functionName
* the name that should be used for client-side callback
- * @param javaScriptCallback
- * the callback object that will be invoked when the JavaScript
- * function is called
+ * @param function
+ * the {@link JavaScriptFunction} object that will be invoked
+ * when the JavaScript function is called
*/
- protected void registerCallback(String functionName,
- JavaScriptCallback javaScriptCallback) {
- callbackHelper.registerCallback(functionName, javaScriptCallback);
+ protected void addFunction(String functionName, JavaScriptFunction function) {
+ callbackHelper.registerCallback(functionName, function);
}
/**
@@ -152,7 +151,7 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension {
* @param arguments
* function arguments
*/
- protected void invokeCallback(String name, Object... arguments) {
+ protected void callFunction(String name, Object... arguments) {
callbackHelper.invokeCallback(name, arguments);
}
diff --git a/src/com/vaadin/terminal/JavaScriptCallbackHelper.java b/src/com/vaadin/terminal/JavaScriptCallbackHelper.java
index 131875a5a4..265e578c6d 100644
--- a/src/com/vaadin/terminal/JavaScriptCallbackHelper.java
+++ b/src/com/vaadin/terminal/JavaScriptCallbackHelper.java
@@ -19,7 +19,7 @@ import com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper;
import com.vaadin.tools.ReflectTools;
import com.vaadin.ui.AbstractJavaScriptComponent;
import com.vaadin.ui.JavaScript.JavaScriptCallbackRpc;
-import com.vaadin.ui.JavaScriptCallback;
+import com.vaadin.ui.JavaScriptFunction;
/**
* Internal helper class used to implement functionality common to
@@ -39,7 +39,7 @@ public class JavaScriptCallbackHelper implements Serializable {
JavaScriptCallbackRpc.class, "call", String.class, JSONArray.class);
private AbstractClientConnector connector;
- private Map<String, JavaScriptCallback> callbacks = new HashMap<String, JavaScriptCallback>();
+ private Map<String, JavaScriptFunction> callbacks = new HashMap<String, JavaScriptFunction>();
private JavaScriptCallbackRpc javascriptCallbackRpc;
public JavaScriptCallbackHelper(AbstractClientConnector connector) {
@@ -47,7 +47,7 @@ public class JavaScriptCallbackHelper implements Serializable {
}
public void registerCallback(String functionName,
- JavaScriptCallback javaScriptCallback) {
+ JavaScriptFunction javaScriptCallback) {
callbacks.put(functionName, javaScriptCallback);
JavaScriptConnectorState state = getConnectorState();
if (state.getCallbackNames().add(functionName)) {
@@ -67,7 +67,7 @@ public class JavaScriptCallbackHelper implements Serializable {
javascriptCallbackRpc = new JavaScriptCallbackRpc() {
@Override
public void call(String name, JSONArray arguments) {
- JavaScriptCallback callback = callbacks.get(name);
+ JavaScriptFunction callback = callbacks.get(name);
try {
callback.call(arguments);
} catch (JSONException e) {
diff --git a/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/src/com/vaadin/ui/AbstractJavaScriptComponent.java
index 3668669d16..5ec80573ab 100644
--- a/src/com/vaadin/ui/AbstractJavaScriptComponent.java
+++ b/src/com/vaadin/ui/AbstractJavaScriptComponent.java
@@ -77,11 +77,11 @@ import com.vaadin.terminal.gwt.client.ui.JavaScriptWidget;
* the field, that function is called whenever the contents of the shared state
* is changed.</li>
* <li>Any field name corresponding to a call to
- * {@link #registerCallback(String, JavaScriptCallback)} on the server will
- * automatically be present as a function that triggers the registered callback
+ * {@link #addFunction(String, JavaScriptFunction)} on the server will
+ * automatically be present as a function that triggers the registered function
* on the server.</li>
* <li>Any field name referred to using
- * {@link #invokeCallback(String, Object...)} on the server will be called if a
+ * {@link #callFunction(String, Object...)} on the server will be called if a
* function has been assigned to the field.</li>
* </ul>
* <p>
@@ -125,22 +125,21 @@ public abstract class AbstractJavaScriptComponent extends AbstractComponent {
}
/**
- * Register a {@link JavaScriptCallback} that can be called from the
+ * Register a {@link JavaScriptFunction} that can be called from the
* JavaScript using the provided name. A JavaScript function with the
* provided name will be added to the connector wrapper object (initially
* available as <code>this</code>). Calling that JavaScript function will
- * cause the call method in the registered {@link JavaScriptCallback} to be
+ * cause the call method in the registered {@link JavaScriptFunction} to be
* invoked with the same arguments.
*
* @param functionName
- * the name that should be used for client-side callback
- * @param javaScriptCallback
- * the callback object that will be invoked when the JavaScript
- * function is called
+ * the name that should be used for client-side function
+ * @param function
+ * the {@link JavaScriptFunction} object that will be invoked
+ * when the JavaScript function is called
*/
- protected void registerCallback(String functionName,
- JavaScriptCallback javaScriptCallback) {
- callbackHelper.registerCallback(functionName, javaScriptCallback);
+ protected void addFunction(String functionName, JavaScriptFunction function) {
+ callbackHelper.registerCallback(functionName, function);
}
/**
@@ -155,7 +154,7 @@ public abstract class AbstractJavaScriptComponent extends AbstractComponent {
* @param arguments
* function arguments
*/
- protected void invokeCallback(String name, Object... arguments) {
+ protected void callFunction(String name, Object... arguments) {
callbackHelper.invokeCallback(name, arguments);
}
diff --git a/src/com/vaadin/ui/JavaScript.java b/src/com/vaadin/ui/JavaScript.java
index 53efb62965..0b4669728a 100644
--- a/src/com/vaadin/ui/JavaScript.java
+++ b/src/com/vaadin/ui/JavaScript.java
@@ -26,7 +26,7 @@ import com.vaadin.terminal.Page;
* @since 7.0.0
*/
public class JavaScript extends AbstractExtension {
- private Map<String, JavaScriptCallback> callbacks = new HashMap<String, JavaScriptCallback>();
+ private Map<String, JavaScriptFunction> functions = new HashMap<String, JavaScriptFunction>();
// Can not be defined in client package as this JSONArray is not available
// in GWT
@@ -43,10 +43,10 @@ public class JavaScript extends AbstractExtension {
registerRpc(new JavaScriptCallbackRpc() {
@Override
public void call(String name, JSONArray arguments) {
- JavaScriptCallback callback = callbacks.get(name);
+ JavaScriptFunction function = functions.get(name);
// TODO handle situation if name is not registered
try {
- callback.call(arguments);
+ function.call(arguments);
} catch (JSONException e) {
throw new IllegalArgumentException(e);
}
@@ -62,44 +62,44 @@ public class JavaScript extends AbstractExtension {
/**
* Add a new function to the global JavaScript namespace (i.e. the window
* object). The <code>call</code> method in the passed
- * {@link JavaScriptCallback} object will be invoked with the same
+ * {@link JavaScriptFunction} object will be invoked with the same
* parameters whenever the JavaScript function is called in the browser.
*
- * A callback added with the name <code>"myCallback"</code> can thus be
+ * A function added with the name <code>"myFunction"</code> can thus be
* invoked with the following JavaScript code:
- * <code>window.myCallback(argument1, argument2)</code>.
+ * <code>window.myFunction(argument1, argument2)</code>.
*
* If the name parameter contains dots, simple objects are created on demand
* to allow calling the function using the same name (e.g.
* <code>window.myObject.myFunction</code>).
*
* @param name
- * the name that the callback function should get in the global
- * JavaScript namespace.
- * @param callback
- * the JavaScriptCallback that will be invoked if the JavaScript
+ * the name that the function should get in the global JavaScript
+ * namespace.
+ * @param function
+ * the JavaScriptFunction that will be invoked if the JavaScript
* function is called.
*/
- public void addCallback(String name, JavaScriptCallback callback) {
- callbacks.put(name, callback);
+ public void addFunction(String name, JavaScriptFunction function) {
+ functions.put(name, function);
if (getState().getNames().add(name)) {
requestRepaint();
}
}
/**
- * Removes a JavaScripCallback from the browser's global JavaScript
+ * Removes a JavaScripFunction from the browser's global JavaScript
* namespace.
*
- * If the name contains dots and intermediate were created by
- * {@link #addCallback(String, JavaScriptCallback)}addCallback, these
- * objects will not be removed when the callback is removed.
+ * If the name contains dots and intermediate objects were created by
+ * {@link #addFunction(String, JavaScriptFunction)}, these objects will not
+ * be removed by this method.
*
* @param name
* the name of the callback to remove
*/
- public void removeCallback(String name) {
- callbacks.remove(name);
+ public void removeFunction(String name) {
+ functions.remove(name);
if (getState().getNames().remove(name)) {
requestRepaint();
}
diff --git a/src/com/vaadin/ui/JavaScriptCallback.java b/src/com/vaadin/ui/JavaScriptFunction.java
index 49f7695e89..e39ae9b87b 100644
--- a/src/com/vaadin/ui/JavaScriptCallback.java
+++ b/src/com/vaadin/ui/JavaScriptFunction.java
@@ -15,15 +15,15 @@ import com.vaadin.terminal.AbstractJavaScriptExtension;
* the corresponding JavaScript function is called, the {@link #call(JSONArray)}
* method is invoked.
*
- * @see JavaScript#addCallback(String, JavaScriptCallback)
- * @see AbstractJavaScriptComponent#registerCallback(String, JavaScriptCallback)
- * @see AbstractJavaScriptExtension#registerCallback(String, JavaScriptCallback)
+ * @see JavaScript#addFunction(String, JavaScriptCallback)
+ * @see AbstractJavaScriptComponent#addFunction(String, JavaScriptCallback)
+ * @see AbstractJavaScriptExtension#addFunction(String, JavaScriptCallback)
*
* @author Vaadin Ltd
* @version @VERSION@
* @since 7.0.0
*/
-public interface JavaScriptCallback extends Serializable {
+public interface JavaScriptFunction extends Serializable {
/**
* Invoked whenever the corresponding JavaScript function is called in the
* browser.