You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Haselbach <ch...@tngtech.com> on 2004/11/24 14:55:04 UTC

Initializing persistent component properties.

Hi,

where is the right place to initialize persistent component properties
with non-trivial initial values? I cannot use the initial-value attribute,
because the initial value depends on a parameter. The value of the property
is needed during the first render (where we have no rewind phase), but
I cannot write the initialized value in the prepareForRender() method,
because I will get an exception that the property is locked.

Of course I can use an internal value and write the value back in the
next rewind phase. That is quiet ugly and means that the value will
probably be initialized twice, since the value of the internal value
will be forgotten until the next cycle (with rewinding phase) will start.

Thanks.

Regards,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Initializing persistent component properties. [auf Viren geprueft]

Posted by Jamie Orchard-Hays <ja...@dang.com>.
this is really the only way to accomplish what you want. 
pageBeginRender() won't work because you have no way of controlling 
what gets called first. You're left with a lazy initialization 
technique.


On Nov 24, 2004, at 10:05 AM, Jonathan O'Connor wrote:

> Christian,
> Can you use some sort of lazy initialization to wait as long as 
> possible?
> Ciao,
> Jonathan O'Connor
> XCOM Dublin
>
>
>
> Christian.Haselbach@tngtech.com
> 24/11/2004 14:36
> Please respond to
> "Tapestry users" <ta...@jakarta.apache.org>
>
>
> To
> Tapestry users <ta...@jakarta.apache.org>
> cc
>
> Subject
> Re: Initializing persistent component properties. [auf Viren geprueft]
>
>
>
>
>
>
> Quoting "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>:
>
>> Just implement org.apache.tapestry.event.PageRenderListener and do 
>> your
>> stuff in the pageBeginRender method.
>
> Been there, done that, no shirt. ;)
>
> Ok, things are a little bit more complicated. The component itself is
> used at a later point and the corresponding parameter is set later, 
> too.
> Hence, the pageBeginRender method is called to early. The 
> prepareForRender
> method would be a good time to check the state of the variable and set
> it. I can indeed check it but not set it, because it is locked.
>
> Regards,
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>
> *** XCOM AG Legal Disclaimer ***
>
> Diese E-Mail einschlie?lich ihrer Anhange ist vertraulich und ist 
> allein fur den Gebrauch durch den vorgesehenen Empfanger bestimmt. 
> Dritten ist das Lesen, Verteilen oder Weiterleiten dieser E-Mail 
> untersagt. Wir bitten, eine fehlgeleitete E-Mail unverzuglich 
> vollstandig zu loschen und uns eine Nachricht zukommen zu lassen.
>
> This email may contain material that is confidential and for the sole 
> use of the intended recipient. Any review, distribution by others or 
> forwarding without express permission is strictly prohibited. If you 
> are not the intended recipient, please contact the sender and delete 
> all copies.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Initializing persistent component properties. [auf Viren geprueft]

Posted by Jonathan O'Connor <Jo...@xcom.de>.
Christian,
Can you use some sort of lazy initialization to wait as long as possible?
Ciao,
Jonathan O'Connor
XCOM Dublin



Christian.Haselbach@tngtech.com 
24/11/2004 14:36
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>


To
Tapestry users <ta...@jakarta.apache.org>
cc

Subject
Re: Initializing persistent component properties. [auf Viren geprueft]






Quoting "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>:

> Just implement org.apache.tapestry.event.PageRenderListener and do your
> stuff in the pageBeginRender method.

Been there, done that, no shirt. ;)

Ok, things are a little bit more complicated. The component itself is
used at a later point and the corresponding parameter is set later, too.
Hence, the pageBeginRender method is called to early. The prepareForRender
method would be a good time to check the state of the variable and set
it. I can indeed check it but not set it, because it is locked.

Regards,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org





*** XCOM AG Legal Disclaimer ***

Diese E-Mail einschlie?lich ihrer Anhange ist vertraulich und ist allein fur den Gebrauch durch den vorgesehenen Empfanger bestimmt. Dritten ist das Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten, eine fehlgeleitete E-Mail unverzuglich vollstandig zu loschen und uns eine Nachricht zukommen zu lassen.

This email may contain material that is confidential and for the sole use of the intended recipient. Any review, distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

R: Initializing persistent component properties.

Posted by Luca De Petrillo <lu...@websiteitalia.com>.
Why don't use "prepareForRender()"?

Overload "prepareForRender()" and put the logic after the call of the super
implementation.

-----Messaggio originale-----
Da: Christian.Haselbach@tngtech.com [mailto:Christian.Haselbach@tngtech.com]

Inviato: Wednesday, November 24, 2004 3:37 PM
A: Tapestry users
Oggetto: Re: Initializing persistent component properties.

Quoting "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>:

> Just implement org.apache.tapestry.event.PageRenderListener and do your
> stuff in the pageBeginRender method.

Been there, done that, no shirt. ;)

Ok, things are a little bit more complicated. The component itself is
used at a later point and the corresponding parameter is set later, too.
Hence, the pageBeginRender method is called to early. The prepareForRender
method would be a good time to check the state of the variable and set
it. I can indeed check it but not set it, because it is locked.

Regards,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Initializing persistent component properties.

Posted by Ch...@tngtech.com.
Quoting "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>:

> Just implement org.apache.tapestry.event.PageRenderListener and do your
> stuff in the pageBeginRender method.

Been there, done that, no shirt. ;)

Ok, things are a little bit more complicated. The component itself is
used at a later point and the corresponding parameter is set later, too.
Hence, the pageBeginRender method is called to early. The prepareForRender
method would be a good time to check the state of the variable and set
it. I can indeed check it but not set it, because it is locked.

Regards,
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Initializing persistent component properties.

Posted by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>.
Just implement org.apache.tapestry.event.PageRenderListener and do your 
stuff in the pageBeginRender method.

-Filip

Christian Haselbach wrote:
> Hi,
> 
> where is the right place to initialize persistent component properties
> with non-trivial initial values? I cannot use the initial-value attribute,
> because the initial value depends on a parameter. The value of the property
> is needed during the first render (where we have no rewind phase), but
> I cannot write the initialized value in the prepareForRender() method,
> because I will get an exception that the property is locked.
> 
> Of course I can use an internal value and write the value back in the
> next rewind phase. That is quiet ugly and means that the value will
> probably be initialized twice, since the value of the internal value
> will be forgotten until the next cycle (with rewinding phase) will start.
> 
> Thanks.
> 
> Regards,
> Christian
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
>