Hello list,
I have a question regarding the use of WADecoration and how to show subcomponents inside its rendering phase. I need to do something like this: MyComponent >> initialize super initialize. self addDecoration: MyWADecorationSubclass new. MyDecorationSubclass >> renderContentOn:html self renderOwnerOn:html. html render: OtherComponent instance OtherComponent >> renderContentOn: html html render: etc.... MyComponent is decorated with a MyDecorationSubclass instance. When MyComponent gets rendered, the OtherComponent is also rendered, as part of the decoration. The visual result is as expected, both the original component and the decoration are visible. The problem comes with callbacks (children problem). As the decorated component does not return the decoration's subcomponent (OtherComponent) as one of its children, callbacks inside OtherComponent wont work. I could easily fix this problem if I add the OtherComponent dynamically to some collection of the decorated component. To be able to do this, the decorated component cannot be a simple WAComponent, so I wouldn't be able to decorate WAComponents the way I would like. My question is: Is there any way to decorate a WAComponent with a WADecoration and render a second component inside the decoration's renderContentOn:. In such way that the second component's callbacks would work ok? thanks, regards! Leandro _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Yeah, that kind of sucks in 2.8. I think in 2.9 we've got it so that
Decorations can have #children. In 2.8, you'll need to implement #nextPresentersDo: on your Decoration. Take a look at WADelegation or WAComponent's implementation for inspiration. Julian On Mon, Dec 22, 2008 at 4:12 PM, Leandro Perez <[hidden email]> wrote: > Hello list, > I have a question regarding the use of WADecoration and how to show > subcomponents inside its rendering phase. > > I need to do something like this: > > MyComponent >> initialize > super initialize. > self addDecoration: MyWADecorationSubclass new. > > MyDecorationSubclass >> renderContentOn:html > self renderOwnerOn:html. > html render: OtherComponent instance > > OtherComponent >> renderContentOn: html > html render: etc.... > > MyComponent is decorated with a MyDecorationSubclass instance. When > MyComponent gets rendered, the OtherComponent is also rendered, as part of > the decoration. The visual result is as expected, both the original > component and the decoration are visible. The problem comes with callbacks > (children problem). As the decorated component does not return the > decoration's subcomponent (OtherComponent) as one of its children, callbacks > inside OtherComponent wont work. > > I could easily fix this problem if I add the OtherComponent dynamically to > some collection of the decorated component. To be able to do this, the > decorated component cannot be a simple WAComponent, so I wouldn't be able to > decorate WAComponents the way I would like. > > > My question is: > Is there any way to decorate a WAComponent with a WADecoration and render a > second component inside the decoration's renderContentOn:. In such way that > the second component's callbacks would work ok? > > thanks, regards! > Leandro > > _______________________________________________ > 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 |
Thanks Julian,
Yeah, that kind of sucks in 2.8. I think in 2.9 we've got it so that great In 2.8, you'll need to implement #nextPresentersDo: on your I wrote this: MyDecoration>>nextPresentersDo: aBlock super nextPresentersDo: aBlock. self childrenDo: [:ea | ea decorationChainDo: aBlock] How does it sound? It seems to work, but perhaps I'm missing something. I honestly don't know the whole intent of nextPresentersDo: so I tried a few things and this one appears to work just fine. Greetings _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On Mon, Dec 22, 2008 at 6:01 PM, Leandro Perez <[hidden email]> wrote:
>> In 2.8, you'll need to implement #nextPresentersDo: on your >> Decoration. Take a look at WADelegation or WAComponent's >> implementation for inspiration. > > I wrote this: > > MyDecoration>>nextPresentersDo: aBlock > super nextPresentersDo: aBlock. > self childrenDo: [:ea | ea decorationChainDo: aBlock] > > How does it sound? I'm not sure how that would work since #childrenDo: is only implemented on WAComponent. You just need to call super and then call #decorationChainDo: on whatever component you are displaying within the decoration. Julian _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks Julian! Greetings _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |