/**
* Actively performs the binding from the Woody-form to the ObjectModel
* wrapped in a jxpath context
*/
public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
Widget widget = frmModel.getWidget(this.fieldId);
Object value = widget.getValue();
if (value != null && convertor != null) {
value = convertor.convertToString(value, convertorLocale, null);
}
Object oldValue = jxpc.getValue(this.xpath);
if (getLogger().isDebugEnabled()) {
getLogger().debug("value= " + value + "-- oldvalue=" + oldValue);
}
boolean update = false;
if ((value == null && oldValue != null) || value != null && !value.equals(oldValue)) {
// first update the value itself
jxpc.createPathAndSetValue(this.xpath, value);
// now perform any other bindings that need to be performed when the value is updated
JXPathContext subContext = null;
try {
subContext = jxpc.getRelativeContext(jxpc.getPointer(this.xpath));
} catch (JXPathException e) {
// if the value has been set to null and the underlying model is a bean, then
// JXPath will not be able to create a relative context
if (getLogger().isDebugEnabled()) {
getLogger().debug("(Ignorable) problem binding field " + widget.getFullyQualifiedId(), e);
}
}
if (subContext != null) {
this.updateBinding.saveFormToModel(frmModel, subContext);
}