[Magritte] MAToOneRelationDescription explanation
John McKeon
p3anoman at gmail.com
Sun Jan 31 16:52:33 MET 2010
Hello German,
On Sun, Jan 31, 2010 at 8:42 AM, Germán Arduino <garduino at gmail.com> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.iam.unibe.ch/pipermail/smallwiki/attachments/20100131/367b7e91/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Magritte-SelectionComponent.st
Type: application/octet-stream
Size: 1178 bytes
Desc: not available
URL: <http://www.iam.unibe.ch/pipermail/smallwiki/attachments/20100131/367b7e91/attachment.obj>
More information about the smallwiki
mailing list