[Magritte] MAToOneRelationDescription explanation

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

[Magritte] MAToOneRelationDescription explanation

garduino
Hi:

I'm a bit confused using relationships between objects in Magritte.
Let's start with MAToOneRelationDescription.

I've a Contracts system were each contract have 1:1 Relation with
Suppliers (another collection of the system), then on the form
to add contracts, on the place of Supplier I wants to show a combo
with, for example, all the suppliers names loaded on the
suppliers collection, to select one to use in the current contract.
Very common need I think (Is the way I used to do with Mewa).

But trying with different options (not found much doc about each
possible method to use on MAToOneRelationDescription) I get
a "create" button than, certainly, is not what I need and really not
understand the fundamentals of this button on a single 1:1
relationship.

Any clarification about this topic, examples, documentation, etc will
be greatly appreciated.

BTW, I'm using Seaside 3.0 with installed on Pharo rc2 with the
Configuration provided by Dale.

Cheers.
--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================

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

Re: [Magritte] MAToOneRelationDescription explanation

John McKeon
Hello German,

On Sun, Jan 31, 2010 at 8:42 AM, Germán Arduino <[hidden email]> wrote:
Hi:

I'm a bit confused using relationships between objects in Magritte.
Let's start with MAToOneRelationDescription.

I've a Contracts system were each contract have 1:1 Relation with
Suppliers (another collection of the system), then on the form
to add contracts, on the place of Supplier I wants to show a combo
with, for example, all the suppliers names loaded on the
suppliers collection, to select one to use in the current contract.
Very common need I think (Is the way I used to do with Mewa).

But trying with different options (not found much doc about each
possible method to use on MAToOneRelationDescription) I get
a "create" button than, certainly, is not what I need and really not
understand the fundamentals of this button on a single 1:1
relationship.

On the class side of MAToOneRelationDescription the defaultComponentClasses method returns an array with two component classes: MAExternalEditorComponent and MAInternalEditorComponent. By default, the first of these is what you are seeing rendered. To override this behavior you have to send componentClass: to your description. Magritte does not come with a select list component for the MAToOneRelationDescription but it is easy to create one descended from MAOneToOneComponent that will render a select list of all the instances of the classes declared in the classes: message sent to the description. So your descriptionSupplier method might look like:

^MAToOneRelationDescription new
   classes: (Array with: Supplier);
   componentClass: NewSelectionComponent;
   accessor: #supplier;
   &etc

I threw one together and attached the FileOut of it. It is descended from the ExternalEditor component so it renders a Create button as well.

One caveat, I am using Seaside 2.8

Hope this helps 
John
 
Any clarification about this topic, examples, documentation, etc will
be greatly appreciated.

BTW, I'm using Seaside 3.0 with installed on Pharo rc2 with the
Configuration provided by Dale.

Cheers.
--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================

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



--
http://jmck.seasidehosting.st

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

Magritte-SelectionComponent.st (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Magritte] MAToOneRelationDescription explanation

garduino
Thanks John by the explanation and the example!! As usual with your
mails, very very clear.

I will try to avoid the create button or include the create (as "New
Supplier" or so) on the combo list, as
Gmail does with the tags of the mails.

Thanks again.
Germán.


2010/1/31 John McKeon <[hidden email]>:

> Hello German,
> On Sun, Jan 31, 2010 at 8:42 AM, Germán Arduino <[hidden email]> wrote:
>>
>> Hi:
>>
>> I'm a bit confused using relationships between objects in Magritte.
>> Let's start with MAToOneRelationDescription.
>>
>> I've a Contracts system were each contract have 1:1 Relation with
>> Suppliers (another collection of the system), then on the form
>> to add contracts, on the place of Supplier I wants to show a combo
>> with, for example, all the suppliers names loaded on the
>> suppliers collection, to select one to use in the current contract.
>> Very common need I think (Is the way I used to do with Mewa).
>>
>> But trying with different options (not found much doc about each
>> possible method to use on MAToOneRelationDescription) I get
>> a "create" button than, certainly, is not what I need and really not
>> understand the fundamentals of this button on a single 1:1
>> relationship.
>>
> On the class side of MAToOneRelationDescription the defaultComponentClasses
> method returns an array with two component classes:
> MAExternalEditorComponent and MAInternalEditorComponent. By default, the
> first of these is what you are seeing rendered. To override this behavior
> you have to send componentClass: to your description. Magritte does not come
> with a select list component for the MAToOneRelationDescription but it is
> easy to create one descended from MAOneToOneComponent that will render a
> select list of all the instances of the classes declared in the classes:
> message sent to the description. So your descriptionSupplier method might
> look like:
> ^MAToOneRelationDescription new
>    classes: (Array with: Supplier);
>    componentClass: NewSelectionComponent;
>    accessor: #supplier;
>    &etc
> I threw one together and attached the FileOut of it. It is descended from
> the ExternalEditor component so it renders a Create button as well.
> One caveat, I am using Seaside 2.8
> Hope this helps
> John
>
>>
>> Any clarification about this topic, examples, documentation, etc will
>> be greatly appreciated.
>>
>> BTW, I'm using Seaside 3.0 with installed on Pharo rc2 with the
>> Configuration provided by Dale.
>>
>> Cheers.
>> --
>> =================================================
>> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
>> Arduino Software & Web Hosting   http://www.arduinosoftware.com
>> PasswordsPro  http://www.passwordspro.com
>> =================================================
>>
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
>
>
> --
> http://jmck.seasidehosting.st
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>

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