use of com.vaadin.client.Command in project flow by vaadin.
the class SimpleElementBindingStrategy method listenToSubPropertiesChanges.
private void listenToSubPropertiesChanges(Element htmlNode, String polymerModelPath, int subNodeIndex, Object item) {
if (item instanceof StateNode) {
StateNode stateNode = (StateNode) item;
NodeMap feature = null;
if (stateNode.hasFeature(NodeFeatures.ELEMENT_PROPERTIES)) {
feature = stateNode.getMap(NodeFeatures.ELEMENT_PROPERTIES);
} else if (stateNode.hasFeature(NodeFeatures.BASIC_TYPE_VALUE)) {
feature = stateNode.getMap(NodeFeatures.BASIC_TYPE_VALUE);
}
if (feature != null) {
feature.addPropertyAddListener(event -> {
Command command = () -> PolymerUtils.setListValueByIndex(htmlNode, polymerModelPath, subNodeIndex, PolymerUtils.convertToJson(event.getProperty()));
invokeWhenNodeIsConstructed(command, stateNode);
});
}
}
}
use of com.vaadin.client.Command in project flow by vaadin.
the class SimpleElementBindingStrategy method bindModelProperties.
private void bindModelProperties(StateNode stateNode, Element htmlNode, String path) {
Command command = () -> stateNode.getMap(NodeFeatures.ELEMENT_PROPERTIES).forEachProperty((property, key) -> bindSubProperty(stateNode, htmlNode, path, property));
invokeWhenNodeIsConstructed(command, stateNode);
}