You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2011/09/02 09:57:40 UTC

Review of WICKET-4012

Devs,

May I ask you for a review of https://issues.apache.org/jira/browse/WICKET-4012.

There I found two issues:
1) Component.onAfterRender() is called N+1 times during a request,
where N is the depth of the component in the tree.
The problem is that
org.apache.wicket.MarkupContainer.onAfterRenderChildren() calls
org.apache.wicket.Component.afterRender() for its children and they
already had executed it. Child's afterRender() is executed before
parent's onAfterRender().
In special cases (Ajax+Enclosure involved) the child's onAfterRender()
wont be invoked if it is invisible but the code in
org.apache.wicket.Component.internalRender() sets FLAG_RENDERING to
true even for invisible components and we need to set it back to
false.

2) onDetach() is called twice for the page and all its components at
the end of the request
RequestCycle#detach() calls :
1) detach() on all used IRequestHandlers and respectively on their
PageProviders and Pages,
2) the special request cycle listener
org.apache.wicket.Application.createRequestCycle().new
AbstractRequestCycleListener() {...}.() commits the request where all
used pages are also detached (see
org.apache.wicket.page.RequestAdapter.commitRequest())
Igor thinks it is better to leave it this way to be on the safe side
because Component.onDetach() is not overridden often and when
overridden it usually just detaches some non-default models.

Any comments on the attached patches and suggestions for improvements
are very welcomed!

-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com