I was reading this thread:
http://forum.springframework.com/vie...d6072 806aaeb
and almost posted an answer I thought would work, but I tried it out, and was surprised it didn't.
I figured you could bind map properties just like normal properties using the map propertyname spec: "attributes[key]". Doesn't work. I want to do:
I should get a control that edits a string. I was suprised it didn't work, because this works:Code:public class Foo { private Map m_attributes = new HashMap(); public Foo() { m_attributes.put("myprop", "myvalue"); } } ... SwingFormModel swingFormModel = SwingFormModel.createFormModel(new Foo(), true); ... swingFormModel.createBoundControl("attributes[myprop]");
The problem lies in the BeanPropertyAccessStrategyCode:BeanWrapperImpl beanWrapper = new BeanWrapperImpl(); beanWrapper.setWrappedInstance(new Foo()); beanWrapper.setPropertyValue("attributes[foo]", new String("hello"));
1) Not using the BeanWrapper to correctly get the type
2) SwingFormModel (and others) not consistently asking just the BeanPropertyAccessStrategy for the type of a propertyName (sometimes it uses some ClassUtils stuff).
I've got a patch in progress, but I was wondering how to submit, because the changes are both in spring sandbox and springrc.
Thanks


Reply With Quote