this.convertor = convertor;
this.convertorLocale = convertorLocale;
}
public void doLoad(Widget frmModel, JXPathContext jctx) throws BindingException {
Widget widget = selectWidget(frmModel,this.multiValueId);
if (widget == null) {
throw new BindingException("The widget with the ID [" + this.multiValueId
+ "] referenced in the binding does not exist in the form definition.");
}
// Move to multi value context
Pointer ptr = jctx.getPointer(this.multiValuePath);
if (ptr.getNode() != null) {
// There are some nodes to load from
JXPathContext multiValueContext = jctx.getRelativeContext(ptr);
// build a jxpath iterator for pointers
Iterator rowPointers = multiValueContext.iterate(this.rowPath);
LinkedList list = new LinkedList();
while (rowPointers.hasNext()) {
Object value = rowPointers.next();
if (value != null && convertor != null) {
if (value instanceof String) {
ConversionResult conversionResult = convertor.convertFromString((String)value, convertorLocale, null);
if (conversionResult.isSuccessful())
value = conversionResult.getResult();
else
value = null;
} else {
getLogger().warn("Convertor ignored on backend-value which isn't of type String.");
}
}
list.add(value);
}
widget.setValue(list.toArray());
}
if (getLogger().isDebugEnabled())
getLogger().debug("done loading values " + toString());
}