diff options
Diffstat (limited to 'src/com/vaadin/ui/JavaScript.java')
-rw-r--r-- | src/com/vaadin/ui/JavaScript.java | 36 |
1 files changed, 18 insertions, 18 deletions
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(); } |