francescoNemesi
4 Aug 2009, 12:18 AM
Hello,
in my opinion the "children" instance variable (and its getter and setter methods) of com.extjs.gxt.ui.client.data.BaseTreeModel should be changed from
protected List<ModelData> children;
to
protected List<M extends ModelData> children;
The current implementation actually makes the setChildren() and getChildren() methods very unflexible for classes that extends BaseTreeModel. For these classes, in fact, one would expect their children as being as
List<MyClassesThatExtendsBaseTreeModel>
and not simply
List<ModelData>
as it is defined now. The only way round at the moment is to loop through the children using the get() and set() methods and cast explicitely from ModelData to MyClassesThatExtendsBaseTreeModel, this can be cause performance problems for large models as well as being an unnecessary coding burden for the developer.
I came across this issue while migrating to 2.0.1 from 1.2.4 where this problem was not there as BaseTreeModel was "java generically" defined. I also posted in the Help Forum here:
http://extjs.com/forum/showthread.php?t=75018
I hope I made myself clear on this.
Regards, Thanks
Francesco
in my opinion the "children" instance variable (and its getter and setter methods) of com.extjs.gxt.ui.client.data.BaseTreeModel should be changed from
protected List<ModelData> children;
to
protected List<M extends ModelData> children;
The current implementation actually makes the setChildren() and getChildren() methods very unflexible for classes that extends BaseTreeModel. For these classes, in fact, one would expect their children as being as
List<MyClassesThatExtendsBaseTreeModel>
and not simply
List<ModelData>
as it is defined now. The only way round at the moment is to loop through the children using the get() and set() methods and cast explicitely from ModelData to MyClassesThatExtendsBaseTreeModel, this can be cause performance problems for large models as well as being an unnecessary coding burden for the developer.
I came across this issue while migrating to 2.0.1 from 1.2.4 where this problem was not there as BaseTreeModel was "java generically" defined. I also posted in the Help Forum here:
http://extjs.com/forum/showthread.php?t=75018
I hope I made myself clear on this.
Regards, Thanks
Francesco