|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.server.AbstractClientConnector
com.vaadin.server.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
|
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector |
---|
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener |
Constructor Summary | |
---|---|
JavaScript()
Creates a new JavaScript object. |
Method Summary | |
---|---|
void |
addFunction(java.lang.String name,
JavaScriptFunction function)
Add a new function to the global JavaScript namespace (i.e. |
static void |
eval(java.lang.String script)
Executes the given JavaScript code in the browser. |
void |
execute(java.lang.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. |
protected com.vaadin.shared.extension.javascriptmanager.JavaScriptManagerState |
getState()
Returns the shared state for this connector. |
void |
remove()
JavaScript is not designed to be removed. |
void |
removeFunction(java.lang.String name)
Removes a JavaScripFunction from the browser's global JavaScript namespace. |
Methods inherited from class com.vaadin.server.AbstractExtension |
---|
extend, getParent, getSupportedParentType, setParent |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.server.ClientConnector |
---|
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler |
Methods inherited from interface com.vaadin.shared.Connector |
---|
getConnectorId |
Constructor Detail |
---|
public JavaScript()
Method Detail |
---|
protected com.vaadin.shared.extension.javascriptmanager.JavaScriptManagerState getState()
AbstractClientConnector
As a side effect, marks the connector dirty so any changes done to the
state will be sent to the client. Use getState(false)
to avoid
marking the connector as dirty.
getState
in class AbstractClientConnector
public void addFunction(java.lang.String name, JavaScriptFunction function)
call
method in the passed
JavaScriptFunction
object will be invoked with the same
parameters whenever the JavaScript function is called in the browser.
A function added with the name "myFunction"
can thus be
invoked with the following JavaScript code:
window.myFunction(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 function should get in the global JavaScript
namespace.function
- the JavaScriptFunction that will be invoked if the JavaScript
function is called.public void removeFunction(java.lang.String name)
addFunction(String, JavaScriptFunction)
, these objects will not
be removed by this method.
name
- the name of the callback to removepublic void execute(java.lang.String script)
script
- The JavaScript code to run.public static void eval(java.lang.String script)
script
- The JavaScript code to run.public static JavaScript getCurrent()
null
if there is no current page.Page.getCurrent()
public void remove()
remove
in interface Extension
remove
in class AbstractExtension
java.lang.UnsupportedOperationException
- when invoked
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |