use of org.apache.wicket.markup.head.HeaderItem 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));
}
use of org.apache.wicket.markup.head.HeaderItem in project wiquery by WiQuery.
the class CoreUIJavaScriptResourceReference method getDependencies.
@Override
public List<HeaderItem> getDependencies() {
Iterable<? extends HeaderItem> jquery = super.getDependencies();
List<HeaderItem> ret = new ArrayList<HeaderItem>();
for (HeaderItem curItem : jquery) ret.add(curItem);
ret.add(CssHeaderItem.forReference(WiQueryCoreThemeResourceReference.get()));
return ret;
}
use of org.apache.wicket.markup.head.HeaderItem in project hale by halestudio.
the class OpenIdSelectorJsReference method getDependencies.
@Override
public Iterable<? extends HeaderItem> getDependencies() {
List<HeaderItem> deps = new ArrayList<HeaderItem>();
for (HeaderItem dep : super.getDependencies()) {
deps.add(dep);
}
deps.add(CssHeaderItem.forReference(OpenIdSelectorCssReference.INSTANCE));
deps.add(JavaScriptHeaderItem.forReference(new JavaScriptResourceReference(OpenIdSelectorJsReference.class, "js/openid-jquery.js")));
return deps;
}
use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.
the class ResourceBundleReference method getDependencies.
@Override
public List<HeaderItem> getDependencies() {
Set<HeaderItem> ret = new LinkedHashSet<>();
for (HeaderItem curProvided : providedResources) {
for (HeaderItem curDependency : curProvided.getDependencies()) ret.add(curDependency);
}
for (HeaderItem curProvided : providedResources) {
ret.remove(curProvided);
}
List<HeaderItem> dependencies = super.getDependencies();
dependencies.addAll(ret);
return dependencies;
}
use of org.apache.wicket.markup.head.HeaderItem in project wicket by apache.
the class FilteringHeaderResponse method getContent.
/**
* Gets the content that was rendered to this header response and matched the filter with the
* given name.
*
* @param filterName
* the name of the filter to get the bucket for
* @return the content that was accepted by the filter with this name
*/
@SuppressWarnings("resource")
public final CharSequence getContent(String filterName) {
if (filterName == null || !responseFilterMap.containsKey(filterName)) {
return "";
}
List<HeaderItem> resp = responseFilterMap.get(filterName);
final StringResponse strResponse = new StringResponse();
IHeaderResponse headerRenderer = new HeaderResponse() {
@Override
protected Response getRealResponse() {
return strResponse;
}
@Override
public boolean wasRendered(Object object) {
return FilteringHeaderResponse.this.getRealResponse().wasRendered(object);
}
@Override
public void markRendered(Object object) {
FilteringHeaderResponse.this.getRealResponse().markRendered(object);
}
};
headerRenderer = decorate(headerRenderer);
for (HeaderItem curItem : resp) {
headerRenderer.render(curItem);
}
headerRenderer.close();
return strResponse.getBuffer();
}
Aggregations