[Seaside] Magritte

Tony Giaccone tgiaccone at gmail.com
Fri Feb 12 20:09:45 UTC 2010


Ok, Actually this is one of those things, that I kind of knew. At one point
I did a inspect on the component that was generated, and realized that it
was something that I didn't have direct control over.

So now I'm curious, how do I tell Magritte that I want it to instantiate an
object that I specify ( my sub-classed object) instead of the default
MAContainerComponent?

So now a more general question, but also about Magritte. Obviously an edit
component is a handy thing to have, but also a browsing component is nice to
have too.  A simple table that has columns and a scroll bar, and can display
a list of items. Even nicer is one of these with a form on the top where you
can specify search criteria.

In other frameworks in java I have used components like this. I imagine one
could be created by using inspection on the Magritte class descriptions. Has
anyone done something like this? Or is this one of those, now you've
described it, why don't you implement it situations?


Tony

On Fri, Feb 12, 2010 at 2:58 PM, Norbert Hartl <norbert at hartl.name> wrote:

>
> On 12.02.2010, at 17:04, Tony Giaccone wrote:
>
>
>
> On Fri, Feb 12, 2010 at 10:01 AM, Norbert Hartl <norbert at hartl.name>wrote:
>
>> Yes, only coding and not strong concerns. In general using this should be
>> safe. The new selector is meaningful on the class side but AFAIK not on the
>> instance side of your objects. If you are calling new you need to have an
>> implemented method new that easily leads to confusion when you read code.
>>
>> In your case and taking the examples from Richard your probably best off
>> using the actionButtons approach.
>>
>>
>>
> Ok, so I think another lightbulb just went off in my head, and something I
> had totally missed before is now flashing bright red.
>
> Are you saying that when each of those buttons is pressed a method with
> that selector is going to be called on the object being edited. IE pressing
> the Save button is the same as sending [myObject save]?
>
> No, but similar :) By doing "anObject asComponent" you create a component
> that is displayable in seaside. This component holds your object as a model
> to act upon. The component that is being generated is of class
> MAContainerComponent. There is one additional step but I leave it off in
> order not to confuse you too much. In short I can say that a press of button
> "save" will call the method "save" on the component not on your object. And
> that is the problem if you introduce a new button you would have to alter
> the dynamically generated component to have a method by that name. So this
> approach is probably not the best for you to use.
>
> So this is a hard topic if you are new to all of this. If you want to
> understand why the actionButtons work like you need it you need to
> understand closures/blockcontext. You could otherwise subclass
> MAContainerComponet and add a "new" method to it. You can then set your
> class in the description for magritte to use it. Magritte will use your own
> class to create the component instead the default one. But either way is
> some of this lightbulb games.
>
> So may best advize is: Don't hesitate to ask questions.
>
> Norbert
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100212/2d1abeab/attachment.htm


More information about the seaside mailing list