[Seaside-dev] Automatic registration of children?

Nicolas Petton petton.nicolas at gmail.com
Fri Aug 13 09:47:11 UTC 2010


Hi,

Maybe I don't know Seaside enough and the following doesn't make sense,
but just in case..

Back when I was playing around with Seaside, I always found quite
annoying to have to implement #children everywhere in my components and
feared to break the back button somewhere.

We recently needed a #children like method in Iliad, so I thought about
other ways to do it.

The idea is to use a dynamic variable (let's call it
WACurrentComponent). When rendering a component, we register can
children with something like:

renderOn: aRenderer
    self withChildrenRegistrationDo: [
	...
        ...] 

withChildrenRegistrationDo: aBlock
    children := OrderedCollection new.
    WACurrentComponent value ifNotNil: [:parent |
        parent registerChild: self].
    WACurrentComponent use: self during: aBlock

registerChild: aComponent
    children add: aComponent


As I said, it works fine for us but maybe it won't for Seaside :)

Cheers!
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.squeakfoundation.org/pipermail/seaside-dev/attachments/20100813/5379eb9c/attachment.pgp


More information about the seaside-dev mailing list