Instance based description in Magritte

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

Instance based description in Magritte

Bany, Michel
Instance based description in Magritte

This is a question for Lukas.

I need to display an object of class A that holds a collection of other objects of class B.
The collection is described using a subclass of MAToManyRelationDescription.

The description of the objects in class B needs to be instance based. All the objects in one collection have the same description, however class B is not able to provide a description.

How can I do this?

TIA
Michel.
 



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Instance based description in Magritte

Lukas Renggli-2
> The description of the objects in class B needs to be instance  
> based. All the objects in one collection have the same description,  
> however class B is not able to provide a description.
>
You can override #description on the instance side to either build  
your descriptions on the fly or to modify the ones returned by the  
class. For example:

    B>>description
       ^ super description collect: [ :each |
          (each isKindOf: MAToManyDescription)
             ifTrue: [ each copy classes: self dynamicClasses ]
             ifFalse: [ each ] ]

You find many other possible solutions in the mailing-list archive and  
some additional information in the FAQ:

    http://www.lukas-renggli.ch/smalltalk/magritte/faq

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch


_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

RE: Instance based description in Magritte

Bany, Michel
Yes, I knew about #description on the instance side, but my question was
not precise enough. I wanted an on-the-fly description for the
collection so that the MAReport is dynamically configured.

I finally got the desired behavior simply by subclassing
MAOneToManyComponent and re-implementing #reference. This also gave me
the possibility to offer a UI on the description for hiding/showing
columns in the report. Magritte is really cool.

Thanks,
Michel.
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Lukas Renggli
> Sent: vendredi, 21. mars 2008 18:33
> To: Magritte, Pier and Related Tools ...
> Subject: Re: Instance based description in Magritte
>
> > The description of the objects in class B needs to be
> instance based.
> > All the objects in one collection have the same
> description, however
> > class B is not able to provide a description.
> >
> You can override #description on the instance side to either
> build your descriptions on the fly or to modify the ones
> returned by the class. For example:
>
>     B>>description
>        ^ super description collect: [ :each |
>           (each isKindOf: MAToManyDescription)
>              ifTrue: [ each copy classes: self dynamicClasses ]
>              ifFalse: [ each ] ]
>
> You find many other possible solutions in the mailing-list
> archive and some additional information in the FAQ:
>
>     http://www.lukas-renggli.ch/smalltalk/magritte/faq
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
>
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>


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