On Sun, Sep 12, 2021, 08:03 Chris Colman <chr...@stepaheadsoftware.com.invalid> wrote:
> We're in the middle of migrating a large enterprise content management > system (>1000 UI classes) from 6.x to 7.x. > > We've finally got it compiling with Wicket 7.x but we're having an issue > with an EnclosureContainer that worked fine in Wicket 6.x. > > org.apache.wicket.WicketRuntimeException: Could not find child with id: > menuTitle in the wicket:enclosure > at > org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:295) > > ~[wicket-core-7.18.0.jar:7.18.0] > at > org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:273) > > ~[wicket-core-7.18.0.jar:7.18.0] > at > org.apache.wicket.markup.html.internal.Enclosure.getChild(Enclosure.java:136) > > ~[wicket-core-7.18.0.jar:7.18.0] > at > org.apache.wicket.markup.html.internal.Enclosure.onConfigure(Enclosure.java:178) > > ~[wicket-core-7.18.0.jar:7.18.0] > at org.apache.wicket.Component.configure(Component.java:1056) > ~[wicket-core-7.18.0.jar:7.18.0] > at > org.apache.wicket.Component.internalBeforeRender(Component.java:941) > ~[wicket-core-7.18.0.jar:7.18.0] > at org.apache.wicket.Component.beforeRender(Component.java:1018) > ~[wicket-core-7.18.0.jar:7.18.0] > at > org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1826) > > ~[wicket-core-7.18.0.jar:7.18.0] > at org.apache.wicket.Component.onBeforeRender(Component.java:3921) > ~[wicket-core-7.18.0.jar:7.18.0] > at > com.sas.av.ui.wicket.templates.original.OrganizationPanel.onBeforeRender(OrganizationPanel.java:576) > > ~[classes/:?] > ... > > > I created a Wicket quickstart in 7.18.0 and was able to reproduce the > issue with the following code: > > > Markup: > > <!DOCTYPE html> > <html xmlns:wicket="http://wicket.apache.org"> > <head> > <meta charset="utf-8" /> > <title>Apache Wicket Quickstart</title> > </head> > <body> > <h1>Apache Wicket</h1> > <wicket:enclosure wicket:id="menuTitleEc"> > You shouldn't use <wicket:enclosure> if you use EnclosureContainer. Use a <div> instead. <h3><span wicket:id="menuTitle">Title</span></h3> > </wicket:enclosure> > </body> > </html> > > Java: > > package com.sas; > > import org.apache.wicket.request.mapper.parameter.PageParameters; > import org.apache.wicket.markup.html.basic.Label; > import org.apache.wicket.markup.html.WebPage; > import org.apache.wicket.markup.html.basic.*; > > public class HomePage extends WebPage { > private static final long serialVersionUID = 1L; > > public HomePage(final PageParameters parameters) { > super(parameters); > > Label menuTitleLabel = new Label("menuTitle", "Fred"); > EnclosureContainer ec = new EnclosureContainer("menuTitleEc", > menuTitleLabel); > ec.add(menuTitleLabel); > menuTitleLabel.setVisible(true); > add(ec); > } > } > > > If I don't use an explicit EnclosureContainer and remove the wicket:id= > from the wicket:enclosure element it works but I need to explicitly > declare the enclosure in the component hierarchy. > > Regards, > Chris > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >