use of reference in a MARelationDescription

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

use of reference in a MARelationDescription

cbeler
Hi :)

I try to use a MARelationDescription with an object that fetch its
description automatically from instances... and I have a problem...

To illustrate, let's take the Magritte tutorial example with 2 model
classes MAPersonModel and MAAdressModel.

In MAPersonModel we have an inst var homeAdress with the corresponding
description on the class side:

MAPersonModel class>>descriptionHomeAddress
    ^ (MAToOneRelationDescription auto: 'homeAddress' label: 'Home
Address' priority: 40)
        componentClass: MAInternalEditorComponent;
        classes: (Array with: MAAddressModel);
        yourself.

and that is enough because MAAdressModel has its descriptions defined
(class side). But if descriptions were accessed from instance of
MAAdressModel like:

MAAdressModel>>descriptionGenerated
    ^MAPriorityDescription new   add: (MAStringDescription auto:
'street' label: 'Street' priority: 10);
                                                       add:
(MAStringDescription auto: 'place' label: 'Place' priority: 30);
                                                       ...
                                                       yourself.

Then I was thinking it was possible to create the previous description
in the following way (say there are no more desciption in the class side
of MAAdressModel):

MAPersonModel class>>descriptionHomeAddress
    ^ (MAToOneRelationDescription auto: 'homeAddress' label: 'Home
Address' priority: 40)
   ***reference: MAAdessModel new descriptionGenerated;***
        componentClass: MAInternalEditorComponent;
        classes: (Array with: MAAddressModel);   *no more description in
the class side of MAAddressModel*
        yourself.

I know in this exemple, the interest of doing that is not obvious but
this is because in my case, I have specific description for instances
(one part is general whereas the other is created with values affected
to the object).


Is it possible to do that way ?
what is the correct use of #reference: for a MARelationDescription ?  
choosing a kind of container ?

Is there a built-in way to use different descriptions (filtered for
instance) than the one accessed from the classe that are in ToOne or
ToMany relation ?


Thank you

Cédrick



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: use of reference in a MARelationDescription

Damien Cassou-3
Hi,

I'm not sure it will help, but did you had a look to MADynamicObject
(and the #on: method implement in MAProxyObject) ?

--
Damien Cassou


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki