Magritte Tutorial - Person Manager: Save button does not answer

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

Magritte Tutorial - Person Manager: Save button does not answer

John McKeon
Hello All,
I have spent many hours trying to figure out the answer to my problem to no avail, so I avail myself of your esteemed knowledge.

I am trying to implement the Person Manager in the tutorial. This should be simple and for the most part it is.
I added the action method below to call the default Person Editor. It gets called properly but clicking on the Save button does nothing. The halt code is never reached, i.e. the editor never seems to answer...

PersonManager>>add
    | e p |
    e := MAPersonEditor new.
    p := self call: e.
    self halt.
    p isNil ifFalse: [ self persons add: p ].

The PersonManager >>renderContentOn: method is implemented as follows:

renderContentOn: html
    html heading level: 3; with: 'Person Manager'.
    html anchor
        callback: [ self add ];
        with: 'Add New Person'.
    self persons do: [ :p |
        html text: p firstName , ' ' , p lastName]

Can anyone tell me what it is that I have failed to implement?

Thanks in advance
John


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

Re: Magritte Tutorial - Person Manager: Save button does not answer

Lukas Renggli
> Can anyone tell me what it is that I have failed to implement?

As far as I see your code looks ok. How does MAPersonEditor look like?
Is the button surrounded by a form? Does the button do an #answer: at
some point?

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: Magritte Tutorial - Person Manager: Save button does not answer

John McKeon
Hi Lukas,
MAPersonEditor looks OK to me, the buttons are within the form, etc...

Last night, after sending that email, I happened to click on the Save button without filling in any fields and the validation code was triggered (error msgs displayed regarding first and last name) so it appears the MAContainerComponent's save method is getting called. I will start from there tonight, inserting a break and see where the code goes.

I am not the worlds greatest smalltalker and, while I have been enjoying the exploration of the Magriitte hierarchy, I am not yet that quick to be able to say, "oh that must be in the MAXXXXDecoration object" etc. I will let you know how it goes tonight.

Warm regards
John


On Tue, Jan 20, 2009 at 2:53 AM, Lukas Renggli <[hidden email]> wrote:
> Can anyone tell me what it is that I have failed to implement?

As far as I see your code looks ok. How does MAPersonEditor look like?
Is the button surrounded by a form? Does the button do an #answer: at
some point?

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

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



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

Re: Magritte Tutorial - Person Manager: Save button does not answer

John McKeon
After further investigations, it does not appear that anything is amiss. MAContainerComponent>>save method runs to completion and sends self answer: self model. As I step into that send it goes through the decorationDo: [ :each | each handleAnswer: anObject ] etc. But none of the objects seem to handle the answer lol. Can you tell I am a little bit lost?

Then I decided to run the pierexample app from the dispatcher. Clicked on the Add link, went through the motions to add a new page(?), clicked save and I hit the breakpoint in MAContainerComponent>>save method htat I had set above. This is interesting, as I step through it and get to decorationChainDo: I noticed that the first decoration in the chain is a WAAnswerHandler, on my PersonManager test app it is a MAValidationDecoration then a MAFormDecoration, no WAAnswerHandler...could this be it? (I am attempting now to see who might add the WAAnswerHandler to the Pier form's decoration chain. heh Wish me luck lol)

Warm regards
John

On Tue, Jan 20, 2009 at 7:08 AM, John M <[hidden email]> wrote:
Hi Lukas,
MAPersonEditor looks OK to me, the buttons are within the form, etc...

Last night, after sending that email, I happened to click on the Save button without filling in any fields and the validation code was triggered (error msgs displayed regarding first and last name) so it appears the MAContainerComponent's save method is getting called. I will start from there tonight, inserting a break and see where the code goes.

I am not the worlds greatest smalltalker and, while I have been enjoying the exploration of the Magriitte hierarchy, I am not yet that quick to be able to say, "oh that must be in the MAXXXXDecoration object" etc. I will let you know how it goes tonight.

Warm regards
John



On Tue, Jan 20, 2009 at 2:53 AM, Lukas Renggli <[hidden email]> wrote:
> Can anyone tell me what it is that I have failed to implement?

As far as I see your code looks ok. How does MAPersonEditor look like?
Is the button surrounded by a form? Does the button do an #answer: at
some point?

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

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




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

Re: Magritte Tutorial - Person Manager: Save button does not answer

Lukas Renggli
> After further investigations, it does not appear that anything is amiss.
> MAContainerComponent>>save method runs to completion and sends self answer:
> self model. As I step into that send it goes through the decorationDo: [
> :each | each handleAnswer: anObject ] etc. But none of the objects seem to
> handle the answer lol. Can you tell I am a little bit lost?

I looks like the MAContainerComponent does an answer, but not the
PersonManager? Is the Magritte Form a child of PersonManager? If so,
you need to pass the answer to the outer component. As far as I
understand your code, it looks like a different component answers than
the one that was called.

So in the PersonEditor where you create the Magritte Component do
something like this:

    child := person asComponent.
    child addValidatedForm.
    child onAnswer: [ :m | self answer: m ]

The last line captures the answer of the Magritte component and lets
the PersonEditor pass it on.

HTH,
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: Magritte Tutorial - Person Manager: Save button does not answer

John McKeon
I'll be darned. That works!
I am a little baffled that WAComponent>>call: adds an onAnswer: block but that is not enough...I guess I have a bit more to learn =)..

Thank you for your help Lukas.

Warm regards
John

On Wed, Jan 21, 2009 at 2:08 AM, Lukas Renggli <[hidden email]> wrote:
> After further investigations, it does not appear that anything is amiss.
> MAContainerComponent>>save method runs to completion and sends self answer:
> self model. As I step into that send it goes through the decorationDo: [
> :each | each handleAnswer: anObject ] etc. But none of the objects seem to
> handle the answer lol. Can you tell I am a little bit lost?

I looks like the MAContainerComponent does an answer, but not the
PersonManager? Is the Magritte Form a child of PersonManager? If so,
you need to pass the answer to the outer component. As far as I
understand your code, it looks like a different component answers than
the one that was called.

So in the PersonEditor where you create the Magritte Component do
something like this:

   child := person asComponent.
   child addValidatedForm.
   child onAnswer: [ :m | self answer: m ]

The last line captures the answer of the Magritte component and lets
the PersonEditor pass it on.

HTH,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

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



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

Re: Magritte Tutorial - Person Manager: Save button does not answer

Lukas Renggli
> I am a little baffled that WAComponent>>call: adds an onAnswer: block but
> that is not enough...I guess I have a bit more to learn =)..

Yes, it adds an answer block, but not to the place where the Magritte
component answers from.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

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