|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vaadin.terminal.AbstractClientConnector com.vaadin.terminal.AbstractExtension com.vaadin.ui.JavaScript
public class JavaScript
Provides access to JavaScript functionality in the web browser. To get an instance of JavaScript, either use Page.getJavaScript() or JavaScript.getCurrent() as a shorthand for getting the JavaScript object corresponding to the current Page.
Nested Class Summary | |
---|---|
static interface |
JavaScript.JavaScriptCallbackRpc
|
Constructor Summary | |
---|---|
JavaScript()
Creates a new JavaScript object. |
Method Summary | |
---|---|
void |
addCallback(String name,
JavaScriptCallback callback)
Add a new function to the global JavaScript namespace (i.e. |
static void |
eval(String script)
Executes the given JavaScript code in the browser. |
void |
execute(String script)
Executes the given JavaScript code in the browser. |
static JavaScript |
getCurrent()
Get the JavaScript object for the current Page, or null if there is no current page. |
JavaScriptManagerState |
getState()
Gets the current shared state of the connector. |
void |
removeCallback(String name)
Removes a JavaScripCallback from the browser's global JavaScript namespace. |
void |
removeFromTarget()
JavaScript is not designed to be removed. |
Methods inherited from class com.vaadin.terminal.AbstractExtension |
---|
extend, getSupportedParentType, setParent |
Methods inherited from class com.vaadin.terminal.AbstractClientConnector |
---|
addExtension, addMethodInvocationToQueue, attach, createState, detach, getAllChildrenIterable, getApplication, getConnectorId, getExtensions, getParent, getRoot, getRpcManager, getRpcProxy, getStateType, isConnectorEnabled, registerRpc, registerRpc, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.terminal.gwt.server.ClientConnector |
---|
attach, detach, getExtensions, getParent, getRoot, getStateType, isConnectorEnabled, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls |
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector |
---|
getConnectorId |
Methods inherited from interface com.vaadin.terminal.gwt.server.RpcTarget |
---|
getRpcManager |
Constructor Detail |
---|
public JavaScript()
Method Detail |
---|
public JavaScriptManagerState getState()
Connector
getState
in interface Connector
getState
in class AbstractClientConnector
SharedState
. Never null.public void addCallback(String name, JavaScriptCallback callback)
call
method in the passed
JavaScriptCallback
object will be invoked with the same
parameters whenever the JavaScript function is called in the browser.
A callback added with the name "myCallback"
can thus be
invoked with the following JavaScript code:
window.myCallback(argument1, argument2)
.
If the name parameter contains dots, simple objects are created on demand
to allow calling the function using the same name (e.g.
window.myObject.myFunction
).
name
- the name that the callback function should get in the global
JavaScript namespace.callback
- the JavaScriptCallback that will be invoked if the JavaScript
function is called.public void removeCallback(String name)
addCallback(String, JavaScriptCallback)
addCallback, these
objects will not be removed when the callback is removed.
name
- the name of the callback to removepublic void execute(String script)
script
- The JavaScript code to run.public static void eval(String script)
script
- The JavaScript code to run.public static JavaScript getCurrent()
null
if there is no current page.Page.getCurrent()
public void removeFromTarget()
removeFromTarget
in class AbstractExtension
UnsupportedOperationException
- when invoked
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |