You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Luke Galea <lg...@gmmsolutions.com> on 2004/02/07 22:57:45 UTC

Proper place to initialize

Hi all,
 
I have a simple component to edit a user's properties.. it's called from
both an edit user page and a new user page, the only difference being
some instructions around the actual editor and the source of the edited
user.
 
In the case of the new user page, I wanted the first time the page is
displayed the user to be created as a property of the page and have some
values populated from the visit..
 
Unfortunately, when I implement in initialize it seems to happen over
and over each refresh.. and I don't have access to the visit..
 
Where is the best place to do this?
 
Thanks in advance!

Re: Proper place to initialize

Posted by Jamie Orchard-Hays <ja...@dang.com>.
Luke, initialize() is actually the method you call to leave the page in the
state you want when you're done with it and it goes back to the pool. If you
define your page properties in the .page file and use abstract methods to
access them in the java file, then you probably won't use initialize() much
at all.

You definitely want to use pageBeginRender() for what you're doing.

Jamie
----- Original Message ----- 
From: "Luke Galea" <lg...@gmmsolutions.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Saturday, February 07, 2004 11:54 PM
Subject: RE: Proper place to initialize


> Awesome!! Thanks!!
>
> I gotta get that book..
>
> -----Original Message-----
> From: Bryan Lewis [mailto:bryan@maine.rr.com]
> Sent: February 7, 2004 6:20 PM
> To: Tapestry users
> Subject: Re: Proper place to initialize
>
>
> Happily quoting from section 7.5.4 of the book:
>
>     Sometimes a component (or other object) just needs to know
>     when the page is about to start rendering, or when it has
>     finished rendering.  This is commonly required to set properties
>     of objects that will be used during the render, but only just in
>     time, as if the page is actually going to render.
>         These notifications are made available through an event
>     listener interface PageRenderListener. This interface includes
>     two methods:  pageBeginRender() and pageEndRender().
>
> And pageBeginRender() has a PageEvent argument from which you can
> retrieve the visit, as in pageEvent.getPage().getVisit().
>
> ----- Original Message ----- 
> From: "Luke Galea" <lg...@gmmsolutions.com>
> To: "'Tapestry users'" <ta...@jakarta.apache.org>
> Sent: Saturday, February 07, 2004 4:57 PM
> Subject: Proper place to initialize
>
>
> > Hi all,
> >
> > I have a simple component to edit a user's properties.. it's called
> from
> > both an edit user page and a new user page, the only difference being
> > some instructions around the actual editor and the source of the
> edited
> > user.
> >
> > In the case of the new user page, I wanted the first time the page is
> > displayed the user to be created as a property of the page and have
> some
> > values populated from the visit..
> >
> > Unfortunately, when I implement in initialize it seems to happen over
> > and over each refresh.. and I don't have access to the visit..
> >
> > Where is the best place to do this?
> >
> > Thanks in advance!
> >
>
>
> ---------------------------------------------------------------------
> 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
>
>


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


RE: Proper place to initialize

Posted by Luke Galea <lg...@gmmsolutions.com>.
Awesome!! Thanks!! 

I gotta get that book..

-----Original Message-----
From: Bryan Lewis [mailto:bryan@maine.rr.com] 
Sent: February 7, 2004 6:20 PM
To: Tapestry users
Subject: Re: Proper place to initialize


Happily quoting from section 7.5.4 of the book:

    Sometimes a component (or other object) just needs to know
    when the page is about to start rendering, or when it has
    finished rendering.  This is commonly required to set properties
    of objects that will be used during the render, but only just in
    time, as if the page is actually going to render.
        These notifications are made available through an event
    listener interface PageRenderListener. This interface includes
    two methods:  pageBeginRender() and pageEndRender().

And pageBeginRender() has a PageEvent argument from which you can
retrieve the visit, as in pageEvent.getPage().getVisit().

----- Original Message ----- 
From: "Luke Galea" <lg...@gmmsolutions.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Saturday, February 07, 2004 4:57 PM
Subject: Proper place to initialize


> Hi all,
>
> I have a simple component to edit a user's properties.. it's called
from
> both an edit user page and a new user page, the only difference being 
> some instructions around the actual editor and the source of the
edited
> user.
>
> In the case of the new user page, I wanted the first time the page is 
> displayed the user to be created as a property of the page and have
some
> values populated from the visit..
>
> Unfortunately, when I implement in initialize it seems to happen over 
> and over each refresh.. and I don't have access to the visit..
>
> Where is the best place to do this?
>
> Thanks in advance!
>


---------------------------------------------------------------------
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: Proper place to initialize

Posted by Bryan Lewis <br...@maine.rr.com>.
Happily quoting from section 7.5.4 of the book:

    Sometimes a component (or other object) just needs to know
    when the page is about to start rendering, or when it has
    finished rendering.  This is commonly required to set properties
    of objects that will be used during the render, but only just in
    time, as if the page is actually going to render.
        These notifications are made available through an event
    listener interface PageRenderListener. This interface includes
    two methods:  pageBeginRender() and pageEndRender().

And pageBeginRender() has a PageEvent argument from which you can
retrieve the visit, as in pageEvent.getPage().getVisit().

----- Original Message ----- 
From: "Luke Galea" <lg...@gmmsolutions.com>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Saturday, February 07, 2004 4:57 PM
Subject: Proper place to initialize


> Hi all,
>
> I have a simple component to edit a user's properties.. it's called
from
> both an edit user page and a new user page, the only difference being
> some instructions around the actual editor and the source of the
edited
> user.
>
> In the case of the new user page, I wanted the first time the page is
> displayed the user to be created as a property of the page and have
some
> values populated from the visit..
>
> Unfortunately, when I implement in initialize it seems to happen over
> and over each refresh.. and I don't have access to the visit..
>
> Where is the best place to do this?
>
> Thanks in advance!
>


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