Class ExecuteJavaScriptElementUtils


  • public final class ExecuteJavaScriptElementUtils
    extends Object
    Utility class which handles javascript execution context (see ExecuteJavaScriptProcessor#getContextExecutionObject()).
    Since:
    1.0
    Author:
    Vaadin Ltd
    See Also:
    ExecuteJavaScriptProcessor
    • Method Detail

      • 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 attach
        previousSibling - previous sibling element
        tagName - the tag name of the element requested to attach
        id - the identifier of the server side node which is requested to be a counterpart of the client side element
      • populateModelProperties

        public static void populateModelProperties​(StateNode node,
                                                   JsArray<String> properties)
        Populate model properties: add them into NodeFeatures.ELEMENT_PROPERTIES NodeMap if 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 populated
        properties - array of property names to populate
      • registerUpdatableModelProperties

        public static void registerUpdatableModelProperties​(StateNode node,
                                                            JsArray<String> properties)
        Register the updatable model properties of the node.

        Only updates for the properties from the properties array will be sent to the server without explicit synchronization. The properties array includes all properties that are allowed to be updated (including sub properties).

        Parameters:
        node - the node whose updatable properties should be registered
        properties - all updatable model properties
      • scrollPositionHandlerAfterServerNavigation

        public static void scrollPositionHandlerAfterServerNavigation​(Registry registry,
                                                                      elemental.json.JsonObject state)
        Parameters:
        registry - the registry
        state - includes scroll position of the previous page and the complete href of the router link that was clicked and caused this navigation