*
* @param vo
* Value Object to write to.
*/
public void readFormBean(Object vo) {
BeanMapper beanMapper = new BeanMapper(vo.getClass());
for (Iterator i = compositeFormElement.getElements().entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
GenericFormElement element = (GenericFormElement) entry.getValue();
String elementId = (String) entry.getKey();
if (element instanceof FormElement) {
if (beanMapper.fieldIsWritable(elementId)) {
Data data = ((FormElement) element).getData();
if (data != null) {
beanMapper.setBeanFieldValue(vo, elementId, data.getValue());
}
}
}
else if (element instanceof FormWidget) {
if (beanMapper.fieldIsWritable(elementId)) {
BeanFormReader subVoReader = new BeanFormReader((FormWidget) element);
beanMapper.setBeanFieldValue(vo, elementId, subVoReader.getBean(beanMapper.getBeanFieldType(elementId)));
}
}
}
}