You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Korbinian Bachl <ko...@whiskyworld.de> on 2017/07/05 10:01:20 UTC

wicket8 - enclosure & onBeforeRender

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

Re: wicket8 - enclosure & onBeforeRender

Posted by Andrea Del Bene <an...@gmail.com>.
I think it's like this since 7.x

On Thu, Jul 6, 2017 at 8:23 AM, Martin Grigorov <mg...@apache.org>
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 <
> korbinian.bachl@whiskyworld.de> 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
> >
>

Re: wicket8 - enclosure & onBeforeRender

Posted by Martin Grigorov <mg...@apache.org>.
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 <
korbinian.bachl@whiskyworld.de> 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
>