Generic Collection Editor?

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

Generic Collection Editor?

Udo Schneider
All,

I'm having problem understanding how to customize Magritte/Seaside.

I have an object PXADataType with the following description:

descriptionValues
        ^ MAToManyRelationDescription new
                classes: (Array
                                with: PXAQuantityValue
                                with: PXAQualityValue);
                accessor: #values;
                label: 'Werte';
                priority: 100;
                beDefinitive;
                beOrdered;
                yourself

This object has a collection of values accessible by #values where the
collection items can be of type PXAQuantityValue or PXAQualityValue.

When I call: an edit form on PXADataType using "(aPXADataType
descriptionEdit asComponentOn: aPXADataType) addValidatedForm" I do get
the values rendered as a report. However the only possibility to edit
the collection is by changing the order using "up"/"down".

What I would like to do is a extended report with a possibility to
add/change/delete the entries?

How can I change the default behaviour in this case?

Thanks for your help.

CU,

udo


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

Re: Generic Collection Editor?

Lukas Renggli
> What I would like to do is a extended report with a possibility to
> add/change/delete the entries?

Remove the line

         beDefinitive;

from your description.

Cheers,
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: Generic Collection Editor?

Udo Schneider
Lukas Renggli schrieb:
> Remove the line
>
>          beDefinitive;
>
> from your description.
That's it! Thank you very much. Something like this can happen when I
simply cut&paste code. .... however now I know what #isDefinitve is for :-)

CU,

Udo


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

Re: Generic Collection Editor?

Udo Schneider
In reply to this post by Lukas Renggli
Lukas Renggli schrieb:
> Remove the line
>
>          beDefinitive;
>
> from your description.
That's working now - thanks for your help. I'm struggling a bit with
instance creation now.

Is it possible to customize instance creation in a report. I.e. when I
provide a collection of classes to #classes: then the instance creation
when I press "Add" is simply done by sending #new.

How can I customize this? I though about having a block which provides a
new instance or some way to pre-provide new instances but did not find
something like this.

What's the Magritte way to do it?

Thanks,

Udo


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

Re: Generic Collection Editor?

Lukas Renggli
> How can I customize this? I though about having a block which provides a new
> instance or some way to pre-provide new instances but did not find something
> like this.

Object creation is not really modelled in Magritte.

What you could do is to create a subclass of MAOneToManyComponent,
specify that in #componentClass: of your description and override
#add. This is where #new is called.

When building Magritte I found it very difficult for 1:1 and 1:m
relations to get generally useful semantics and user-interfaces. What
Magritte does by default might make sense in a some cases, but usually
you need to go a bit deeper and write some glue code to make it
cleanly integrate into your application.

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: Generic Collection Editor?

Udo Schneider
Lukas Renggli schrieb:
> What you could do is to create a subclass of MAOneToManyComponent,
> specify that in #componentClass: of your description and override
> #add. This is where #new is called.
Thanks for the update - I thought I simply missed something. I'll go the
subclass path then.

> When building Magritte I found it very difficult for 1:1 and 1:m
> relations to get generally useful semantics and user-interfaces. What
> Magritte does by default might make sense in a some cases, but usually
> you need to go a bit deeper and write some glue code to make it
> cleanly integrate into your application.
Thanks for the explenation - I have to admit that even with those
"limitations" Magritte simply blows me away! I enhanced my model classes
a bit to play nicer with Magritte and alreay threw away hundreds of
lines of manual Seaside code already! I love it! :-)

CU,

Udo


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