diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-06-14 17:42:04 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-06-14 17:42:04 +0300 |
commit | 755adc2731383e6e04ddfa5bee04b6ed6feaf243 (patch) | |
tree | f989be641bdae3ec914a227a0567023cc220c5f3 | |
parent | d44e06fc50415d3dcdc93ad8c711a2c4f2664e6e (diff) | |
download | vaadin-framework-755adc2731383e6e04ddfa5bee04b6ed6feaf243.tar.gz vaadin-framework-755adc2731383e6e04ddfa5bee04b6ed6feaf243.zip |
Rename Javascript -> JavaScript
23 files changed, 142 insertions, 140 deletions
diff --git a/WebContent/statictestfiles/jsconnector.js b/WebContent/statictestfiles/jsconnector.js index db8a065e86..1432c20698 100644 --- a/WebContent/statictestfiles/jsconnector.js +++ b/WebContent/statictestfiles/jsconnector.js @@ -1,10 +1,10 @@ -window.com_vaadin_tests_components_javascriptcomponent_BasicJavascriptComponent_ExampleWidget = function() { +window.com_vaadin_tests_components_javascriptcomponent_BasicJavaScriptComponent_ExampleWidget = function() { var connector = this; var rootElement = connector.getWidgetElement(); rootElement.innerHTML = 'Hello world!'; rootElement.onclick = function() { - connector.getRpcProxyFunction("com.vaadin.tests.components.javascriptcomponent.BasicJavascriptComponent$ExampleClickRpc", "onClick")("message"); + connector.getRpcProxyFunction("com.vaadin.tests.components.javascriptcomponent.BasicJavaScriptComponent$ExampleClickRpc", "onClick")("message"); } connector.onStateChange = function() { console.log('state change:', this.getState()); diff --git a/WebContent/statictestfiles/jsextension.js b/WebContent/statictestfiles/jsextension.js index bdc0460c29..be551746ca 100644 --- a/WebContent/statictestfiles/jsextension.js +++ b/WebContent/statictestfiles/jsextension.js @@ -1,8 +1,8 @@ -window.com_vaadin_tests_extensions_SimpleJavascriptExtensionTest_SimpleJavascriptExtension = function() { +window.com_vaadin_tests_extensions_SimpleJavaScriptExtensionTest_SimpleJavascriptExtension = function() { var state = this.getState(); - var greetBack = this.getRpcProxyFunction('com.vaadin.tests.extensions.SimpleJavascriptExtensionTest$SimpleJavascriptExtensionServerRpc', 'greet'); + var greetBack = this.getRpcProxyFunction('com.vaadin.tests.extensions.SimpleJavaScriptExtensionTest$SimpleJavaScriptExtensionServerRpc', 'greet'); - this.registerRpc("com.vaadin.tests.extensions.SimpleJavascriptExtensionTest.SimpleJavascriptExtensionClientRpc", { + this.registerRpc("com.vaadin.tests.extensions.SimpleJavaScriptExtensionTest.SimpleJavaScriptExtensionClientRpc", { 'greet': function(greeting) { var response = window.prompt(state.prefix + greeting); if (response !== null) { diff --git a/src/com/vaadin/terminal/AbstractJavaScriptExtension.java b/src/com/vaadin/terminal/AbstractJavaScriptExtension.java new file mode 100644 index 0000000000..49f361f343 --- /dev/null +++ b/src/com/vaadin/terminal/AbstractJavaScriptExtension.java @@ -0,0 +1,21 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.terminal; + +import com.vaadin.ui.JavaScriptCallback; + +public class AbstractJavaScriptExtension extends AbstractExtension { + private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper( + this); + + protected void registerCallback(String functionName, + JavaScriptCallback javaScriptCallback) { + callbackHelper.registerCallback(functionName, javaScriptCallback); + } + + protected void invokeCallback(String name, Object... arguments) { + callbackHelper.invokeCallback(name, arguments); + } +} diff --git a/src/com/vaadin/terminal/AbstractJavascriptExtension.java b/src/com/vaadin/terminal/AbstractJavascriptExtension.java deleted file mode 100644 index e741e2af1e..0000000000 --- a/src/com/vaadin/terminal/AbstractJavascriptExtension.java +++ /dev/null @@ -1,20 +0,0 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ - -package com.vaadin.terminal; - -import com.vaadin.ui.JavascriptCallback; - -public class AbstractJavascriptExtension extends AbstractExtension { - private JavascriptRpcHelper rpcHelper = new JavascriptRpcHelper(this); - - protected void registerCallback(String functionName, - JavascriptCallback javascriptCallback) { - rpcHelper.registerCallback(functionName, javascriptCallback); - } - - protected void invokeCallback(String name, Object... arguments) { - rpcHelper.invokeCallback(name, arguments); - } -} diff --git a/src/com/vaadin/terminal/JavascriptRpcHelper.java b/src/com/vaadin/terminal/JavaScriptCallbackHelper.java index 937f7e3a54..5ea5e56255 100644 --- a/src/com/vaadin/terminal/JavascriptRpcHelper.java +++ b/src/com/vaadin/terminal/JavaScriptCallbackHelper.java @@ -12,33 +12,33 @@ import java.util.Map; import com.vaadin.external.json.JSONArray; import com.vaadin.external.json.JSONException; import com.vaadin.tools.ReflectTools; -import com.vaadin.ui.JavaScript.JavascriptCallbackRpc; -import com.vaadin.ui.JavascriptCallback; +import com.vaadin.ui.JavaScript.JavaScriptCallbackRpc; +import com.vaadin.ui.JavaScriptCallback; -public class JavascriptRpcHelper { +public class JavaScriptCallbackHelper { private static final Method CALL_METHOD = ReflectTools.findMethod( - JavascriptCallbackRpc.class, "call", String.class, JSONArray.class); + JavaScriptCallbackRpc.class, "call", String.class, JSONArray.class); private AbstractClientConnector connector; - private Map<String, JavascriptCallback> callbacks = new HashMap<String, JavascriptCallback>(); - private JavascriptCallbackRpc javascriptCallbackRpc; + private Map<String, JavaScriptCallback> callbacks = new HashMap<String, JavaScriptCallback>(); + private JavaScriptCallbackRpc javascriptCallbackRpc; - public JavascriptRpcHelper(AbstractClientConnector connector) { + public JavaScriptCallbackHelper(AbstractClientConnector connector) { this.connector = connector; } public void registerCallback(String functionName, - JavascriptCallback javascriptCallback) { - callbacks.put(functionName, javascriptCallback); + JavaScriptCallback javaScriptCallback) { + callbacks.put(functionName, javaScriptCallback); ensureRpc(); } private void ensureRpc() { if (javascriptCallbackRpc == null) { - javascriptCallbackRpc = new JavascriptCallbackRpc() { + javascriptCallbackRpc = new JavaScriptCallbackRpc() { public void call(String name, JSONArray arguments) { - JavascriptCallback callback = callbacks.get(name); + JavaScriptCallback callback = callbacks.get(name); try { callback.call(arguments); } catch (JSONException e) { @@ -53,7 +53,7 @@ public class JavascriptRpcHelper { public void invokeCallback(String name, Object... arguments) { JSONArray args = new JSONArray(Arrays.asList(arguments)); connector.addMethodInvocationToQueue( - JavascriptCallbackRpc.class.getName(), CALL_METHOD, + JavaScriptCallbackRpc.class.getName(), CALL_METHOD, new Object[] { name, args }); connector.requestRepaint(); } diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index c973fe44d1..1349af465d 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -40,7 +40,7 @@ import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.ui.HasWidgets; import com.google.gwt.user.client.ui.Widget; import com.vaadin.terminal.gwt.client.ApplicationConfiguration.ErrorMessage; -import com.vaadin.terminal.gwt.client.communication.HasJavascriptConnectorHelper; +import com.vaadin.terminal.gwt.client.communication.HasJavaScriptConnectorHelper; import com.vaadin.terminal.gwt.client.communication.JsonDecoder; import com.vaadin.terminal.gwt.client.communication.JsonEncoder; import com.vaadin.terminal.gwt.client.communication.MethodInvocation; @@ -1416,8 +1416,8 @@ public class ApplicationConnection { JSONObject stateJson = new JSONObject( states.getJavaScriptObject(connectorId)); - if (connector instanceof HasJavascriptConnectorHelper) { - ((HasJavascriptConnectorHelper) connector) + if (connector instanceof HasJavaScriptConnectorHelper) { + ((HasJavaScriptConnectorHelper) connector) .getJavascriptConnectorHelper() .setNativeState( stateJson.getJavaScriptObject()); diff --git a/src/com/vaadin/terminal/gwt/client/JavascriptConnectorHelper.java b/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java index 36f7c47959..2c7ca22157 100644 --- a/src/com/vaadin/terminal/gwt/client/JavascriptConnectorHelper.java +++ b/src/com/vaadin/terminal/gwt/client/JavaScriptConnectorHelper.java @@ -11,7 +11,7 @@ import com.google.gwt.core.client.JsArray; import com.google.gwt.json.client.JSONArray; import com.vaadin.terminal.gwt.client.communication.MethodInvocation; -public class JavascriptConnectorHelper { +public class JavaScriptConnectorHelper { private final ServerConnector connector; private final JavaScriptObject nativeState = JavaScriptObject @@ -21,7 +21,7 @@ public class JavascriptConnectorHelper { private JavaScriptObject connectorWrapper; private int tag; - public JavascriptConnectorHelper(ServerConnector connector) { + public JavaScriptConnectorHelper(ServerConnector connector) { this.connector = connector; } @@ -35,17 +35,17 @@ public class JavascriptConnectorHelper { String initFunctionName = serverSideClassName .replaceAll("\\.", "_"); if (tryInitJs(initFunctionName, getConnectorWrapper())) { - VConsole.log("Javascript connector initialized using " + VConsole.log("JavaScript connector initialized using " + initFunctionName); return true; } else { - VConsole.log("No javascript function " + initFunctionName + VConsole.log("No JavaScript function " + initFunctionName + " found"); attemptedNames.add(initFunctionName); tag = conf.getParentTag(tag.intValue()); } } - VConsole.log("No javascript init for connector not found"); + VConsole.log("No JavaScript init for connector not found"); showInitProblem(attemptedNames); return false; } @@ -91,7 +91,7 @@ public class JavascriptConnectorHelper { }-*/; private static native JavaScriptObject createConnectorWrapper( - JavascriptConnectorHelper h, JavaScriptObject nativeState, + JavaScriptConnectorHelper h, JavaScriptObject nativeState, JavaScriptObject registeredRpc, String connectorId) /*-{ return { @@ -103,15 +103,15 @@ public class JavascriptConnectorHelper { }, 'getRpcProxyFunction': function(iface, method) { return $entry(function() { - h.@com.vaadin.terminal.gwt.client.JavascriptConnectorHelper::fireRpc(Ljava/lang/String;Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;)(iface, method, arguments); + h.@com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper::fireRpc(Ljava/lang/String;Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;)(iface, method, arguments); }); }, 'getCallback': function(name) { return $entry(function() { var args = [name, Array.prototype.slice.call(arguments, 0)]; - var iface = "com.vaadin.ui.JavaScript$JavascriptCallbackRpc"; + var iface = "com.vaadin.ui.JavaScript$JavaScriptCallbackRpc"; var method = "call"; - h.@com.vaadin.terminal.gwt.client.JavascriptConnectorHelper::fireRpc(Ljava/lang/String;Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;)(iface, method, args); + h.@com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper::fireRpc(Ljava/lang/String;Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;)(iface, method, args); }); }, 'registerCallback': function(name, callback) { @@ -173,7 +173,7 @@ public class JavascriptConnectorHelper { public void invokeJsRpc(MethodInvocation invocation, JSONArray parametersJson) { - if ("com.vaadin.ui.JavaScript$JavascriptCallbackRpc".equals(invocation + if ("com.vaadin.ui.JavaScript$JavaScriptCallbackRpc".equals(invocation .getInterfaceName()) && "call".equals(invocation.getMethodName())) { invokeJsRpc(rpcMap, parametersJson.get(0).isString().stringValue(), diff --git a/src/com/vaadin/terminal/gwt/client/JavascriptExtension.java b/src/com/vaadin/terminal/gwt/client/JavaScriptExtension.java index 74c3d7da45..121208d754 100644 --- a/src/com/vaadin/terminal/gwt/client/JavascriptExtension.java +++ b/src/com/vaadin/terminal/gwt/client/JavaScriptExtension.java @@ -4,16 +4,16 @@ package com.vaadin.terminal.gwt.client; -import com.vaadin.terminal.AbstractJavascriptExtension; -import com.vaadin.terminal.gwt.client.communication.HasJavascriptConnectorHelper; +import com.vaadin.terminal.AbstractJavaScriptExtension; +import com.vaadin.terminal.gwt.client.communication.HasJavaScriptConnectorHelper; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; import com.vaadin.terminal.gwt.client.extensions.AbstractExtensionConnector; import com.vaadin.terminal.gwt.client.ui.Connect; -@Connect(AbstractJavascriptExtension.class) -public class JavascriptExtension extends AbstractExtensionConnector implements - HasJavascriptConnectorHelper { - private final JavascriptConnectorHelper helper = new JavascriptConnectorHelper( +@Connect(AbstractJavaScriptExtension.class) +public class JavaScriptExtension extends AbstractExtensionConnector implements + HasJavaScriptConnectorHelper { + private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper( this); @Override @@ -27,7 +27,7 @@ public class JavascriptExtension extends AbstractExtensionConnector implements helper.fireNativeStateChange(); } - public JavascriptConnectorHelper getJavascriptConnectorHelper() { + public JavaScriptConnectorHelper getJavascriptConnectorHelper() { return helper; } } diff --git a/src/com/vaadin/terminal/gwt/client/WidgetSet.java b/src/com/vaadin/terminal/gwt/client/WidgetSet.java index ecbfb0ecc9..3d7e838c62 100644 --- a/src/com/vaadin/terminal/gwt/client/WidgetSet.java +++ b/src/com/vaadin/terminal/gwt/client/WidgetSet.java @@ -5,7 +5,7 @@ package com.vaadin.terminal.gwt.client; import com.google.gwt.core.client.GWT; -import com.vaadin.terminal.gwt.client.communication.HasJavascriptConnectorHelper; +import com.vaadin.terminal.gwt.client.communication.HasJavaScriptConnectorHelper; import com.vaadin.terminal.gwt.client.ui.UnknownComponentConnector; public class WidgetSet { @@ -54,8 +54,8 @@ public class WidgetSet { * let the auto generated code instantiate this type */ ServerConnector connector = widgetMap.instantiate(classType); - if (connector instanceof HasJavascriptConnectorHelper) { - ((HasJavascriptConnectorHelper) connector) + if (connector instanceof HasJavaScriptConnectorHelper) { + ((HasJavaScriptConnectorHelper) connector) .getJavascriptConnectorHelper().setTag(tag); } return connector; diff --git a/src/com/vaadin/terminal/gwt/client/communication/HasJavaScriptConnectorHelper.java b/src/com/vaadin/terminal/gwt/client/communication/HasJavaScriptConnectorHelper.java new file mode 100644 index 0000000000..a5191a5fed --- /dev/null +++ b/src/com/vaadin/terminal/gwt/client/communication/HasJavaScriptConnectorHelper.java @@ -0,0 +1,11 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.terminal.gwt.client.communication; + +import com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper; + +public interface HasJavaScriptConnectorHelper { + public JavaScriptConnectorHelper getJavascriptConnectorHelper(); +} diff --git a/src/com/vaadin/terminal/gwt/client/communication/HasJavascriptConnectorHelper.java b/src/com/vaadin/terminal/gwt/client/communication/HasJavascriptConnectorHelper.java deleted file mode 100644 index 74bc75da66..0000000000 --- a/src/com/vaadin/terminal/gwt/client/communication/HasJavascriptConnectorHelper.java +++ /dev/null @@ -1,11 +0,0 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ - -package com.vaadin.terminal.gwt.client.communication; - -import com.vaadin.terminal.gwt.client.JavascriptConnectorHelper; - -public interface HasJavascriptConnectorHelper { - public JavascriptConnectorHelper getJavascriptConnectorHelper(); -} diff --git a/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java b/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java index e0ffb40125..07d6292ce2 100644 --- a/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java +++ b/src/com/vaadin/terminal/gwt/client/communication/RpcManager.java @@ -89,8 +89,8 @@ public class RpcManager { MethodInvocation invocation = new MethodInvocation(connectorId, interfaceName, methodName); - if (connector instanceof HasJavascriptConnectorHelper) { - ((HasJavascriptConnectorHelper) connector) + if (connector instanceof HasJavaScriptConnectorHelper) { + ((HasJavaScriptConnectorHelper) connector) .getJavascriptConnectorHelper().invokeJsRpc(invocation, parametersJson); } else { diff --git a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavascriptManagerConnector.java b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerConnector.java index 10c4847bac..72bd253ecb 100644 --- a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavascriptManagerConnector.java +++ b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerConnector.java @@ -17,14 +17,14 @@ import com.vaadin.terminal.gwt.client.ui.Connect; import com.vaadin.ui.JavaScript; @Connect(JavaScript.class) -public class JavascriptManagerConnector extends AbstractExtensionConnector { +public class JavaScriptManagerConnector extends AbstractExtensionConnector { private Set<String> currentNames = new HashSet<String>(); @Override protected void init() { registerRpc(ExecuteJavaScriptRpc.class, new ExecuteJavaScriptRpc() { - public void executeJavaScript(String script) { - eval(script); + public void executeJavaScript(String Script) { + eval(Script); } }); } @@ -55,7 +55,7 @@ public class JavascriptManagerConnector extends AbstractExtensionConnector { $wnd[name] = $entry(function() { //Must make a copy because arguments is an array-like object (not instanceof Array), causing suboptimal JSON encoding var args = Array.prototype.slice.call(arguments, 0); - m.@com.vaadin.terminal.gwt.client.extensions.javascriptmanager.JavascriptManagerConnector::sendRpc(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;)(name, args); + m.@com.vaadin.terminal.gwt.client.extensions.javascriptmanager.JavaScriptManagerConnector::sendRpc(Ljava/lang/String;Lcom/google/gwt/core/client/JsArray;)(name, args); }); }-*/; @@ -65,10 +65,10 @@ public class JavascriptManagerConnector extends AbstractExtensionConnector { delete $wnd[name]; }-*/; - private static native void eval(String script) + private static native void eval(String Script) /*-{ - if(script) { - $wnd.eval(script); + if(Script) { + $wnd.eval(Script); } }-*/; @@ -81,12 +81,12 @@ public class JavascriptManagerConnector extends AbstractExtensionConnector { */ getConnection().addMethodInvocationToQueue( new MethodInvocation(getConnectorId(), - "com.vaadin.ui.JavaScript$JavascriptCallbackRpc", + "com.vaadin.ui.JavaScript$JavaScriptCallbackRpc", "call", parameters), true); } @Override - public JavascriptManagerState getState() { - return (JavascriptManagerState) super.getState(); + public JavaScriptManagerState getState() { + return (JavaScriptManagerState) super.getState(); } } diff --git a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavascriptManagerState.java b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerState.java index 77794ffdca..fc246aff04 100644 --- a/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavascriptManagerState.java +++ b/src/com/vaadin/terminal/gwt/client/extensions/javascriptmanager/JavaScriptManagerState.java @@ -9,7 +9,7 @@ import java.util.Set; import com.vaadin.terminal.gwt.client.communication.SharedState; -public class JavascriptManagerState extends SharedState { +public class JavaScriptManagerState extends SharedState { private Set<String> names = new HashSet<String>(); public Set<String> getNames() { diff --git a/src/com/vaadin/terminal/gwt/client/ui/JavascriptComponentConnector.java b/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentConnector.java index 57e65e91c6..c8b22a4239 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/JavascriptComponentConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/JavaScriptComponentConnector.java @@ -5,16 +5,16 @@ package com.vaadin.terminal.gwt.client.ui; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.user.client.Element; -import com.vaadin.terminal.gwt.client.JavascriptConnectorHelper; -import com.vaadin.terminal.gwt.client.communication.HasJavascriptConnectorHelper; +import com.vaadin.terminal.gwt.client.JavaScriptConnectorHelper; +import com.vaadin.terminal.gwt.client.communication.HasJavaScriptConnectorHelper; import com.vaadin.terminal.gwt.client.communication.StateChangeEvent; -import com.vaadin.ui.AbstractJavascriptComponent; +import com.vaadin.ui.AbstractJavaScriptComponent; -@Connect(AbstractJavascriptComponent.class) -public class JavascriptComponentConnector extends AbstractComponentConnector - implements HasJavascriptConnectorHelper { +@Connect(AbstractJavaScriptComponent.class) +public class JavaScriptComponentConnector extends AbstractComponentConnector + implements HasJavaScriptConnectorHelper { - private final JavascriptConnectorHelper helper = new JavascriptConnectorHelper( + private final JavaScriptConnectorHelper helper = new JavaScriptConnectorHelper( this) { @Override protected void showInitProblem( @@ -50,11 +50,11 @@ public class JavascriptComponentConnector extends AbstractComponentConnector }-*/; @Override - public JavascriptWidget getWidget() { - return (JavascriptWidget) super.getWidget(); + public JavaScriptWidget getWidget() { + return (JavaScriptWidget) super.getWidget(); } - public JavascriptConnectorHelper getJavascriptConnectorHelper() { + public JavaScriptConnectorHelper getJavascriptConnectorHelper() { return helper; } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/JavascriptWidget.java b/src/com/vaadin/terminal/gwt/client/ui/JavaScriptWidget.java index 93a4417b1c..e6c3323893 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/JavascriptWidget.java +++ b/src/com/vaadin/terminal/gwt/client/ui/JavaScriptWidget.java @@ -8,13 +8,13 @@ import java.util.ArrayList; import com.google.gwt.dom.client.Document; import com.google.gwt.user.client.ui.Widget; -public class JavascriptWidget extends Widget { - public JavascriptWidget() { +public class JavaScriptWidget extends Widget { + public JavaScriptWidget() { setElement(Document.get().createDivElement()); } public void showNoInitFound(ArrayList<String> attemptedNames) { - String message = "Could not initialize JavascriptConnector because no javascript init function was found. Make sure one of these functions are defined: <ul>"; + String message = "Could not initialize JavaScriptConnector because no JavaScript init function was found. Make sure one of these functions are defined: <ul>"; for (String name : attemptedNames) { message += "<li>" + name + "</li>"; } diff --git a/src/com/vaadin/ui/AbstractJavaScriptComponent.java b/src/com/vaadin/ui/AbstractJavaScriptComponent.java new file mode 100644 index 0000000000..881ac3f9d9 --- /dev/null +++ b/src/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -0,0 +1,20 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.ui; + +import com.vaadin.terminal.JavaScriptCallbackHelper; + +public class AbstractJavaScriptComponent extends AbstractComponent { + private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper( + this); + + protected void registerCallback(String functionName, + JavaScriptCallback javascriptCallback) { + callbackHelper.registerCallback(functionName, javascriptCallback); + } + + protected void invokeCallback(String name, Object... arguments) { + callbackHelper.invokeCallback(name, arguments); + } +} diff --git a/src/com/vaadin/ui/AbstractJavascriptComponent.java b/src/com/vaadin/ui/AbstractJavascriptComponent.java deleted file mode 100644 index 0a26c10239..0000000000 --- a/src/com/vaadin/ui/AbstractJavascriptComponent.java +++ /dev/null @@ -1,19 +0,0 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ -package com.vaadin.ui; - -import com.vaadin.terminal.JavascriptRpcHelper; - -public class AbstractJavascriptComponent extends AbstractComponent { - private JavascriptRpcHelper rpcHelper = new JavascriptRpcHelper(this); - - protected void registerCallback(String functionName, - JavascriptCallback javascriptCallback) { - rpcHelper.registerCallback(functionName, javascriptCallback); - } - - protected void invokeCallback(String name, Object... arguments) { - rpcHelper.invokeCallback(name, arguments); - } -} diff --git a/src/com/vaadin/ui/JavaScript.java b/src/com/vaadin/ui/JavaScript.java index dcd8540947..fb1dba2f20 100644 --- a/src/com/vaadin/ui/JavaScript.java +++ b/src/com/vaadin/ui/JavaScript.java @@ -13,21 +13,21 @@ import com.vaadin.terminal.AbstractExtension; import com.vaadin.terminal.Extension; import com.vaadin.terminal.gwt.client.communication.ServerRpc; import com.vaadin.terminal.gwt.client.extensions.javascriptmanager.ExecuteJavaScriptRpc; -import com.vaadin.terminal.gwt.client.extensions.javascriptmanager.JavascriptManagerState; +import com.vaadin.terminal.gwt.client.extensions.javascriptmanager.JavaScriptManagerState; public class JavaScript extends AbstractExtension { - private Map<String, JavascriptCallback> callbacks = new HashMap<String, JavascriptCallback>(); + private Map<String, JavaScriptCallback> callbacks = new HashMap<String, JavaScriptCallback>(); // Can not be defined in client package as this JSONArray is not available // in GWT - public interface JavascriptCallbackRpc extends ServerRpc { + public interface JavaScriptCallbackRpc extends ServerRpc { public void call(String name, JSONArray arguments); } public JavaScript() { - registerRpc(new JavascriptCallbackRpc() { + registerRpc(new JavaScriptCallbackRpc() { public void call(String name, JSONArray arguments) { - JavascriptCallback callback = callbacks.get(name); + JavaScriptCallback callback = callbacks.get(name); // TODO handle situation if name is not registered try { callback.call(arguments); @@ -39,11 +39,11 @@ public class JavaScript extends AbstractExtension { } @Override - public JavascriptManagerState getState() { - return (JavascriptManagerState) super.getState(); + public JavaScriptManagerState getState() { + return (JavaScriptManagerState) super.getState(); } - public void addCallback(String name, JavascriptCallback callback) { + public void addCallback(String name, JavaScriptCallback callback) { callbacks.put(name, callback); if (getState().getNames().add(name)) { requestRepaint(); diff --git a/src/com/vaadin/ui/JavascriptCallback.java b/src/com/vaadin/ui/JavaScriptCallback.java index 89700b3faf..e6b16010e4 100644 --- a/src/com/vaadin/ui/JavascriptCallback.java +++ b/src/com/vaadin/ui/JavaScriptCallback.java @@ -9,6 +9,6 @@ import java.io.Serializable; import com.vaadin.external.json.JSONArray; import com.vaadin.external.json.JSONException; -public interface JavascriptCallback extends Serializable { +public interface JavaScriptCallback extends Serializable { public void call(JSONArray arguments) throws JSONException; } diff --git a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavascriptComponent.java b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java index 2240fc246b..4de80aaf9d 100644 --- a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavascriptComponent.java +++ b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java @@ -11,11 +11,11 @@ import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.gwt.client.ComponentState; import com.vaadin.terminal.gwt.client.communication.ServerRpc; import com.vaadin.tests.components.AbstractTestRoot; -import com.vaadin.ui.AbstractJavascriptComponent; +import com.vaadin.ui.AbstractJavaScriptComponent; import com.vaadin.ui.Root; @LoadScripts({ "/statictestfiles/jsconnector.js" }) -public class BasicJavascriptComponent extends AbstractTestRoot { +public class BasicJavaScriptComponent extends AbstractTestRoot { public interface ExampleClickRpc extends ServerRpc { public void onClick(String message); @@ -33,7 +33,7 @@ public class BasicJavascriptComponent extends AbstractTestRoot { } } - public static class ExampleWidget extends AbstractJavascriptComponent { + public static class ExampleWidget extends AbstractJavaScriptComponent { public ExampleWidget() { registerRpc(new ExampleClickRpc() { public void onClick(String message) { diff --git a/tests/testbench/com/vaadin/tests/extensions/JavascriptManagerTest.java b/tests/testbench/com/vaadin/tests/extensions/JavascriptManagerTest.java index 0270f7ed8f..be4675eb2d 100644 --- a/tests/testbench/com/vaadin/tests/extensions/JavascriptManagerTest.java +++ b/tests/testbench/com/vaadin/tests/extensions/JavascriptManagerTest.java @@ -11,7 +11,7 @@ import com.vaadin.terminal.WrappedRequest; import com.vaadin.tests.components.AbstractTestRoot; import com.vaadin.tests.util.Log; import com.vaadin.ui.JavaScript; -import com.vaadin.ui.JavascriptCallback; +import com.vaadin.ui.JavaScriptCallback; public class JavascriptManagerTest extends AbstractTestRoot { @@ -21,7 +21,7 @@ public class JavascriptManagerTest extends AbstractTestRoot { protected void setup(WrappedRequest request) { addComponent(log); JavaScript js = JavaScript.getCurrent(); - js.addCallback("testing", new JavascriptCallback() { + js.addCallback("testing", new JavaScriptCallback() { public void call(JSONArray arguments) throws JSONException { log.log("Got " + arguments.length() + " arguments"); log.log("Argument 1 as a number: " + arguments.getInt(0)); diff --git a/tests/testbench/com/vaadin/tests/extensions/SimpleJavascriptExtensionTest.java b/tests/testbench/com/vaadin/tests/extensions/SimpleJavaScriptExtensionTest.java index 92c134efb0..983520ee93 100644 --- a/tests/testbench/com/vaadin/tests/extensions/SimpleJavascriptExtensionTest.java +++ b/tests/testbench/com/vaadin/tests/extensions/SimpleJavaScriptExtensionTest.java @@ -5,7 +5,7 @@ package com.vaadin.tests.extensions; import com.vaadin.annotations.LoadScripts; -import com.vaadin.terminal.AbstractJavascriptExtension; +import com.vaadin.terminal.AbstractJavaScriptExtension; import com.vaadin.terminal.WrappedRequest; import com.vaadin.terminal.gwt.client.communication.ClientRpc; import com.vaadin.terminal.gwt.client.communication.ServerRpc; @@ -16,9 +16,9 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Root; @LoadScripts({ "/statictestfiles/jsextension.js" }) -public class SimpleJavascriptExtensionTest extends AbstractTestRoot { +public class SimpleJavaScriptExtensionTest extends AbstractTestRoot { - public static class SimpleJavascriptExtensionState extends SharedState { + public static class SimpleJavaScriptExtensionState extends SharedState { private String prefix; public void setPrefix(String prefix) { @@ -30,21 +30,21 @@ public class SimpleJavascriptExtensionTest extends AbstractTestRoot { } } - public static interface SimpleJavascriptExtensionClientRpc extends + public static interface SimpleJavaScriptExtensionClientRpc extends ClientRpc { public void greet(String message); } - public static interface SimpleJavascriptExtensionServerRpc extends + public static interface SimpleJavaScriptExtensionServerRpc extends ServerRpc { public void greet(String message); } public static class SimpleJavascriptExtension extends - AbstractJavascriptExtension { + AbstractJavaScriptExtension { public SimpleJavascriptExtension() { - registerRpc(new SimpleJavascriptExtensionServerRpc() { + registerRpc(new SimpleJavaScriptExtensionServerRpc() { public void greet(String message) { Root.getCurrentRoot().showNotification( getState().getPrefix() + message); @@ -53,8 +53,8 @@ public class SimpleJavascriptExtensionTest extends AbstractTestRoot { } @Override - public SimpleJavascriptExtensionState getState() { - return (SimpleJavascriptExtensionState) super.getState(); + public SimpleJavaScriptExtensionState getState() { + return (SimpleJavaScriptExtensionState) super.getState(); } public void setPrefix(String prefix) { @@ -63,7 +63,7 @@ public class SimpleJavascriptExtensionTest extends AbstractTestRoot { } public void greet(String message) { - getRpcProxy(SimpleJavascriptExtensionClientRpc.class) + getRpcProxy(SimpleJavaScriptExtensionClientRpc.class) .greet(message); } } |