Custom JavaScript
Vaadin is really JavaScript friendly. You can call JavaScript from the server, create JavaScript components and JavaScript extensions not to mention GWT capabilities such as JavaScript native interface and JavaScript overlay types.
Note
For more information on GWT JavaScript integration, visit https://developers.google.com/web-toolkit.
Calling JavaScript from the server
Calling JavaScript from the server is as easy as this:
JavaScript.getCurrent().execute("alert('Hello from server side.')");
That's it.
Calling the server from JavaScript
We can call our server from the client side using JavaScript. We need to add a JavaScript function as shown in the following code snippet:
JavaScript.getCurrent().addFunction("myFunction", new JavaScriptFunction() { @Override public void call(JSONArray arguments) throws JSONException { Notification .show("JavaScript called me, I show this message."); } });
Now client side JavaScript can make a regular...