[Seaside] Suggestions for WAHtmlRenderer

David Röthlisberger davidroe at bluewin.ch
Sun Aug 22 21:33:04 CEST 2004

> Should the selection/callback be passed collections instead of individual
> objects?  Or should the callback be invoked multiple times?

Yes, that's what I have tried to implement: For all possible options in the
list, I pass a collection, and all the options that should be pre-selected
are also passed as a collection. The callback should be invoked multiple
times; for instance I have a callback block like this:
[:item | self addItem: item]
For every selected item this block should be evaluated once; and every
selected item will be added to a collection of items in my component,
with #addItem:

I think that would be the easiest interface. A collection of callbacks may
be useful in some cases, but most of the time it wouldn't be necessary, but
makes things more complicate.

> Are there some other options that would be easier (collection of selected
> + collection of unselected?)

That wouldn't be easier, I think. I have an application in mind, where's a
model behind that holds a collection of all possible options for a select
list. Furthermore there is a method that may iterate over these possible
items and collect the items that should be selected. Or these selected items
are already stored in another collection. But most of the time all possible
items for a select list are well known, and the selected one's will be
calculated out of these, but a strict destinction between selected and
unselected options in separate collections is rare, I think.

> Yup; the only question is how to separate them.  Probably the cleanest
> is to create an unordered list, with one list item for each
> checkbox/radio, and the text in a corresponding <label> tag?

yes, that's a nice idea, I like that.

> A collection of radio buttons should have the same basic interface as a
> single select list; a collection of checkboxes should be the same as a
> multiselect list.  So we have to decide how that should look, first.

For a collection of radio buttons, we would have a collection of items, a
selected object and one callback block as parameters. Furthermore a
labelsBlock would make sense too, like in #selectFromList: aCollection
selected: selectedObject callback: callbackBlock labels: labelsBlock

For a collection of checkboxes it should be a collection of possible items,
a collection of selected items and one callback block.
But maybe other people have other ideas?

> Anyway, I'll put these all on my TODO list, but patches are also
> welcome.

great, thanks!


More information about the Seaside mailing list