Description
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()
};
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,