Wicket : provide a body to your tags !

Hi

We had a strange issue here : we created a component opened for extension. For some reason it was working with a Label but not a MultilineLabel. Crazy isn’t it ?
It turned out we declare this “opened” component like this :

The user of it should just override a callback method like this :

 Java |  copy |? 
            @Override
            protected Component createContentComponent(final String id, final IModel model)
            {
                return new MultiLineLabel(id, model.getObject().getContent());
            }

So why wasn’t it working ?
Simple : MultilineLabel uses replaceComponentTagBody(markupStream, openTag, body);
Or my container didn’t have any body :

Simply switching to this solved the issue :

Conclusion : always provide a body for your components, you don’t know what’ll be done with them !
++

1 comment to Wicket : provide a body to your tags !

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>