you can most likely move that code to page.onattach() and do
Component body=get(BodyOnLoadHandler.BODY_ID);
if (body!=null) {
if (!(body instanceof MyHtmlBodyContainer)) {
remove(BodyOnLoadHandler.BODY_ID);
body=null;
}
}
if (body==null) {
add(new ...);
}
-igor
On 4/29/07, Rüdiger Schulz <[EMAIL PROTECTED]> wrote:
Hello everybody,
I just updated my application from Wicket 1.2.5 to 1.2.6. The update
broke one of my pages, which had a rather special requirement: it
needed to use my own implementation of HtmlBodyContainer. The way I
did it was like this:
public EmailPage()
{
remove(BodyOnLoadHandler.BODY_ID);
add(new MyHtmlBodyContainer(BodyOnLoadHandler.BODY_ID);
}
see also:
http://www.nabble.com/BodyContributor--tf2578291.html#a7187578
With 1.2.6 this does not work anymore. The remove throws the following
Exception:
Caused by: wicket.WicketRuntimeException: Unable to find a component
with id '_<body>' to remove
at wicket.MarkupContainer.remove(MarkupContainer.java:479)
Just doing the add without the remove doesn't work either:
Caused by: java.lang.IllegalArgumentException: A child with id
'_<body>' already exists:
[Page class = de.indyphone.logokits.wicket.ComposerPage, id = 21]
at wicket.MarkupContainer.add(MarkupContainer.java:156)
at wicket.markup.html.WebPage.getBodyContainer(WebPage.java:211)
at wicket.markup.html.WebPage.internalOnAttach(WebPage.java:175)
at wicket.Component.internalAttach(Component.java:2572)
at wicket.MarkupContainer.internalAttach(MarkupContainer.java:341)
So, where's the best location to put the code for replacing the
BodyContainer? And will this then still work in 1.3?
Thanks for your time,
Rüdiger
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user