You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2011/09/05 13:36:10 UTC

[jira] [Assigned] (WICKET-4012) Component's onAfterRender() is called so many times as it is depth in the component tree + 1

     [ https://issues.apache.org/jira/browse/WICKET-4012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov reassigned WICKET-4012:
---------------------------------------

    Assignee: Martin Grigorov

> Component's onAfterRender() is called so many times as it is depth in the component tree + 1
> --------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4012
>                 URL: https://issues.apache.org/jira/browse/WICKET-4012
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-RC7
>            Reporter: Martin Grigorov
>            Assignee: Martin Grigorov
>             Fix For: 1.5.1
>
>         Attachments: WICKET-4012-afterRender.patch, detachedTwice.patch, wicket-4012.tar.gz
>
>
> org.apache.wicket.Component.afterRender() calls org.apache.wicket.Component.onAfterRenderChildren() which for MarkupContainers calls afterRender() for its children.
> So for code like:
>  WebMarkupContainer comp1 = new WebMarkupContainer("c1");
>         add(comp1);
>         
>         WebMarkupContainer comp2 = new WebMarkupContainer("c2");
>         comp1.add(comp2);
>         
>         WebMarkupContainer comp3 = new WebMarkupContainer("c3") {
>             @Override
>             protected void onAfterRender() {
>                 super.onAfterRender();
>                 System.err.println("called");
>             }
>             
>         };
>         comp2.add(comp3);
> you'll see "called" printed 4 times in a single request.
> Additionally I think onAfterRenderChildren() should be called before onAfterRender() in Component.afterRender(). The flow should be first-in last-out: onBeforeRender > onBeforeRenderChildren > onAfterRenderChildren > onAfterRender,

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira