Search in sources :

Example 1 with InitialPropertiesHandler

use of com.vaadin.client.InitialPropertiesHandler in project flow by vaadin.

the class SimpleElementBindingStrategy method doAppendVirtualChild.

private void doAppendVirtualChild(BindingContext context, StateNode node, boolean reactivePhase, Supplier<Element> elementLookup, String id, String address) {
    if (!verifyAttachRequest(context.node, node, id, address)) {
        return;
    }
    Element element = elementLookup.get();
    if (verifyAttachedElement(element, node, id, address, context)) {
        if (!reactivePhase) {
            InitialPropertiesHandler initialPropertiesHandler = node.getTree().getRegistry().getInitialPropertiesHandler();
            initialPropertiesHandler.nodeRegistered(node);
            initialPropertiesHandler.flushPropertyUpdates();
        }
        node.setDomNode(element);
        context.binderContext.createAndBind(node);
    }
    if (!reactivePhase) {
        // Correct binding requires reactive involvement which doesn't
        // happen automatically when we are out of the phase. So we
        // should
        // call <code>flush()</code> explicitly.
        Reactive.flush();
    }
}
Also used : InitialPropertiesHandler(com.vaadin.client.InitialPropertiesHandler) DomElement(com.vaadin.client.flow.dom.DomElement) Element(elemental.dom.Element)

Example 2 with InitialPropertiesHandler

use of com.vaadin.client.InitialPropertiesHandler in project flow by vaadin.

the class GwtStateTreeTest method gwtSetUp.

@Override
protected void gwtSetUp() throws Exception {
    super.gwtSetUp();
    registry = new Registry() {

        {
            set(ServerConnector.class, new TestServerConnector(this));
            set(InitialPropertiesHandler.class, new InitialPropertiesHandler(this));
        }
    };
    tree = new StateTree(registry);
}
Also used : ServerConnector(com.vaadin.client.communication.ServerConnector) InitialPropertiesHandler(com.vaadin.client.InitialPropertiesHandler) Registry(com.vaadin.client.Registry)

Example 3 with InitialPropertiesHandler

use of com.vaadin.client.InitialPropertiesHandler in project flow by vaadin.

the class GwtTemplateBinderTest method gwtSetUp.

@Override
protected void gwtSetUp() throws Exception {
    super.gwtSetUp();
    registry = new Registry() {

        {
            set(TemplateRegistry.class, new TemplateRegistry());
            set(ConstantPool.class, new ConstantPool());
            set(ExistingElementMap.class, new ExistingElementMap());
            set(InitialPropertiesHandler.class, new InitialPropertiesHandler(this));
            set(StateTree.class, new StateTree(this) {

                @Override
                public void sendTemplateEventToServer(StateNode node, String methodName, JsArray<?> argValues) {
                    serverMethods.put(methodName, argValues);
                    serverRpcNodes.put(methodName, node);
                }
            });
        }
    };
    tree = registry.getStateTree();
    /**
     * This state node is ALWAYS a template !!!
     */
    stateNode = new StateNode(0, tree) {

        @Override
        public boolean hasFeature(int id) {
            if (id == NodeFeatures.TEMPLATE) {
                return true;
            }
            return super.hasFeature(id);
        }
    };
    // Use the most common model structure by default
    JsonObject modelType = Json.createObject();
    modelType.put(MODEL_KEY, "String");
    setModelType(stateNode, modelType);
}
Also used : InitialPropertiesHandler(com.vaadin.client.InitialPropertiesHandler) StateTree(com.vaadin.client.flow.StateTree) JsArray(com.vaadin.client.flow.collection.JsArray) ConstantPool(com.vaadin.client.flow.ConstantPool) StateNode(com.vaadin.client.flow.StateNode) ExistingElementMap(com.vaadin.client.ExistingElementMap) JsonObject(elemental.json.JsonObject) Registry(com.vaadin.client.Registry)

Aggregations

InitialPropertiesHandler (com.vaadin.client.InitialPropertiesHandler)3 Registry (com.vaadin.client.Registry)2 ExistingElementMap (com.vaadin.client.ExistingElementMap)1 ServerConnector (com.vaadin.client.communication.ServerConnector)1 ConstantPool (com.vaadin.client.flow.ConstantPool)1 StateNode (com.vaadin.client.flow.StateNode)1 StateTree (com.vaadin.client.flow.StateTree)1 JsArray (com.vaadin.client.flow.collection.JsArray)1 DomElement (com.vaadin.client.flow.dom.DomElement)1 Element (elemental.dom.Element)1 JsonObject (elemental.json.JsonObject)1