#call without #answer

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

#call without #answer

Nick
Hi,

I have an application that has a body section, where the body section
might be one of many components.For example:

TemplateComponent
    - HeaderComponent
    - BodyComponent - one of BodyOne | BodyTwo | etc components.
    - FooterComponent

The question is whether to use #call:/#show: to change the
BodyComponent *or* use Announcements to set a different component in
TemplateComponent which then subsequently rendered in place of the
BodyComponent?
This question has been raised a few times before [1],[2],[3], however
the answers given didn't help me understand what happens when a
component uses #call:/#show: without the corresponding #answer:. My
concern is that the stack of AnswerHandlers/Delegates increases for
each #show/#call without the corresponding #answer. I built a simple
app to try to understand what's going and it appears that the stack
grows for each #show/#call. I click on  'another component' anchor and
as expected the #show: method results in a new component being
displayed. Clicking 'another component' repeatedly and then
subsequently clicking on the  'answer' anchor results in the previous
component being revealed all the way back to the starting component.
My conclusion is that it's *bad* to use #call:/#show: without the
corresponding #answer: as a AnswerHandlers/Delegates list is
increasing without items being removed. OR have I missed something?

Thanks

Nick

--

WAComponent subclass: #TestMultipleShows
        instanceVariableNames: 'theDisplayComponent'

children
        ^ Array with: theDisplayComponent

initialize
        super initialize.
        theDisplayComponent := self randomDisplayComponent.

randomDisplayComponent
        ^ TestMultipleShowsComponent value: 1000 atRandom.

renderContentOn: html
        html div: [html render: theDisplayComponent].
        html anchor callback: [theDisplayComponent show: self
randomDisplayComponent]; with: 'another component'
---

WAComponent subclass: #TestMultipleShowsComponent
        instanceVariableNames: 'value'

renderContentOn: html
        html div: value.
        html anchor callback: [self answer: true]; with: 'answer'.! !

value: aValue
        value := aValue! !

#TestMultipleShowsComponent class>>value: aValue
        ^ self new value: aValue.


[1] http://lists.squeakfoundation.org/pipermail/seaside/2008-April/017575.html
[2] http://lists.squeakfoundation.org/pipermail/seaside/2007-January/010298.html
[3] http://lists.squeakfoundation.org/pipermail/seaside/2003-September/002142.html
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: #call without #answer

Lukas Renggli
If you send #home before you do the next #show:/#call: all delegations
are removed.

Lukas

2009/12/17 Nick Ager <[hidden email]>:

> Hi,
>
> I have an application that has a body section, where the body section
> might be one of many components.For example:
>
> TemplateComponent
>    - HeaderComponent
>    - BodyComponent - one of BodyOne | BodyTwo | etc components.
>    - FooterComponent
>
> The question is whether to use #call:/#show: to change the
> BodyComponent *or* use Announcements to set a different component in
> TemplateComponent which then subsequently rendered in place of the
> BodyComponent?
> This question has been raised a few times before [1],[2],[3], however
> the answers given didn't help me understand what happens when a
> component uses #call:/#show: without the corresponding #answer:. My
> concern is that the stack of AnswerHandlers/Delegates increases for
> each #show/#call without the corresponding #answer. I built a simple
> app to try to understand what's going and it appears that the stack
> grows for each #show/#call. I click on  'another component' anchor and
> as expected the #show: method results in a new component being
> displayed. Clicking 'another component' repeatedly and then
> subsequently clicking on the  'answer' anchor results in the previous
> component being revealed all the way back to the starting component.
> My conclusion is that it's *bad* to use #call:/#show: without the
> corresponding #answer: as a AnswerHandlers/Delegates list is
> increasing without items being removed. OR have I missed something?
>
> Thanks
>
> Nick
>
> --
>
> WAComponent subclass: #TestMultipleShows
>        instanceVariableNames: 'theDisplayComponent'
>
> children
>        ^ Array with: theDisplayComponent
>
> initialize
>        super initialize.
>        theDisplayComponent := self randomDisplayComponent.
>
> randomDisplayComponent
>        ^ TestMultipleShowsComponent value: 1000 atRandom.
>
> renderContentOn: html
>        html div: [html render: theDisplayComponent].
>        html anchor callback: [theDisplayComponent show: self
> randomDisplayComponent]; with: 'another component'
> ---
>
> WAComponent subclass: #TestMultipleShowsComponent
>        instanceVariableNames: 'value'
>
> renderContentOn: html
>        html div: value.
>        html anchor callback: [self answer: true]; with: 'answer'.! !
>
> value: aValue
>        value := aValue! !
>
> #TestMultipleShowsComponent class>>value: aValue
>        ^ self new value: aValue.
>
>
> [1] http://lists.squeakfoundation.org/pipermail/seaside/2008-April/017575.html
> [2] http://lists.squeakfoundation.org/pipermail/seaside/2007-January/010298.html
> [3] http://lists.squeakfoundation.org/pipermail/seaside/2003-September/002142.html
> _______________________________________________
> 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