Search in sources :

Example 1 with JQueryPluginResourceReference

use of org.apache.wicket.resource.JQueryPluginResourceReference in project wicket by apache.

the class HomePage method renderHead.

@Override
public void renderHead(IHeaderResponse response) {
    super.renderHead(response);
    // example of things that may be shared for all your applications across your company,
    // two CSS resources in the same group. header.css is rendered first because has lower
    // "order" number
    response.render(CssHeaderItem.forReference(new CssResourceReference(HomePage.class, "footer.css")));
    response.render(CssHeaderItem.forReference(new CssResourceReference(HomePage.class, "header.css")));
    // example of something that may be in this single application:
    response.render(CssHeaderItem.forReference(new CssResourceReference(HomePage.class, "app.css")));
    // example of something that may be limited to certain pages:
    response.render(CssHeaderItem.forReference(new CssResourceReference(HomePage.class, "HomePage.css")));
    response.render(JavaScriptHeaderItem.forReference(new JQueryPluginResourceReference(HomePage.class, "HomePage.js")));
    response.render(new FilteredHeaderItem(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(HomePage.class, "top.js")), FilteringHeaderResponse.DEFAULT_HEADER_FILTER_NAME));
}
Also used : JQueryPluginResourceReference(org.apache.wicket.resource.JQueryPluginResourceReference) FilteredHeaderItem(org.apache.wicket.markup.head.filter.FilteredHeaderItem) JavaScriptResourceReference(org.apache.wicket.request.resource.JavaScriptResourceReference) CssResourceReference(org.apache.wicket.request.resource.CssResourceReference)

Example 2 with JQueryPluginResourceReference

use of org.apache.wicket.resource.JQueryPluginResourceReference in project wicket by apache.

the class FilteredHeaderPage method renderHead.

@Override
public void renderHead(IHeaderResponse response) {
    // rendered at the default header bucket
    final JavaScriptResourceReference topJsReference = new JavaScriptResourceReference(FilteredHeaderPage.class, "top.js");
    response.render(new FilteredHeaderItem(JavaScriptHeaderItem.forReference(topJsReference), FilteringHeaderResponse.DEFAULT_HEADER_FILTER_NAME));
    // rendered at the bottom of the body bucket
    JQueryPluginResourceReference bottomJs = new JQueryPluginResourceReference(FilteredHeaderPage.class, "bottom.js") {

        private static final long serialVersionUID = 1L;

        @Override
        public List<HeaderItem> getDependencies() {
            List<HeaderItem> dependencies = super.getDependencies();
            // WICKET-4566 : depend on a resource which is rendered in a different bucket
            dependencies.add(JavaScriptHeaderItem.forReference(topJsReference));
            return dependencies;
        }
    };
    response.render(JavaScriptHeaderItem.forReference(bottomJs));
}
Also used : JQueryPluginResourceReference(org.apache.wicket.resource.JQueryPluginResourceReference) JavaScriptResourceReference(org.apache.wicket.request.resource.JavaScriptResourceReference) HeaderItem(org.apache.wicket.markup.head.HeaderItem) JavaScriptHeaderItem(org.apache.wicket.markup.head.JavaScriptHeaderItem)

Aggregations

JavaScriptResourceReference (org.apache.wicket.request.resource.JavaScriptResourceReference)2 JQueryPluginResourceReference (org.apache.wicket.resource.JQueryPluginResourceReference)2 HeaderItem (org.apache.wicket.markup.head.HeaderItem)1 JavaScriptHeaderItem (org.apache.wicket.markup.head.JavaScriptHeaderItem)1 FilteredHeaderItem (org.apache.wicket.markup.head.filter.FilteredHeaderItem)1 CssResourceReference (org.apache.wicket.request.resource.CssResourceReference)1