use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class GwtMultipleBindingTest method testBindTextNodeDoubleBind.
public void testBindTextNodeDoubleBind() {
TestStateNode textNode = new TestStateNode(1, node.getTree());
Text domNode = Browser.getDocument().createTextNode("");
MapProperty textProperty = textNode.getMap(NodeFeatures.TEXT_NODE).getProperty(NodeProperties.TEXT);
Binder.bind(textNode, domNode);
textProperty.setValue("foo");
Reactive.flush();
node.setBound();
Binder.bind(textNode, domNode);
}
use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class TreeChangeProcessorTest method testMapRemoveChange.
@Test
public void testMapRemoveChange() {
MapProperty property = tree.getRootNode().getMap(ns).getProperty(myKey);
property.setValue(myValue);
JsonObject change = removeChange(rootId, ns, myKey);
StateNode node = TreeChangeProcessor.processChange(tree, change);
Assert.assertFalse(property.hasValue());
Assert.assertEquals(tree.getRootNode(), node);
}
use of com.vaadin.client.flow.nodefeature.MapProperty 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);
}
use of com.vaadin.client.flow.nodefeature.MapProperty 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);
});
}
use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class PushConfiguration method getParameters.
/**
* Gets all configured push parameters.
*
* The parameters configured on the server, including transports.
*
* @return a map of all parameters configured on the server
*/
public JsMap<String, String> getParameters() {
MapProperty p = getConfigurationMap().getProperty(PushConfigurationMap.PARAMETERS_KEY);
StateNode parametersNode = (StateNode) p.getValue();
NodeMap parametersMap = parametersNode.getMap(NodeFeatures.UI_PUSHCONFIGURATION_PARAMETERS);
JsMap<String, String> parameters = JsCollections.map();
parametersMap.forEachProperty((property, key) -> {
parameters.set(key, (String) property.getValue());
});
return parameters;
}
Aggregations