Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
Wicket 9.7.0
Description
Hi,
Not sure if it is a real issue. However here it goes:
Behavior.beforeRender(Component) is called after renderHead of both Component and Behavior.
KR,
Helmut
Code (using Wicket 9.7.0)
Java
public class CallOrderPage extends WebPage {
public CallOrderPage() {
Label l = (Label)new Label("compAddedInCon", Model.of("Constructor")) {
@Override
protected void onConfigure() {
super.onConfigure();
System.out.println(getClass() + ": onConfigure");
}
@Override
public void onBeforeRender() {
super.onBeforeRender();
System.out.println(getClass() + ": onBeforeRender");
}
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
System.out.println(getClass() + ": renderHead");
response.render(new OwnODR(getClass(), "console.log('" + getClass() + "')"));
}
}.add(new SysOutBehavior());
add(l);
}
@Override
protected void onConfigure() {
super.onConfigure();
System.out.println(getClass() + ": onConfigure");
}
@Override
public void onBeforeRender() {
super.onBeforeRender();
System.out.println(getClass() + ": onBeforeRender");
}
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
System.out.println(getClass() + ": renderHead");
response.render(new OwnODR(getClass(), "console.log('" + getClass() + "')"));
}
}
class SysOutBehavior extends Behavior {
@Override
public void onConfigure(Component component) {
super.onConfigure(component);
System.out.println(getClass() + ": onConfigure");
}
@Override
public void beforeRender(Component component) {
super.beforeRender(component);
System.out.println(getClass() + ": beforeRender");
}
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
System.out.println(getClass() + ": renderHead");
response.render(new OwnODR(getClass(), "console.log('" + getClass() + "')"));
}
}
class OwnODR extends OnDomReadyHeaderItem {
private Class<?> cl;
protected OwnODR(Class<?> cl, String script) {
super(script);
this.cl = cl;
}
@Override
public CharSequence getJavaScript() {
System.out.println("getJavaScript(): " + cl);
return super.getJavaScript();
}
}
HTML
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<head>
</head>
<body>
<div wicket:id="compAddedInCon"></div></body>
</html>
Output
class CallOrderPage: onConfigure
class CallOrderPage$1: onConfigure
class SysOutBehavior: onConfigure
class CallOrderPage$1: onBeforeRender
class CallOrderPage: onBeforeRender
class CallOrderPage$1: renderHead
class SysOutBehavior: renderHead
class CallOrderPage: renderHead
getJaveScript: CallOrderPage$1
getJaveScript: SysOutBehavior
getJaveScript: CallOrderPage
class SysOutBehavior: beforeRender