View Full Version : Questions about grid columnModel objects

6 Oct 2006, 7:51 AM

I'm looking at your AbstractColumnModel and DefaultColumnModel classes as a template to buid something I'm working on. There's a couple things that seem a little odd - maybe just things to be cleaned up.

1) in ACM there's a couple methods that refer to DCM methods (getRenderer, getSortType). I imagine it works b/c it's not true OO, but I would think it less cofusing if they returned some dummy values e.g. maybe just an anon fn that returned blank??

2) the DCM.defaultRenderer method doesn't include 'prototype'. None of the 'sortTypes' methods do either. Is there a need for each instance to carry it's own version of these?

I don't think any of these are breaking anything - I'm a C# guy, so the OO stuff tends to stick out.


6 Oct 2006, 8:57 PM
1) The AbstractColumnModel was broken out from DefaultColumnModel at some point. The sortTypes and defaultRenderer remained on DefaultColumnModel to maintain backwards compatibility (I didn't want to move them and break peoples code). The stub implementations are there so that creating a new ColumnModel, you wouldn't have to implement the methods if you didn't need the functionality.

Ideally, the definitions for those referenced functions would be on AbstractColumnModel but breaking existing code to move them there wasn't an option so they stayed put.

2) It you take a look again you will see it isn't defined on the prototype, it is actually a static object on DefaultColumnModel. This means all instances of DefaultColumnModel do share the same function.