eugenparaschiv
12 Sep 2008, 2:25 AM
I've been looking at the code in ComboBox and it seems to me that it tries to do way to much all at once. I propose a more natural approach to implementing it, and many other widgets in GXT.
First the ComboBox: if you need a simple ComboBox, static (no data loading), no backing model, no store, just a simple combo box, there is no way to do it. Most of the time, no data mapping is required, and GXT forces you to do it anyway. Now don't get me wrong, I love the data mapping stuff and sometimes I do need it, but this should be additional, in another class extending the basic ComboBox not included in one single implementation.
ComboBox is in fact is one of the most basic things you can do in a web page, even with HTML and in the API, it's all the way down, extending: Widget-Component-BoxComponent-Field-TextField-TriggerField-ComboBox? That a 7 level hierarchy (not taking into acount the fact that Widget is at level 3 already) for a simple combo box. Even with the GWT compiler optimisations, there must be some code bloat for a class this far down the hierarchy.
I thing it would be more natural to have simple widgets with no data mapping and place the advanced features in extensing classes. ListBox (which is the GWT combo box) is only at level 2, and so is simple to use and very lightweight. Now if this would be the case in GXT, the API would simply be so much better and what's more, the class hierarchy would be more natural as well.
One last thought. By doing this, perhaps some GWT widgets could be extended; the simple widgets could be used as basetypes and do that data loading and additional stuff could be built on top of that.
The benefits would be huge: tacking advantage of the maturity of the GWT widget library more natural interoperability with GWT, tacking advantage of an already existing code base instead of doubling the work, not having to learn two API's, and many others.
Perhaps the class hierarchy originates from the actual overall structure of Ext-JS, which is more mature. But EXT-JS is not build ON TOP of anything, and GXT is. It makes no sense to try to mirror that hierarchy exactly.
There is another post that touches on this:
http://extjs.com/forum/showthread.php?t=46922
OK, any thought? Perhaps even from Darrell, about the structural choices of the API, now and in the future.
I would really like to know what Darrell thinks about this, in terms of the probability that a change like this will be realized (or at least realizable).
Thanks.
Eugen.
First the ComboBox: if you need a simple ComboBox, static (no data loading), no backing model, no store, just a simple combo box, there is no way to do it. Most of the time, no data mapping is required, and GXT forces you to do it anyway. Now don't get me wrong, I love the data mapping stuff and sometimes I do need it, but this should be additional, in another class extending the basic ComboBox not included in one single implementation.
ComboBox is in fact is one of the most basic things you can do in a web page, even with HTML and in the API, it's all the way down, extending: Widget-Component-BoxComponent-Field-TextField-TriggerField-ComboBox? That a 7 level hierarchy (not taking into acount the fact that Widget is at level 3 already) for a simple combo box. Even with the GWT compiler optimisations, there must be some code bloat for a class this far down the hierarchy.
I thing it would be more natural to have simple widgets with no data mapping and place the advanced features in extensing classes. ListBox (which is the GWT combo box) is only at level 2, and so is simple to use and very lightweight. Now if this would be the case in GXT, the API would simply be so much better and what's more, the class hierarchy would be more natural as well.
One last thought. By doing this, perhaps some GWT widgets could be extended; the simple widgets could be used as basetypes and do that data loading and additional stuff could be built on top of that.
The benefits would be huge: tacking advantage of the maturity of the GWT widget library more natural interoperability with GWT, tacking advantage of an already existing code base instead of doubling the work, not having to learn two API's, and many others.
Perhaps the class hierarchy originates from the actual overall structure of Ext-JS, which is more mature. But EXT-JS is not build ON TOP of anything, and GXT is. It makes no sense to try to mirror that hierarchy exactly.
There is another post that touches on this:
http://extjs.com/forum/showthread.php?t=46922
OK, any thought? Perhaps even from Darrell, about the structural choices of the API, now and in the future.
I would really like to know what Darrell thinks about this, in terms of the probability that a change like this will be realized (or at least realizable).
Thanks.
Eugen.