Package com.vaadin.client
Class ExecuteJavaScriptElementUtils
java.lang.Object
com.vaadin.client.ExecuteJavaScriptElementUtils
Utility class which handles javascript execution context (see
ExecuteJavaScriptProcessor#getContextExecutionObject()).
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBridge interface for a JS callback with no arguments. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidattachExistingElement(StateNode parent, elemental.dom.Element previousSibling, String tagName, int id) Calculate the data required for server side callback to attach existing element and send it to the server.static voiddisposeInitializer(StateNode node, double id) Disposes a previously registered JS initializer cleanup.static voidpopulateModelProperties(StateNode node, JsArray<String> properties) Populate modelproperties: add them into NodeFeatures.ELEMENT_PROPERTIESNodeMapif they are not defined by the client-side element or send their client-side value to the server otherwise.static voidregisterInitializer(StateNode node, double id, ExecuteJavaScriptElementUtils.JsCallback cleanup) Stores a cleanup callback for a JS initializer registered throughElement.addJsInitializer(java.lang.String, java.lang.Object...).static voidregisterUpdatableModelProperties(StateNode node, JsArray<String> properties) Register the updatable model properties of thenode.
-
Method Details
-
attachExistingElement
public static void attachExistingElement(StateNode parent, elemental.dom.Element previousSibling, String tagName, int id) Calculate the data required for server side callback to attach existing element and send it to the server.- Parameters:
parent- the parent node whose child is requested to attachpreviousSibling- previous sibling elementtagName- the tag name of the element requested to attachid- the identifier of the server side node which is requested to be a counterpart of the client side element
-
populateModelProperties
Populate modelproperties: add them into NodeFeatures.ELEMENT_PROPERTIESNodeMapif they are not defined by the client-side element or send their client-side value to the server otherwise.- Parameters:
node- the node whose properties should be populatedproperties- array of property names to populate
-
registerUpdatableModelProperties
Register the updatable model properties of thenode.Only updates for the properties from the
propertiesarray will be sent to the server without explicit synchronization. Thepropertiesarray includes all properties that are allowed to be updated (including sub properties).- Parameters:
node- the node whose updatable properties should be registeredproperties- all updatable model properties
-
registerInitializer
public static void registerInitializer(StateNode node, double id, ExecuteJavaScriptElementUtils.JsCallback cleanup) Stores a cleanup callback for a JS initializer registered throughElement.addJsInitializer(java.lang.String, java.lang.Object...). If a callback was previously stored for the same id, it is invoked before being replaced (defensive against stale state from a discarded DOM). On the first registration for a node, an unregister listener is attached so that all remaining cleanups are drained when the node leaves the tree.- Parameters:
node- the state node owning the initializer, notnullid- the UI-wide initializer idcleanup- the JS cleanup function to invoke when disposing, notnull
-
disposeInitializer
Disposes a previously registered JS initializer cleanup. No-op if the id is unknown (e.g. the node has already been unregistered).- Parameters:
node- the state node owning the initializer, notnullid- the UI-wide initializer id
-