Ok, thank you,
I'll test what you said, maybe my brain was a bit messed up with the edit
table I've implemented.

p.s. The JFlyEditTable for Tap 4.1.x are nearly ready maybe next week they
will be submitted, I think you'll appreciate it.

ciao,
kiuma

On 2/28/07, Sam Gendler <[EMAIL PROTECTED]> wrote:

pageBeginRender is called during both rewind and render.  I don't know
what test you did to make you think it only gets called during rewind.

public void pageBeginRender(PageEvent event) {
    if (!event.getRequestCycle().isRewinding()) {
        // put render cycle init code here
    }
}

I've got code similar to this all over my codebase and I know that it
works exactly as expected.  In fact, my actual pageBeginRender
implementation in my base page implementation looks like the
following:

    @InitialValue("ognl:false")
    public abstract boolean isOnceInitialized();
    public abstract void setOnceInitialized(boolean val);

    public final void pageBeginRender(PageEvent event) {
        initPage(event);
        if (!isOnceInitialized()) {
            initOnlyOnce(event);
            setOnceInitialized(true);
        }
        if (getRequestCycle().isRewinding()) {
            initForRewind(event);
        } else {
            initForRender(event);
        }
    }

    // gets called before both rewind and render cycles
    public void initPage(PageEvent event) {
    }

    // guaranteed to be called only once, whether there is a rewind
    // cycle or not
    public void initOnlyOnce(PageEvent event) {
    }

    // gets called before rewind cycle
    public void initForRewind(PageEvent event) {
    }

    // gets called before render cycle
    public void initForRender(PageEvent event) {
    }


On 2/27/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> Thank you, but I've seen from code that beginPageRender is called only
> during rewind
> so I added a property to the page and did the following:
>
> /**
>      * Reset the grid content if the page is accessed without form
> submission
>      * (refresh or new access), then performs normal renderPage
operations.
>      */
>     public void renderPage(ResponseBuilder builder, IRequestCycle cycle)
{
>         if (!getFormRewound().booleanValue()) {
>             setEditItemCollection(new ArrayList());
>         }
>         setFormRewound(Boolean.FALSE);
>         super.renderPage(builder, cycle);
>     }
>
>     /**
>      * Called by the framework during rewind. It informs the page the it
>      * has been rewinded when the renderPage method will be called
>      */
>     public void beginPageRender() {
>         setFormRewound(Boolean.TRUE);
>     }
>
> Is there any better way to do this ?
>
> ciao,
> kiuma
>
> On 2/27/07, Sam Gendler <[EMAIL PROTECTED]> wrote:
> >
> > pageBeginRender (implement PageBeginRenderListener interface).  This
> > will be called before rendering both the rewind and render cycle, but
> > you can just put a conditional on cycle.isRewinding() in order to
> > ensure you only re-init the variable during the render cycle.
> >
> > --sam
> >
> >
> > On 2/26/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> > > What I need is that when I access or refresh the page a parameter
bound
> > to
> > > session must be reset
> > >
> > > On 2/26/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Hi!,
> > > > where do I have to put page initialization code in tapestry 4.1.1?
> > > > I need that the init method is called only when I render the page,
but
> > not
> > > > when I call a form submit.
> > > >
> > > > Thx,
> > > > kiuma
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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]


Reply via email to