revel decoration

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

revel decoration

Diogenes Moreira
Hi folks.
I have a component where I'm adding a decorator..

MyComponent>>inform: aString
    self removeDecoration: informDecoration.
    informDecoration := (SBMessage new text: aString; title: self title; yourself).
    self addDecoration: informDecoration.

and then I'm removing that decorator when rendering finish .

MyComponent>>renderContentOn:html
    self renderMyContentOn: html.
    self removeDecoration: informDecoration.
    informDecoration := nil.

I don't know why, but  the decorator is present at next rendering time for my component.

Any clue or comment will be appreciated.

Thank in advance. Best..


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

Re: revel decoration

Johan Brichau-2

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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: revel decoration

Diogenes Moreira
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 <[hidden email]> 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
[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