[Seaside] revel decoration

Sebastian Sastre sebastian at flowingconcept.com
Wed Mar 30 16:13:06 UTC 2011


if it's for the sake of making it work all is valid

otherwise that sounds a bit extreme for something you just need to do once

besides, why justify a hack when you can compose a normal component and make it react properly (and remove the wrapper or change its state normally from a callback)

(note this is aimed to talk about good practices not to slow you down)




On Mar 30, 2011, at 1:01 PM, Diogenes Moreira wrote:

> well, I solved my problem extended WAActionCallback and using a Annoucement.
> 
> It may not be very elegant, but work.. :).
> 
> In this way I modify the decoration without generate functional dependences in the subComponents, when I have actions
> 
> Best.
> 
> 
> WAActionCallback class>>on: aBlock
>     |newBlock|
>     newBlock := [ 
>         WACurrentRequestContext value announce: SBAnnouncementClean.
>         aBlock value. ].
>     ^ self new block: aBlock
> 
> MySession>>announcer
>     ^ announcer ifNil:[ announcer := Announcer new].
> 
> MyComponent>>announcer
>     ^ self session announcer.
> 
> MyComponent>>on: anAnnouncement  send: aMessage to: anObject
>     self announcer on: anAnnouncement  send: aMessage to: anObject.
> 
> MyComponent>>initialize
>       super initialize.
>       self on: SBAnnouncementClean send: #clean: to:self.
>       "and do other staff"
> 
> MyComponent>>clean
>      "here remove the decorations and do my staff"
> 
> 
> 
> 
> ---------- Forwarded message ----------
> From: Diogenes Moreira <diogenes.moreira at gmail.com>
> Date: Tue, Mar 29, 2011 at 3:04 PM
> Subject: Re: [Seaside] revel decoration
> To: Seaside - general discussion <seaside at lists.squeakfoundation.org>
> 
> 
> well, in fact i'm remove the decoration, after rendering process.. is it posible?.
> I wanna use a decorator only one time.
> 
> 
> On Tue, Mar 29, 2011 at 2:29 PM, Johan Brichau <johan at inceptive.be> wrote:
> 
> On 29 Mar 2011, at 19:17, Diogenes Moreira wrote:
> 
> > I don't know why, but  the decorator is present at next rendering time for my component.
> 
> afaik, adding or removing a decorator is similar to changing the state of the component: you should not do that while rendering.
> The component state is saved before rendering, which means state changes during rendering are lost.
> 
> A solution can be to add/remove the decorator in an action callback (e.g. from the calling site of #inform: ?)
> But I'm also interested why you are dynamically adding/removing a decorator like that.
> 
> Johan_______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> 
> 
> _______________________________________________
> 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/20110330/25702a7b/attachment.htm


More information about the seaside mailing list