Search in sources :

Example 16 with NodeMap

use of com.vaadin.client.flow.nodefeature.NodeMap in project flow by vaadin.

the class GwtMultipleBindingTest method testBindShadowRootDoubleBind.

public void testBindShadowRootDoubleBind() {
    Binder.bind(node, element);
    NodeMap shadow = node.getMap(NodeFeatures.SHADOW_ROOT_DATA);
    shadow.getProperty(NodeProperties.SHADOW_ROOT).setValue(createChild(1));
    Reactive.flush();
    node.setBound();
    Binder.bind(node, element);
}
Also used : NodeMap(com.vaadin.client.flow.nodefeature.NodeMap)

Example 17 with NodeMap

use of com.vaadin.client.flow.nodefeature.NodeMap in project flow by vaadin.

the class GwtMultipleBindingTest method assertMapPropertiesDoubleBind.

private void assertMapPropertiesDoubleBind(int featureId) {
    Binder.bind(node, element);
    NodeMap props = node.getMap(featureId);
    props.getProperty("foo").setValue("bar");
    Reactive.flush();
    node.setBound();
    Binder.bind(node, element);
}
Also used : NodeMap(com.vaadin.client.flow.nodefeature.NodeMap)

Example 18 with NodeMap

use of com.vaadin.client.flow.nodefeature.NodeMap in project flow by vaadin.

the class StateNodeTest method testGetMapFeature.

@Test
public void testGetMapFeature() {
    NodeMap map = node.getMap(1);
    Assert.assertEquals(1, map.getId());
    List<NodeFeature> features = collectFeatures();
    Assert.assertEquals(Arrays.asList(map), features);
    NodeMap anotherMap = node.getMap(1);
    Assert.assertSame(anotherMap, map);
}
Also used : NodeFeature(com.vaadin.client.flow.nodefeature.NodeFeature) NodeMap(com.vaadin.client.flow.nodefeature.NodeMap) Test(org.junit.Test)

Example 19 with NodeMap

use of com.vaadin.client.flow.nodefeature.NodeMap in project flow by vaadin.

the class StateTreeTest method sendNodePropertySyncToServer_initialProperty_propertyIsNoSent.

@Test
public void sendNodePropertySyncToServer_initialProperty_propertyIsNoSent() {
    tree.registerNode(node);
    NodeMap map = node.getMap(NodeFeatures.ELEMENT_PROPERTIES);
    MapProperty property = new MapProperty("foo", map);
    property.setValue("bar");
    Mockito.when(propertyHandler.handlePropertyUpdate(property)).thenReturn(true);
    connector.clear();
    tree.sendNodePropertySyncToServer(property);
    connector.assertMessage(null, null, null);
}
Also used : MapProperty(com.vaadin.client.flow.nodefeature.MapProperty) NodeMap(com.vaadin.client.flow.nodefeature.NodeMap) Test(org.junit.Test)

Example 20 with NodeMap

use of com.vaadin.client.flow.nodefeature.NodeMap in project flow by vaadin.

the class PollConfigurator method observe.

/**
 * Observes the given node for poll configuration changes and configures the
 * given poller accordingly.
 *
 * @param node
 *            the node containing the poll configuration
 * @param poller
 *            the poller to configure
 */
public static void observe(StateNode node, Poller poller) {
    NodeMap configurationMap = node.getMap(NodeFeatures.POLL_CONFIGURATION);
    MapProperty pollIntervalProperty = configurationMap.getProperty(PollConfigurationMap.POLL_INTERVAL_KEY);
    pollIntervalProperty.addChangeListener(e -> {
        int interval = (int) (double) e.getNewValue();
        poller.setInterval(interval);
    });
}
Also used : MapProperty(com.vaadin.client.flow.nodefeature.MapProperty) NodeMap(com.vaadin.client.flow.nodefeature.NodeMap)

Aggregations

NodeMap (com.vaadin.client.flow.nodefeature.NodeMap)68 StateNode (com.vaadin.client.flow.StateNode)30 Element (elemental.dom.Element)21 MapProperty (com.vaadin.client.flow.nodefeature.MapProperty)20 Node (elemental.dom.Node)14 ChildSlotNode (com.vaadin.flow.template.angular.ChildSlotNode)10 ForTemplateNode (com.vaadin.flow.template.angular.ForTemplateNode)10 JsonObject (elemental.json.JsonObject)8 Test (org.junit.Test)6 DomElement (com.vaadin.client.flow.dom.DomElement)5 UpdatableModelProperties (com.vaadin.client.flow.model.UpdatableModelProperties)4 NodeList (com.vaadin.client.flow.nodefeature.NodeList)4 DomNode (com.vaadin.client.flow.dom.DomNode)3 NodeFeature (com.vaadin.client.flow.nodefeature.NodeFeature)3 Computation (com.vaadin.client.flow.reactive.Computation)3 NativeFunction (com.vaadin.client.flow.util.NativeFunction)3 JsonValue (elemental.json.JsonValue)3 Command (com.vaadin.client.Command)2 ConstantPool (com.vaadin.client.flow.ConstantPool)2 JsArray (com.vaadin.client.flow.collection.JsArray)2