ToOneRelatedEntityReloader to listen and operate on PropertyDatasources directly?
This idea came up while working on #7586.
ToOneRelatedEntityReloader is attached as
ValueChangeListener to fields and changes the value of the field.
This value is then passed to the datasource contained in the fiels. The
AbstractField.setValue() does a quality check do prevent from useless operations in cases the value does not really change. This fails however with cdm entities since the quality of cdm entities is a domain entity euqality not a java object equality. Therefore the equality check in
com.vaadin.ui.AbstractField.setValue() is being tricked out by the following code:
toOneRelatedEntityField.setValue(null); // reset to trick equals check in vaadin toOneRelatedEntityField.setValue(cachedEntity);
Instead ToOneRelatedEntityReloader could operate on the datasource directly, so the calling setvalue() twice would no longer be needed.