PDA

View Full Version : [FIXED] [PATCH] Make BaseModelStringProvider generic



negge
2 Jul 2008, 4:13 AM
Right now BaseModelStringProvider simply extends ModelStringProvider without specifying a generic type. It would be nice if you could extend BaseModelStringProvider, override the logic for a given property, and call super for any fields that you want the default behavior for.

This patch makes BaseModelStringProvider generic so that you don't need to cast your model object:


--- user/src/com/extjs/gxt/ui/client/data/BaseModelStringProvider.java (revision 539)
+++ user/src/com/extjs/gxt/ui/client/data/BaseModelStringProvider.java (working copy)
@@ -11,9 +11,9 @@
* Basic implementation of the <code>ModelStringProvider</code> interface.
* Simply calls toSring on the value.
*/
-public class BaseModelStringProvider implements ModelStringProvider {
+public class BaseModelStringProvider<M extends ModelData> implements ModelStringProvider<M> {

- public String getStringValue(ModelData model, String property) {
+ public String getStringValue(M model, String property) {
Object value = model.get(property);
return value == null ? "" : value.toString();
}Nathan

darrellmeyer
2 Jul 2008, 7:05 AM
Fix is in SVN.