[Seaside] rendering in a class hierarchy

Stuart Herring st-lists at stuartherring.com
Sat Nov 7 00:49:58 UTC 2009


On Sat, Nov 7, 2009 at 9:27 AM, Tony Giaccone <tgiaccone at gmail.com> wrote:
>
>
> I want each of these to details to render inside  the same div on the page.
>
> <div id="DetailDisplay">
>
> <!-- in this space the detail component renders -->
>
> </div>
>
> Now it would seem very reasonable to give the parent class the
> responsibility of rendering the tag that surrounds that detail component. In
> that way any sub class of MADetailDisplay is going to be in the right
> "location" on the page.
>

In that case, your sub classes are no longer general purpose
WAComponents, but are in fact MADetailDisplay components, and
therefore it would seem reasonable that they would have a different
protocol.

Therefore I would suggest in the parent:

MADetailDisplay>>renderContentOn: html
   html div id: #DetailDisplay; with: [
       self renderDetailOn: html
   ]

MADetailDisplay>>renderDetailOn: html
   self subclassResponsibility.

Then implement #renderDetailOn: in your sub classes, rather than
#renderContentOn:

Of course, if it's important that your child components really are
general purpose WAComponents, then you have a different problem - in
that case I'd suggest you use composition instead: put the wrapping
div in a parent component (not a parent class).

Regards,
Stuart


More information about the seaside mailing list