Customizing views in Magritte

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

Customizing views in Magritte

NorbertHartl
Hi,

at the moment I'm playing with magritte to test if it is
suitable for my web application which is done with seaside.

I created a model and I'm able to use it as a component with
seaside. I have a model where ClassA has a 1:m relationship
to ClassB. The exception here is that there is a fixed set
of possible instances for ClassB to choose for the reference
from ClassA.
So what I need on the html rendering side is a kind of a
pull-down and not an extra form for creating new instances of
ClassB.

I read the tutorial.pdf. There are three  possibilities mentioned
to customize the views for the model. Unfortunately I didn't
figure out how this is working. The mentioned method defaultContainer
(which should be overridden) doesn't exist in the magritte version
I use. (I is the newest from Monticello)

I even tried to set a new componentClass in the descriptionFoo
class method.But with no effect. I'm not sure what I'm doing
wrong. Magritte seems to ignore every step I take to customize.
What would be the best way to customize on the class or even
better on description instance side?

Why is there an extra componentRenderer? As far as I figured
it out componentRenderer is container dependent. What is the
reason for having a additional method componentRenderer?

What are the best practices for wiring magritte components
together? The only way I found is to use onAnswer:.

thanks in advance,

Norbert


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Customizing views in Magritte

Lukas Renggli
On 11/27/06, Norbert Hartl <[hidden email]> wrote:
> Hi,
>
> at the moment I'm playing with magritte to test if it is
> suitable for my web application which is done with seaside.

In the Pier mailing list I replayed:

From: Lukas Renggli <[hidden email]>
Date: 27 November 2006 16:47:29 GMT+01:00
To: "Magritte, Pier and Related Tools ..." <[hidden email]>
Subject: Re: Customizing views in Magritte

Hi Norbert,

> I created a model and I'm able to use it as a component with
> seaside. I have a model where ClassA has a 1:m relationship
> to ClassB. The exception here is that there is a fixed set
> of possible instances for ClassB to choose for the reference
> from ClassA.

Then you should use the MAMultipleOptionDescription and you get 3
possibilites to choose Widgets from: MAMultiselectListComponent
(default), MACheckboxGroupComponent and MAListCompositonComponent.
(see slide 41)

> I read the tutorial.pdf. There are three  possibilities mentioned
> to customize the views for the model. Unfortunately I didn't
> figure out how this is working. The mentioned method defaultContainer
> (which should be overridden) doesn't exist in the magritte version
> I use. (I is the newest from Monticello)

#defaultContainer has been renamed to #descriptionContainer some time
ago. I have updated slides in the pipeline that I will use during a
Magritte tutorial next Monday, however they are not quite ready yet.

> I even tried to set a new componentClass in the descriptionFoo
> class method.But with no effect. I'm not sure what I'm doing
> wrong. Magritte seems to ignore every step I take to customize.
> What would be the best way to customize on the class or even
> better on description instance side?

In the Pier Unix Security package there is the following use of
MAMultipleOptionDescription, where the user can choose among different
permission objects in an 1:m relation:

PUChangeSecurity>>descriptionPermissions
        ^ (MAMultipleOptionDescription selector: #permissions label:
'Permissions' priority: 310)
                comment: 'Defines the set of permissions used together with the
selected operation.';
                options: self permissionInstances;
                reference: PUPermission description;
                beSorted;
                yourself

As I wrote above this is using MAMultiselectListComponent as a Seaside
component. If you want to use checkboxes instead of a list you could
add "componentClass: MACheckboxGroupComponent" to the cascade.

> Why is there an extra componentRenderer? As far as I figured
> it out componentRenderer is container dependent. What is the
> reason for having a additional method componentRenderer?

#componentRenderer: is defined in the container. It is a visitor used
to define the layout in which your description components are
arranged. #componentClass: is defined on every description, it is used
to provide the Seaside component class responsible to display the
description.

> What are the best practices for wiring magritte components
> together? The only way I found is to use onAnswer:.

To use #onAnswer: is a pretty good practice. Also #call: is quite
nice, most of my applications use it like this:

        result := self call: (aModel asComponent
                addValidatedForm;
                yourself).

Hope this helps,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Customizing views in Magritte

NorbertHartl
On Mon, 2006-11-27 at 22:02 +0100, Lukas Renggli wrote:
> On 11/27/06, Norbert Hartl <[hidden email]> wrote:
> > Hi,
> >
> > at the moment I'm playing with magritte to test if it is
> > suitable for my web application which is done with seaside.
>
> In the Pier mailing list I replayed:

Yes, thanks for the answer. The post to this list was the
first one and was done accidentially.

regards,

Norbert

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside