Have you thought implementing PageRenderListener (PageBegnRenderListener in
tapestry 4.0) in your class? That way you can do the initialization just
before the page renders (which it will only do after the listener has been
called and done it's thing, so you can check to see if variables have
already been init'd by the listener).
The interface is org.apache.tapestry.events.PageRenderListener and you
simply put a call to addPageRenderListener(PageRenderListener listener) in
your Page constructor (at least that what I do, unless someone has a better
idea :-)
----- Original Message -----
From: "Paul Cantrell" <[EMAIL PROTECTED]>
To: "Tapestry users" <[email protected]>
Sent: Thursday, August 18, 2005 2:16 PM
Subject: Initialization when called from PageService?
Is there a good way for a page to initialize itself if it's being
called from the page service?
A different way of asking this might be: is there a way to initialize
values only if no listeners are being called?
I have a few situations where values on the page are populated (in,
say, pageAttached()), then overwritten by a listener. That first
redundant initialization is expensive, and I'd rather not do it. But
it's of a sort that's awkward to implement using lazy initialization
in the property getter itself.
I could implement IExternalPage, and do my initialization in
activateExternalPage(). Is there something similar for PageService?
Or is IExternalPage really the right answer to my question?
Cheers,
Paul
_________________________________________________________________
"Les grandes personnes ne comprennent jamais rien toutes seules,
et c'est fatigant, pour les enfants, de toujours et toujours
leur donner des explications." -- Antoine de Saint-Exupéry
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]