You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonathan O'Connor <Jo...@xcom.de> on 2004/12/02 19:08:38 UTC

Initializing Components [auf Viren geprueft]

Folks,
after much thrashing this week, I'm wondering how best to initialize a 
component. This should be easy, but ???

We have a page containing a component. The component takes an DB record 
key as a parameter (we've tried both in and auto (more thrashing)).
The component uses this DB key to get the full record from the DB which is 
then displayed in a form.

Firstly: What comes first page.pageBeginRender or 
component.pageBeginRender? In our debugging we found the component is 
called first.
Secondly, we implemented our own param setter method. It does the DB query 
and sets a property with the query result. But we get a PageLocked 
exception, telling us we are not allowed to set any properties when the 
setParam() method is running.

Finally, what is the normal way of initializing a component based on its 
parameters?
Ciao,
Jonathan O'Connor
XCOM Dublin


*** 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.

Re: Initializing Components [auf Viren geprueft]

Posted by Jamie Orchard-Hays <ja...@dang.com>.
If you're initializing a property on a component, then you have to lazy 
initialize it. pageBeginRender won't work for you because you can't specify 
the order.


----- Original Message ----- 
From: "Jonathan O'Connor" <Jo...@xcom.de>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, December 02, 2004 1:08 PM
Subject: Initializing Components [auf Viren geprueft]


Folks,
after much thrashing this week, I'm wondering how best to initialize a
component. This should be easy, but ???

We have a page containing a component. The component takes an DB record
key as a parameter (we've tried both in and auto (more thrashing)).
The component uses this DB key to get the full record from the DB which is
then displayed in a form.

Firstly: What comes first page.pageBeginRender or
component.pageBeginRender? In our debugging we found the component is
called first.
Secondly, we implemented our own param setter method. It does the DB query
and sets a property with the query result. But we get a PageLocked
exception, telling us we are not allowed to set any properties when the
setParam() method is running.

Finally, what is the normal way of initializing a component based on its
parameters?
Ciao,
Jonathan O'Connor
XCOM Dublin


*** 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 Components [auf Viren geprueft]

Posted by Nick Stuart <ba...@gmail.com>.
That would be my understand Kris. The component sounds like it should
completly control what is being displayed, so it doesn't (and
shouldn't) matter where it get intialized. Now if the component talks
to page and/or other components, then you would have a problem with
when things are intialized.

-Nick


On Thu, 2 Dec 2004 12:02:35 -0800 (PST), Kris Rasmussen
<kr...@yahoo.com> wrote:
> I've always used PageBeginRender to do this. I fetch the record in the PageBeginRender and store it in a property defined for the component. Shouldn't it work as long as the form components referencing the record are contained within the component that fetches the record?
> 
> Thanks,
> Kris
> 
> 
> 
> Jonathan O'Connor <Jo...@xcom.de> wrote:
> Folks,
> after much thrashing this week, I'm wondering how best to initialize a
> component. This should be easy, but ???
> 
> We have a page containing a component. The component takes an DB record
> key as a parameter (we've tried both in and auto (more thrashing)).
> The component uses this DB key to get the full record from the DB which is
> then displayed in a form.
> 
> Firstly: What comes first page.pageBeginRender or
> component.pageBeginRender? In our debugging we found the component is
> called first.
> Secondly, we implemented our own param setter method. It does the DB query
> and sets a property with the query result. But we get a PageLocked
> exception, telling us we are not allowed to set any properties when the
> setParam() method is running.
> 
> Finally, what is the normal way of initializing a component based on its
> parameters?
> Ciao,
> Jonathan O'Connor
> XCOM Dublin
> 
> *** 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.
> 
>                 
> ---------------------------------
> Do you Yahoo!?
>  Yahoo! Mail - You care about security. So do we.
>

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


Initializing Components - Solution and Possible Tapestry Bug [auf Viren geprueft]

Posted by Jonathan O'Connor <Jo...@xcom.de>.
We finally got a solution for all this messing.

Our Solution:
1. We overrode component.prepareForRender(), calling super first, and then 
calling our initFromDB() method.
2. The DB record property can't be persistent, because if you set a 
persistent property in prepareForRender it complains about locked pages. 
Instead we store our DB record in the Visit. Note: non-persistent 
properties can be set with no problems in prepareForRender.

This is pretty horrible stuff. What I would like to know, is when can I 
set persistent properties of a component safely? Sadly, pageBeginRender is 
too early.

Also, I think its a bug not being able to set persistent properties in 
prepareForRender.
Ciao,
Jonathan O'Connor
XCOM Dublin



"Bryan Lewis" <br...@maine.rr.com> 
02/12/2004 21:07
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>


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

Subject
Re: Initializing Components [auf Viren geprueft]






To support that point... let's say later on you decide to make the page an
IExternalPage.  Which gets called first, page.activateExternalPage(),
page.pageBeginRender() or component.pageBeginRender()?
This little detail caught me a few days ago... the answer was
activateExternalPage(), so I had to duplicate a bit of code from
component.pageBeginRender() that I'd been relying on running first.


----- Original Message ----- 
From: "Jamie Orchard-Hays" <ja...@dang.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, December 02, 2004 3:17 PM
Subject: Re: Initializing Components [auf Viren geprueft]


> Jonathan said he was using pBR in his component. This is why he's having
the
> problem. If he was to populate the data in the component, gotta use lazy
> initialization. Say you have pBR used in both the calling page and the
> component. Which gets called first? Sometimes it might be the 
component's,
> sometimes the page's and there's no way to control it. So of the pBR in
the
> page relies on the component having values initialized, you're left with
> using lazy initialization in the property itself.
>
> Jamie
> ----- Original Message ----- 
> From: "Kris Rasmussen" <kr...@yahoo.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Thursday, December 02, 2004 3:02 PM
> Subject: Re: Initializing Components [auf Viren geprueft]
>
>
> > I've always used PageBeginRender to do this. I fetch the record in the
> > PageBeginRender and store it in a property defined for the component.
> > Shouldn't it work as long as the form components referencing the 
record
> > are contained within the component that fetches the record?
> >
> > Thanks,
> > Kris
> >
> > Jonathan O'Connor <Jo...@xcom.de> wrote:
> > Folks,
> > after much thrashing this week, I'm wondering how best to initialize a
> > component. This should be easy, but ???
> >
> > We have a page containing a component. The component takes an DB 
record
> > key as a parameter (we've tried both in and auto (more thrashing)).
> > The component uses this DB key to get the full record from the DB 
which
is
> > then displayed in a form.
> >
> > Firstly: What comes first page.pageBeginRender or
> > component.pageBeginRender? In our debugging we found the component is
> > called first.
> > Secondly, we implemented our own param setter method. It does the DB
query
> > and sets a property with the query result. But we get a PageLocked
> > exception, telling us we are not allowed to set any properties when 
the
> > setParam() method is running.
> >
> > Finally, what is the normal way of initializing a component based on 
its
> > parameters?
> > Ciao,
> > Jonathan O'Connor
> > XCOM Dublin
> >
> >
> > *** 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.
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Mail - You care about security. So do we.
>
>
> ---------------------------------------------------------------------
> 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





*** 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.

Re: Initializing Components [auf Viren geprueft]

Posted by Bryan Lewis <br...@maine.rr.com>.
To support that point... let's say later on you decide to make the page an
IExternalPage.  Which gets called first, page.activateExternalPage(),
page.pageBeginRender() or component.pageBeginRender()?
This little detail caught me a few days ago... the answer was
activateExternalPage(), so I had to duplicate a bit of code from
component.pageBeginRender() that I'd been relying on running first.


----- Original Message ----- 
From: "Jamie Orchard-Hays" <ja...@dang.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, December 02, 2004 3:17 PM
Subject: Re: Initializing Components [auf Viren geprueft]


> Jonathan said he was using pBR in his component. This is why he's having
the
> problem. If he was to populate the data in the component, gotta use lazy
> initialization. Say you have pBR used in both the calling page and the
> component. Which gets called first? Sometimes it might be the component's,
> sometimes the page's and there's no way to control it. So of the pBR in
the
> page relies on the component having values initialized, you're left with
> using lazy initialization in the property itself.
>
> Jamie
> ----- Original Message ----- 
> From: "Kris Rasmussen" <kr...@yahoo.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Thursday, December 02, 2004 3:02 PM
> Subject: Re: Initializing Components [auf Viren geprueft]
>
>
> > I've always used PageBeginRender to do this. I fetch the record in the
> > PageBeginRender and store it in a property defined for the component.
> > Shouldn't it work as long as the form components referencing the record
> > are contained within the component that fetches the record?
> >
> > Thanks,
> > Kris
> >
> > Jonathan O'Connor <Jo...@xcom.de> wrote:
> > Folks,
> > after much thrashing this week, I'm wondering how best to initialize a
> > component. This should be easy, but ???
> >
> > We have a page containing a component. The component takes an DB record
> > key as a parameter (we've tried both in and auto (more thrashing)).
> > The component uses this DB key to get the full record from the DB which
is
> > then displayed in a form.
> >
> > Firstly: What comes first page.pageBeginRender or
> > component.pageBeginRender? In our debugging we found the component is
> > called first.
> > Secondly, we implemented our own param setter method. It does the DB
query
> > and sets a property with the query result. But we get a PageLocked
> > exception, telling us we are not allowed to set any properties when the
> > setParam() method is running.
> >
> > Finally, what is the normal way of initializing a component based on its
> > parameters?
> > Ciao,
> > Jonathan O'Connor
> > XCOM Dublin
> >
> >
> > *** 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.
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Mail - You care about security. So do we.
>
>
> ---------------------------------------------------------------------
> 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 Components [auf Viren geprueft]

Posted by Jamie Orchard-Hays <ja...@dang.com>.
Jonathan said he was using pBR in his component. This is why he's having the 
problem. If he was to populate the data in the component, gotta use lazy 
initialization. Say you have pBR used in both the calling page and the 
component. Which gets called first? Sometimes it might be the component's, 
sometimes the page's and there's no way to control it. So of the pBR in the 
page relies on the component having values initialized, you're left with 
using lazy initialization in the property itself.

Jamie
----- Original Message ----- 
From: "Kris Rasmussen" <kr...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, December 02, 2004 3:02 PM
Subject: Re: Initializing Components [auf Viren geprueft]


> I've always used PageBeginRender to do this. I fetch the record in the 
> PageBeginRender and store it in a property defined for the component. 
> Shouldn't it work as long as the form components referencing the record 
> are contained within the component that fetches the record?
>
> Thanks,
> Kris
>
> Jonathan O'Connor <Jo...@xcom.de> wrote:
> Folks,
> after much thrashing this week, I'm wondering how best to initialize a
> component. This should be easy, but ???
>
> We have a page containing a component. The component takes an DB record
> key as a parameter (we've tried both in and auto (more thrashing)).
> The component uses this DB key to get the full record from the DB which is
> then displayed in a form.
>
> Firstly: What comes first page.pageBeginRender or
> component.pageBeginRender? In our debugging we found the component is
> called first.
> Secondly, we implemented our own param setter method. It does the DB query
> and sets a property with the query result. But we get a PageLocked
> exception, telling us we are not allowed to set any properties when the
> setParam() method is running.
>
> Finally, what is the normal way of initializing a component based on its
> parameters?
> Ciao,
> Jonathan O'Connor
> XCOM Dublin
>
>
> *** 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.
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail - You care about security. So do we. 


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


Re: Initializing Components [auf Viren geprueft]

Posted by Kris Rasmussen <kr...@yahoo.com>.
I've always used PageBeginRender to do this. I fetch the record in the PageBeginRender and store it in a property defined for the component. Shouldn't it work as long as the form components referencing the record are contained within the component that fetches the record?
 
Thanks,
Kris

Jonathan O'Connor <Jo...@xcom.de> wrote:
Folks,
after much thrashing this week, I'm wondering how best to initialize a
component. This should be easy, but ???

We have a page containing a component. The component takes an DB record
key as a parameter (we've tried both in and auto (more thrashing)).
The component uses this DB key to get the full record from the DB which is
then displayed in a form.

Firstly: What comes first page.pageBeginRender or
component.pageBeginRender? In our debugging we found the component is
called first.
Secondly, we implemented our own param setter method. It does the DB query
and sets a property with the query result. But we get a PageLocked
exception, telling us we are not allowed to set any properties when the
setParam() method is running.

Finally, what is the normal way of initializing a component based on its
parameters?
Ciao,
Jonathan O'Connor
XCOM Dublin


*** 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.

		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.