use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class LoadingIndicatorConfigurator method observe.
/**
* Observes the given node for loading indicator configuration changes and
* configures the loading indicator singleton accordingly.
*
* @param node
* the node containing the loading indicator configuration
*/
public static void observe(StateNode node) {
NodeMap configMap = node.getMap(NodeFeatures.LOADING_INDICATOR_CONFIGURATION);
bindInteger(configMap, LoadingIndicatorConfigurationMap.FIRST_DELAY_KEY, LoadingIndicatorConfigurator::setFirstDelay, LoadingIndicatorConfigurationMap.FIRST_DELAY_DEFAULT);
bindInteger(configMap, LoadingIndicatorConfigurationMap.SECOND_DELAY_KEY, LoadingIndicatorConfigurator::setSecondDelay, LoadingIndicatorConfigurationMap.SECOND_DELAY_DEFAULT);
bindInteger(configMap, LoadingIndicatorConfigurationMap.THIRD_DELAY_KEY, LoadingIndicatorConfigurator::setThirdDelay, LoadingIndicatorConfigurationMap.THIRD_DELAY_DEFAULT);
MapProperty defaultThemeProperty = configMap.getProperty(LoadingIndicatorConfigurationMap.DEFAULT_THEME_APPLIED_KEY);
defaultThemeProperty.addChangeListener(event -> setApplyDefaultTheme(event.getSource().getValueOrDefault(LoadingIndicatorConfigurationMap.DEFAULT_THEME_APPLIED_DEFAULT)));
}
use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class SimpleElementBindingStrategy method restoreInitialHiddenAttribute.
private void restoreInitialHiddenAttribute(Element element, NodeMap visibilityData) {
storeInitialHiddenAttribute(element, visibilityData);
MapProperty initialVisibility = visibilityData.getProperty(NodeProperties.VISIBILITY_HIDDEN_PROPERTY);
if (initialVisibility.hasValue()) {
updateAttributeValue(visibilityData.getNode().getTree().getRegistry().getApplicationConfiguration(), element, HIDDEN_ATTRIBUTE, initialVisibility.getValue());
}
MapProperty initialDisplay = visibilityData.getProperty(NodeProperties.VISIBILITY_STYLE_DISPLAY_PROPERTY);
if (initialDisplay.hasValue()) {
final String initialValue = initialDisplay.getValue().toString();
element.getStyle().setDisplay(initialValue);
}
}
use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class SimpleElementBindingStrategy method storeInitialHiddenAttribute.
private void storeInitialHiddenAttribute(Element element, NodeMap visibilityData) {
MapProperty initialVisibility = visibilityData.getProperty(NodeProperties.VISIBILITY_HIDDEN_PROPERTY);
if (!initialVisibility.hasValue()) {
initialVisibility.setValue(element.getAttribute(HIDDEN_ATTRIBUTE));
}
MapProperty initialDisplay = visibilityData.getProperty(NodeProperties.VISIBILITY_STYLE_DISPLAY_PROPERTY);
if (PolymerUtils.isInShadowRoot(element) && !initialDisplay.hasValue() && element.getStyle() != null) {
initialDisplay.setValue(element.getStyle().getDisplay());
}
}
use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class InitialPropertiesHandler method doFlushPropertyUpdates.
private void doFlushPropertyUpdates(JsMap<Double, JsMap<String, Object>> properties) {
newNodeDuringUpdate.clear();
while (propertyUpdateQueue.length() > 0) {
MapProperty property = propertyUpdateQueue.remove(0);
if (!resetProperty(property, properties)) {
getRegistry().getStateTree().sendNodePropertySyncToServer(property);
}
/*
* Do flush after each property update. There may be several
* properties and it looks like a property update may trigger
* default values of other properties back.
*
* See https://github.com/vaadin/flow/issues/2304
*/
Reactive.flush();
}
}
use of com.vaadin.client.flow.nodefeature.MapProperty in project flow by vaadin.
the class GwtBasicElementBinderTest method testRemovedEventNotFired.
public void testRemovedEventNotFired() {
Binder.bind(node, element);
MapProperty clickEvent = node.getMap(NodeFeatures.ELEMENT_LISTENERS).getProperty("click");
clickEvent.setValue(Double.valueOf(1));
Reactive.flush();
clickEvent.removeValue();
Reactive.flush();
element.click();
assertEquals(0, tree.collectedNodes.length());
}
Aggregations