PDA

View Full Version : [1.2.3] BeanModel getProperties returns empty map



The_Jackal
8 Mar 2009, 8:42 PM
BeanModel getProperties() returns an empty map while getPropertyNames() returns a collection of the properties.

Debugging shows that the map field is null - even after an explicit set is called.

I propose that getProperties should override the getProperties in BaseModelData and return the beanProperties (much like the getPropertyNames method does).

Currently it means that to set one BeanModel from another I have to do this:



Collection<String> props = source.getPropertyNames();
for (String prop : props)
{
target.set(prop, source.get(prop));
}
where I'd like to do this:


target.setProperties(source.getProperties());

xferron
20 Mar 2009, 11:04 PM
Sadly, I reported this problem a while back when the bug existed in 1.2.2 and no one replied or did anything.

The bug unfortunately still didn't get fixed in 1.2.3.

The main reason behind the problem is that BeanModel generator doesn't generate a corresponding getProperties() method to override the ModelData's base getProperties() method. What this means is that when you call getProperties(), you're actually getting the properties in the BaseModelData's hashmap properties, which BeanModel doesn't use.

Currently, I'm doing the same thing you are when it comes to dealing with this. However, there are many dependencies on this getProperties() method in the GXT library, ie. DataViewBinder. So basically, ANY component that uses getProperties() will fail horribly when you use a BeanModel. :(

Please fix this, GXT team. It'd be greatly appreciated!