onbeforerender() works recusively

lets look at your code

protected final void onBeforeRender()
    {
   super.onBeforeRender();
        org.apache.wicket.markup.html.WebMarkupContainer tabPartRepeater = (
org.apache.wicket.markup.html.WebMarkupContainer)this
                .get("tabPartRepeater");

        tabPartRepeater.removeAll();
        this.populateTabParts(tabPartRepeater);
        this.setupContentPanel();
    }

the problem here is you call super.onbeforerender(), then create more
components - so onbeforerender() wont be called on those newly created
components because it would cascade in super.onbeforerender().

to fix all you need to do is move super.onBeforeRender() to the end of the
method.

-igor


On 7/30/07, davor-x <[EMAIL PROTECTED]> wrote:
>
>
> I created a small test webapp to replicate the problem. There are source
> files and a jar package in WEB-INF/lib. Here is how to play with the app:
> Tabbed panel tabs are on top. When you click on tabs, onBeforeRender IS
> called, and the console outputs a line. Then, click on the link "Go to Tab
> X" - onBeforeRender is called, all ok. Then, click on the tab, where the
> clicked link was: here onBeforeRender is NOT called.
>
> You'll need the latest 1.3 wicket snapshot. Mine is from yesterday, built
> from svn.
> Thx cheers bye
>
> http://www.nabble.com/file/p11859405/test-20070730.zip test-20070730.zip
>
>
> igor.vaynberg wrote:
> >
> > yes it should on every request.
> >
> > during ajax only components being rendered (subtrees added to target)
> have
> > their onbeforerender() called.
> >
> > -igor
> >
> >
> > On 7/29/07, davor-x <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> Hi.
> >> Is Component.onBeforeRender supposed to execute on every request, ajax
> or
> >> not?
> >> Because, I have an example, where the component gets rendered, but
> >> onBeforeRender is not called - on the same request. And then silly
> thing
> >> happen. (latest 1.3 snapshot)
> >> Thanks for help
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/onBeforeRender-on-every-Request--tf4166588.html#a11854281
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >>
> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by: Splunk Inc.
> >> Still grepping through log files to find problems?  Stop.
> >> Now Search log events and configuration files using AJAX and a browser.
> >> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> >> _______________________________________________
> >> IMPORTANT NOTICE:
> >>
> >> This mailing list is shutting down. Please subscribe to the Apache
> Wicket
> >> user list. Send a message to: "users-subscribe at wicket.apache.org"
> and
> >> follow the instructions.
> >> _______________________________________________
> >> Wicket-user mailing list
> >> Wicket-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >>  http://get.splunk.com/
> > _______________________________________________
> > IMPORTANT NOTICE:
> >
> > This mailing list is shutting down. Please subscribe to the Apache
> Wicket
> > user list. Send a message to: "users-subscribe at wicket.apache.org" and
> > follow the instructions.
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/onBeforeRender-on-every-Request--tf4166588.html#a11859405
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> IMPORTANT NOTICE:
>
> This mailing list is shutting down. Please subscribe to the Apache Wicket
> user list. Send a message to: "users-subscribe at wicket.apache.org" and
> follow the instructions.
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user 
list. Send a message to: "users-subscribe at wicket.apache.org" and follow the 
instructions.
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to