That would, ofcourse, be the perfect solution. Do I have to report a bug
for this?
I guess it would make sense to provide just a single implementation to
be used by both components, avoiding problems while trying to keep
them in sync.
Juergen
On 11/7/05, Ruud Booltink <[EMAIL PROTECTED]> wrote:
I think adding this code to WebComponent's renderHead() would solve this
problem.
String stmt =
((IBodyOnloadContributor)handlers[i]).getBodyOnload();
if (stmt != null)
{
((WebPage)getPage()).appendToBodyOnLoad(stmt);
}
Maby one of the core developers could look at this....
Ruud
Marco van de Haar wrote:
I dived into the wicket core code and I ended up in
WebComponent.renderHead().
Since I noticed that getBodyOnLoad() was only called for
FormComponents and WebMarkupContainers I expected a difference in
renderHead() for WebComponent and WebMarkupContainer....... and I
found it.
Webcomponent.renderHead()
/**
* THIS IS NOT PART OF WICKETS PUBLIC API. DO NOT CALL IT YOURSELF
* Print to the web response what ever the component wants
* to contribute to the head section. Does nothing by default.
*
* @param container The HtmlHeaderContainer
* @see
wicket.markup.html.IHeaderContributor#renderHead(wicket.markup.html.HtmlHeaderContainer)
*/
public void renderHead(final HtmlHeaderContainer container)
{
AjaxHandler[] handlers = getAjaxHandlers();
if (handlers != null)
{
for (int i = 0; i < handlers.length; i++)
{
handlers[i].renderHead(container);
}
}
}
and WebMarkupContainer.renderHead():
public void renderHead(final HtmlHeaderContainer container)
{
....
.....
// get head and body contributions in one loop
AjaxHandler[] handlers = getAjaxHandlers();
if (handlers != null)
{
for (int i = 0; i < handlers.length; i++)
{
((IHeaderContributor)handlers[i]).renderHead(container);
String stmt =
((IBodyOnloadContributor)handlers[i]).getBodyOnload();
if (stmt != null)
{
((WebPage)getPage()).appendToBodyOnLoad(stmt);
}
} }
}
I believe that getBodyOnload() is not called in WebComponent. And thus
any bodyonload contributions made in AjaxHandlers bound to
WebComponents are ignored. Is this a bug? If so, it must be easy to fix.
Marco
That should work. Might be a bug. Could you pls try to step into it?
Eelco
On 11/4/05, Marco van de Haar <[EMAIL PROTECTED]> wrote:
I encountered somewhat unexpected behavior when I tried using
getBodyOnloadContribution().
When adding custom Ajaxhandlers to components I noticed that the
getBodyOnloadContribution() is not called when I added the handler
to an
Image or a Label. It was however called upon loading the page when I
added my handler to a WebMarkupContainer.
Is this method meant to hehave this way? If so, I did not find it in
the
documentation. I think it is logical that the method is also called for
Components like Label and Image. I am not really familliar with
AjaxHandler's internal code however.
Marco
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user