Initialisation of componentClass
Iwan Vosloo <[email protected]>
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <[email protected]> |
Hi there,
We have an issue related to magritte-seaside.
When you set the Component to be used on a MADescription, eg:
descriptionThings
^ MAToManyRelationDescription new
...
componentClass: MyFancyTableComponent;
yourself
.. then there is no way (that I am aware of) to initialize the created
MyFancyTableComponent in a customised way.
In the example above, for instance one may have a MyFancyTableComponent
that divides its items into several pages (like an MAReport would do).
The number of items displayed per page has to be hard-coded in
MyFancyTableComponent. It would be nice to have a way to initialize a
newly created instance, something like:
descriptionThings
^ MAToManyRelationDescription new
...
componentClass: MyFancyTableComponent;
initializeComponent: [ :newlyCreatedComponent|
newlyCreatedComponent itemsPerPage: 40 ];
yourself
There are, of course, several ways one could do this. I am not
necessarily suggesting the above example as the way to do it... I am
just illustrating the point.
If you do not have such a mechanism, the only thing you can do is
subclass MyFancyTableComponent with the express motivation - to be able
to set a new instance up a certain way. We have a log of code that does
this sort of subclassing. It makes things go really messy eventually.
We'd like to get rid of all those subclasses and rather let the user of
a component 'configure' it appropriately.
Building something like what I am proposing means changes to
magritte-seaside code though. So, if we do it we'd prefer to contribute
upstream.
Has anyone else come across this issue? Any ideas? Worthwhile to others too?
Regards
- Iwan
--
Reahl, the Python only web framework: http://www.reahl.org