Ok, this seems to work, slight modification from yours to prevent the cascade accessor
from being added more than once, otherwise every render built up long chains of cascading
accessors, does this seem right? Also, any way to add a label or something to each group
of fields?
orderView := (anOrder description
, (anOrder billingAddress description collect:
[:ea |
(ea accessor isKindOf: MACascadeAccessor)
ifFalse:
[ea accessor: (MACascadeAccessor
accessor: (MASelectorAccessor selector: #billingAddress)
next: ea accessor)].
ea])
, (anOrder shippingAddress description collect:
[:ea |
(ea accessor isKindOf: MACascadeAccessor)
ifFalse:
[ea accessor: (MACascadeAccessor
accessor: (MASelectorAccessor selector: #shippingAddress)
next: ea accessor)].
ea])
asComponentOn: anOrder) addValidatedForm: #(#update #cancel )
________________________________
From: Lukas Renggli [mailto:renggli@iam.unibe.ch]
Sent: Thu 10/13/2005 11:51 PM
To: Ramon Leon
Cc: SmallWiki Mailing List
Subject: Re: Quick Question about Magritte
Since reference descriptors aren't working yet,
I'm wondering how I
can fake it manually. Is there a way to take several objects and
combine their descriptions and then generate a component from
that? Currently if I ask for (anOrder description, anOrder address
description) asComponent, I get an editor for the descriptions
rather than the instances.
Yes, that is possible:
combined := obj1 description , obj2 description.
Probably you need to modify the description of the referenced object,
somehow like this (untested, just quickly put together):
combined := obj1 description , (obj2 description
collect: [ :ea |
" change accessors of obj2 go trough the selector
#reference that is called on obj1 "
ea accessor: (MACascadeAccessor
accessor: (MASelectorAccessor
selector: #reference)
next: ea accessor) ].
Hope this helps,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch