You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com.INVALID> on 2021/09/12 01:30:21 UTC

Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

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">
             <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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Sep 13, 2021 at 10:19 AM Martin Grigorov <mg...@apache.org>
wrote:

>
>
> On Mon, Sep 13, 2021 at 9:44 AM Martin Grigorov <mg...@apache.org>
> wrote:
>
>>
>>
>> On Mon, Sep 13, 2021 at 9:27 AM Chris Colman
>> <ch...@stepaheadsoftware.com.invalid> wrote:
>>
>>>
>>> > You shouldn't use <wicket:enclosure> if you use EnclosureContainer.
>>> > Use a <div> instead.
>>>
>>> It's weird how it's worked perfectly for many years for us in Wicket 6.x.
>>>
>>> Maybe an extra note could be added to the 6.x -> 7.x migration guide in
>>> case others experience this in their migration efforts.
>>>
>>
>> We didn't do any changes in this area. Or at least I don't remember such.
>>
>> What we could do is to improve EnclosureContainer to complain when used
>> with <wicket:enclosure>.
>>
>
> This won't work without adding more logic to Enclosure (the .java
> component behind <wicket:enclosure>).
> While trying to get the markup for EnclosureContainer Wicket triggers the
> auto-component logic for <wicket:enclosure> and it fails with the error you
> reported, so there is no way to get the ComponentTag at all.
> I am against adding more logic to Enclosure.java because it has too many
> problems already.
>
> What I could do is to improve EnclosureContainer's javadoc to mention this.
>

https://issues.apache.org/jira/browse/WICKET-6919


>
>
>>
>>
>>>
>>> Regards,
>>> Chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>

Re: Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

Posted by Chris Colman <ch...@stepaheadsoftware.com.INVALID>.
On 13/09/2021 5:19 pm, Martin Grigorov wrote:
> On Mon, Sep 13, 2021 at 9:44 AM Martin Grigorov <mg...@apache.org>
> wrote:
>
>>
>> On Mon, Sep 13, 2021 at 9:27 AM Chris Colman
>> <ch...@stepaheadsoftware.com.invalid> wrote:
>>
>>>> You shouldn't use <wicket:enclosure> if you use EnclosureContainer.
>>>> Use a <div> instead.
>>> It's weird how it's worked perfectly for many years for us in Wicket 6.x.
>>>
>>> Maybe an extra note could be added to the 6.x -> 7.x migration guide in
>>> case others experience this in their migration efforts.
>>>
>> We didn't do any changes in this area. Or at least I don't remember such.
>>
>> What we could do is to improve EnclosureContainer to complain when used
>> with <wicket:enclosure>.
>>
> This won't work without adding more logic to Enclosure (the .java component
> behind <wicket:enclosure>).
> While trying to get the markup for EnclosureContainer Wicket triggers the
> auto-component logic for <wicket:enclosure> and it fails with the error you
> reported, so there is no way to get the ComponentTag at all.
> I am against adding more logic to Enclosure.java because it has too many
> problems already.
>
> What I could do is to improve EnclosureContainer's javadoc to mention this.
Improve javadoc should to the trick: At least if people are made aware 
that they need to avoid using the <wicket:enclosure> tag altogether they 
should be fine.
>
>>
>>> Regards,
>>> Chris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Sep 13, 2021 at 9:44 AM Martin Grigorov <mg...@apache.org>
wrote:

>
>
> On Mon, Sep 13, 2021 at 9:27 AM Chris Colman
> <ch...@stepaheadsoftware.com.invalid> wrote:
>
>>
>> > You shouldn't use <wicket:enclosure> if you use EnclosureContainer.
>> > Use a <div> instead.
>>
>> It's weird how it's worked perfectly for many years for us in Wicket 6.x.
>>
>> Maybe an extra note could be added to the 6.x -> 7.x migration guide in
>> case others experience this in their migration efforts.
>>
>
> We didn't do any changes in this area. Or at least I don't remember such.
>
> What we could do is to improve EnclosureContainer to complain when used
> with <wicket:enclosure>.
>

This won't work without adding more logic to Enclosure (the .java component
behind <wicket:enclosure>).
While trying to get the markup for EnclosureContainer Wicket triggers the
auto-component logic for <wicket:enclosure> and it fails with the error you
reported, so there is no way to get the ComponentTag at all.
I am against adding more logic to Enclosure.java because it has too many
problems already.

What I could do is to improve EnclosureContainer's javadoc to mention this.


>
>
>>
>> Regards,
>> Chris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>

Re: Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Sep 13, 2021 at 9:27 AM Chris Colman
<ch...@stepaheadsoftware.com.invalid> wrote:

>
> > You shouldn't use <wicket:enclosure> if you use EnclosureContainer.
> > Use a <div> instead.
>
> It's weird how it's worked perfectly for many years for us in Wicket 6.x.
>
> Maybe an extra note could be added to the 6.x -> 7.x migration guide in
> case others experience this in their migration efforts.
>

We didn't do any changes in this area. Or at least I don't remember such.

What we could do is to improve EnclosureContainer to complain when used
with <wicket:enclosure>.


>
> Regards,
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

Posted by Chris Colman <ch...@stepaheadsoftware.com.INVALID>.
> You shouldn't use <wicket:enclosure> if you use EnclosureContainer.
> Use a <div> instead.

It's weird how it's worked perfectly for many years for us in Wicket 6.x.

Maybe an extra note could be added to the 6.x -> 7.x migration guide in 
case others experience this in their migration efforts.

Regards,
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

Posted by Martin Grigorov <mg...@apache.org>.
On Sun, Sep 12, 2021, 08:03 Chris Colman
<ch...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket EnclosureContainer - any changes to behaviour from 6.x -> 7.x?

Posted by Chris Colman <ch...@stepaheadsoftware.com.INVALID>.
I found a workaround (which may be the intended usage but the API docs 
don't seem very explicit in regard to EnclosureContainer)

When using an EnclosureContainer don't use the wicket:enclosure tag like 
you do when not using an EnclosureContainer!

Use some standard HTML e.g. div or span instead of wicket:enclosure:

         <div wicket:id="menuTitleEc">
             <h3><span wicket:id="menuTitle">Title</span></h3>
         </div>

With the above markup the Wicket 6.x Java code works unchanged in Wicket 7.x

On 12/09/2021 11:30 am, Chris Colman 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">
>             <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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org