I think it's like this since 7.x On Thu, Jul 6, 2017 at 8:23 AM, Martin Grigorov <[email protected]> wrote:
> Hi, > > I think this is the expected behavior. > onBeforeRender() is called first on the parent and then on all its > children. > onBeforeRender() is the last method where Enclosure can check its > controlling child for existence. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Wed, Jul 5, 2017 at 12:01 PM, Korbinian Bachl < > [email protected]> wrote: > > > Hi, > > > > is it intended that any wicket:enclosure breaks if it is depending on a > > component that is not added in the constructor but in "onBeforeRender"? > > > > e.g: > > > > <wicket:enclosure child="version"> > > <tr> > > <th>Bezeichnung:</th> > > <td wicket:id="version">value</td> > > </tr> > > </wicket:enclosure> > > > > with java: > > public HomePage(final PageParameters parameters) { > > super(parameters); > > add(new Label("version", getApplication(). > > getFrameworkSettings().getVersion())); > > } > > > > works while if you delay it to: > > > > @Override > > protected void onBeforeRender() { > > super.onBeforeRender(); > > add(new Label("version", getApplication(). > > getFrameworkSettings().getVersion())); > > } > > > > it breaks with: > > > > 12:00:25.172 [main] WARN RequestCycleExtra - > > ******************************** > > Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.666 sec > > <<< FAILURE! - in com.mycompany.TestHomePage > > homepageRendersSuccessfully(com.mycompany.TestHomePage) Time elapsed: > > 0.589 sec <<< ERROR! > > org.apache.wicket.WicketRuntimeException: Could not find child with id: > > version in the wicket:enclosure > > at org.apache.wicket.markup.html.internal.Enclosure. > > checkChildComponent(Enclosure.java:295) > > > > > > > > > > Best, > > > > KB > > >
