Problem with calling owner from decoration

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

Problem with calling owner from decoration

Martin Polák
I must apolgize myself, I replied for Dario's mail, but I wanted new  
thread. So once again. Thanks.


Hi there,
I have a component with method editAction like this:

| ar |
        ar := self
                                call: ((self article descriptionEdit asComponentOn: self article)
                                                addValidatedForm.
        ar
                ifNotNil: [self article copyFrom: ar]

When I call this method directly from this component, editor is  
rendered succesfully. But when i wrap component with decoration,  
where renderContentOn looks like:

html anchor
                callback: [self owner editAction];
                 with: 'edit'.
        self renderOwnerOn: html

after clicking on 'edit', nothing happens. Except reloading page, of  
course. Any suggestions here?

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

Re: Problem with calling owner from decoration

Julian Fitzell-2
On Mon, Oct 27, 2008 at 11:27 AM, M. Polák <[hidden email]> wrote:

> I must apolgize myself, I replied for Dario's mail, but I wanted new thread.
> So once again. Thanks.
>
>
> Hi there,
> I have a component with method editAction like this:
>
> | ar |
>        ar := self
>                                call: ((self article descriptionEdit
> asComponentOn: self article)
>                                                addValidatedForm.
>        ar
>                ifNotNil: [self article copyFrom: ar]
>
> When I call this method directly from this component, editor is rendered
> succesfully. But when i wrap component with decoration, where
> renderContentOn looks like:
>
> html anchor
>                callback: [self owner editAction];
>                 with: 'edit'.
>        self renderOwnerOn: html
>
> after clicking on 'edit', nothing happens. Except reloading page, of course.
> Any suggestions here?

Hmm... I'm not exactly sure, except to say that this pattern seems a
little strange to me somehow. Nothing jumps out immediately as to why
it isn't working though.

Beware of #owner, though. It is badly named (following a refactoring
some time ago). It return the *next* item in the Decoration chain,
which is only the Component if this is the last Decoration. That can't
be your problem, though, because you'd presumably get an error that
#editAction was not understood.

Try putting a halt in your callback to make sure that the callback is
actually being called. If so, then it must be some interaction between
your Decoration and the WADelegation that is added by the call:, but
as I said, I can't immediately see just from looking at your code,
what that problem is. You'll need to put a halt in somewhere and
inspect the decoration chain to see what's happening.

Or, maybe somebody else on the list can spot the problem right off...

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

Re: Problem with calling owner from decoration

Lukas Renggli
#addValidatedForm answers the added decoration, as all add decoration
methods do. You need to append a ; yourself.

Lukas

On 10/28/08, Julian Fitzell <[hidden email]> wrote:

> On Mon, Oct 27, 2008 at 11:27 AM, M. Polák <[hidden email]> wrote:
>> I must apolgize myself, I replied for Dario's mail, but I wanted new
>> thread.
>> So once again. Thanks.
>>
>>
>> Hi there,
>> I have a component with method editAction like this:
>>
>> | ar |
>>        ar := self
>>                                call: ((self article descriptionEdit
>> asComponentOn: self article)
>>                                                addValidatedForm.
>>        ar
>>                ifNotNil: [self article copyFrom: ar]
>>
>> When I call this method directly from this component, editor is rendered
>> succesfully. But when i wrap component with decoration, where
>> renderContentOn looks like:
>>
>> html anchor
>>                callback: [self owner editAction];
>>                 with: 'edit'.
>>        self renderOwnerOn: html
>>
>> after clicking on 'edit', nothing happens. Except reloading page, of
>> course.
>> Any suggestions here?
>
> Hmm... I'm not exactly sure, except to say that this pattern seems a
> little strange to me somehow. Nothing jumps out immediately as to why
> it isn't working though.
>
> Beware of #owner, though. It is badly named (following a refactoring
> some time ago). It return the *next* item in the Decoration chain,
> which is only the Component if this is the last Decoration. That can't
> be your problem, though, because you'd presumably get an error that
> #editAction was not understood.
>
> Try putting a halt in your callback to make sure that the callback is
> actually being called. If so, then it must be some interaction between
> your Decoration and the WADelegation that is added by the call:, but
> as I said, I can't immediately see just from looking at your code,
> what that problem is. You'll need to put a halt in somewhere and
> inspect the decoration chain to see what's happening.
>
> Or, maybe somebody else on the list can spot the problem right off...
>
> Julian
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
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: Problem with calling owner from decoration

Martin Polák
Thanks for suggestions, but none helped :(. I added ; yourself and it  
returns a MAContainerComponent, which looks OK. But nothing changed,  
looks like before.
I tried putting halt to the #editAction, and method is correctly  
entered, but it looks like #call: has some problem. I'd some trace  
over, and it hangs at WARenderContinuation>>handleRequest: on this  
code...

((self shouldRedirect: aRequest)
                ifTrue: [ self newRedirectContinuation ]
                ifFalse: [ self newRenderContinuation ])
                        run
When #run is send, Squeak freezes and only Cmd + . break execution. I  
have no idea what to do.

Thanks a lot for suggestions - any others are highly appreciated

Martin



On 28.10.2008, at 23:38, Lukas Renggli wrote:

> #addValidatedForm answers the added decoration, as all add decoration
> methods do. You need to append a ; yourself.
>
> Lukas
>
>
>>
>> Hmm... I'm not exactly sure, except to say that this pattern seems a
>> little strange to me somehow. Nothing jumps out immediately as to why
>> it isn't working though.
>>
>> Beware of #owner, though. It is badly named (following a refactoring
>> some time ago). It return the *next* item in the Decoration chain,
>> which is only the Component if this is the last Decoration. That  
>> can't
>> be your problem, though, because you'd presumably get an error that
>> #editAction was not understood.
>>
>> Try putting a halt in your callback to make sure that the callback is
>> actually being called. If so, then it must be some interaction  
>> between
>> your Decoration and the WADelegation that is added by the call:, but
>> as I said, I can't immediately see just from looking at your code,
>> what that problem is. You'll need to put a halt in somewhere and
>> inspect the decoration chain to see what's happening.
>>
>> Or, maybe somebody else on the list can spot the problem right off...
>>
>> Julian
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with calling owner from decoration

Lukas Renggli
On Wed, Oct 29, 2008 at 9:20 PM, M. Polák <[hidden email]> wrote:
> Thanks for suggestions, but none helped :(. I added ; yourself and it
> returns a MAContainerComponent, which looks OK. But nothing changed, looks
> like before.

How does your code looks like now?

> I tried putting halt to the #editAction, and method is correctly entered,
> but it looks like #call: has some problem. I'd some trace over, and it hangs
> at WARenderContinuation>>handleRequest: on this code...

You can't step over #call: with a debugger. Call causes the current
process to send out a response and terminate the computation. Later
on, when a request comes in that triggers a corresponding answer:, the
process call-stack is restored and resumed. I've never seen a debugger
that could handle such a fancy thing.

Cheers,
Lukas

>
> ((self shouldRedirect: aRequest)
>                ifTrue: [ self newRedirectContinuation ]
>                ifFalse: [ self newRenderContinuation ])
>                        run
> When #run is send, Squeak freezes and only Cmd + . break execution. I have
> no idea what to do.
>
> Thanks a lot for suggestions - any others are highly appreciated
>
> Martin
>
>
>
> On 28.10.2008, at 23:38, Lukas Renggli wrote:
>
>> #addValidatedForm answers the added decoration, as all add decoration
>> methods do. You need to append a ; yourself.
>>
>> Lukas
>>
>>
>>>
>>> Hmm... I'm not exactly sure, except to say that this pattern seems a
>>> little strange to me somehow. Nothing jumps out immediately as to why
>>> it isn't working though.
>>>
>>> Beware of #owner, though. It is badly named (following a refactoring
>>> some time ago). It return the *next* item in the Decoration chain,
>>> which is only the Component if this is the last Decoration. That can't
>>> be your problem, though, because you'd presumably get an error that
>>> #editAction was not understood.
>>>
>>> Try putting a halt in your callback to make sure that the callback is
>>> actually being called. If so, then it must be some interaction between
>>> your Decoration and the WADelegation that is added by the call:, but
>>> as I said, I can't immediately see just from looking at your code,
>>> what that problem is. You'll need to put a halt in somewhere and
>>> inspect the decoration chain to see what's happening.
>>>
>>> Or, maybe somebody else on the list can spot the problem right off...
>>>
>>> Julian
>>> _______________________________________________
>>> seaside mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
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: Problem with calling owner from decoration

Martin Polák

On 29.10.2008, at 22:21, Lukas Renggli wrote:
>
>
> How does your code looks like now?
>>

Actuall code:

editAction
        | ar |
        ar := self call: ((self article descriptionEdit asComponentOn: self  
article) addValidatedForm; yourself).
        ar
                ifNotNil: [self article copyFrom: ar]

When I have this code in generic component and use it like this:

article := WCArticle new.
        html anchor
                callback: [self call: ((article descriptionEdit asComponentOn:  
article) addValidatedForm; yourself)];
                 with: 'Edit'

everything worked well. Problem is only when this code is called from  
decoration. I did little experiment, and tried add #halt after the  
#call: and it seems, that no code after #call: is executed.
Could be problem, that I'm generating #children Array of the  
decorated component dynamically on the fly?

>
> You can't step over #call: with a debugger. Call causes the current
> process to send out a response and terminate the computation. Later
> on, when a request comes in that triggers a corresponding answer:, the
> process call-stack is restored and resumed. I've never seen a debugger
> that could handle such a fancy thing.
>
> Cheers,
> Lukas
>
>>

Oh yes, that's the continuation "magic", isn't it?

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

Re: Problem with calling owner from decoration

Martin Polák
Hi there, I have succesfully solved my problem. As usually, problem  
was between the chair and the keyboard ;).
Problem was in dynamically created children array. Schematically I  
have following situation:

* aRootComponent, with dynamic children array
* aShowComponent, which instances are stored in aRootComponent  
chidren array
* anAdminDecoration, which wraps aShowComponent and calling it's  
editAction, deleteAction, ...

My stupid error was, that I overwrote children array with a new  
instances of aShowComponent at every re-render of aRootComponent, so  
the #call: method never been finished.

Martin

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