...
Code Block |
---|
public class MyPage extends WebPage { public MyPage() { WebMarkupContainer c=new WebMarkupContainer(); c.add(new AbstractBehavior() { public void renderHead(IHeaderResponse response) { response.renderJavascriptReference(new PackageResourceReference(YuiLib.class, "yahoo-dom-event/yahoo-dom-event.js")); } }); add(c); } } |
Removed TextTemplateHeaderContributor / StringHeaderContributor
Wicket 1.4:
Code Block |
---|
public class DynamicCssBehavior extends TextTemplateHeaderContributor
public DynamicCssBehavior() {
super(new CssTemplate(new MyTextTemplate()), new VariablesModel());
}
private static class VariablesModel extends AbstractReadOnlyModel<Map<String, Object>> {
public Map<String, Object> getObject() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("background", "#ff0000");
return variables;
}
}
}
|
Wicket 1.5:
Code Block |
---|
public class DynamicCssBehavior extends Behavior {
private TextTemplate template = CssTemplate(new MyTextTemplate());
public void renderHead(Component component, IHeaderResponse response) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("background", "#ff0000");
response.renderString(template.asString(variables));
}
|
(M4) Resource decoration
With org.apache.wicket.Application.setHeaderResponseDecorator(IHeaderResponseDecorator) it is possible to intercept the contribution of resources. This way you may specify which resources will be contributed to the <head> part of the page and which will be contributed to the end (after </body>). Or you may merge several contributions into a bigger one, i.e. serve them all in one http request. For more information consult with Resource decoration or see the new wicket-example.
...