use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.
the class CoreLibrariesContributor method contribute.
/**
* Contributes the backing library plus the implementation of Wicket.Event.
*
* @param application
* the application instance
* @param response
* the current header response
*/
public static void contribute(final Application application, final IHeaderResponse response) {
JavaScriptLibrarySettings jsLibrarySettings = application.getJavaScriptLibrarySettings();
ResourceReference wicketAjaxReference = jsLibrarySettings.getWicketAjaxReference();
response.render(JavaScriptHeaderItem.forReference(wicketAjaxReference));
}
use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.
the class JQueryPluginResourceReference method getDependencies.
@Override
public List<HeaderItem> getDependencies() {
final ResourceReference backingLibraryReference;
if (Application.exists()) {
backingLibraryReference = Application.get().getJavaScriptLibrarySettings().getJQueryReference();
} else {
backingLibraryReference = DynamicJQueryResourceReference.get();
}
List<HeaderItem> dependencies = super.getDependencies();
dependencies.add(JavaScriptHeaderItem.forReference(backingLibraryReference));
return dependencies;
}
use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.
the class WicketTesterTest method clickResourceLinkWithResourceReference.
/**
* https://issues.apache.org/jira/browse/WICKET-4810
*
* Clicking on ResourceLink should deliver the resource reference's content
*/
@Test
public void clickResourceLinkWithResourceReference() {
MockPageWithLink page = new MockPageWithLink();
String content = "content";
final ByteArrayResource resource = new ByteArrayResource("text/plain", content.getBytes(), "fileName.txt");
ResourceReference reference = new ResourceReference(WicketTesterTest.class, "resourceLinkWithResourceReferenceTest") {
@Override
public IResource getResource() {
return resource;
}
};
ResourceLink<Void> link = new ResourceLink<Void>(MockPageWithLink.LINK_ID, reference);
page.add(link);
tester.startPage(page);
tester.clickLink(MockPageWithLink.LINK_ID, false);
assertEquals(tester.getContentTypeFromResponseHeader(), "text/plain");
assertEquals(content, tester.getLastResponseAsString());
}
use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.
the class Image method setImageResourceReferences.
/**
* @param parameters
* Set the resource parameters for the resource.
* @param resourceReferences
* The resource references to set.
*/
public void setImageResourceReferences(final PageParameters parameters, final ResourceReference... resourceReferences) {
localizedImageResources.clear();
for (ResourceReference resourceReference : resourceReferences) {
LocalizedImageResource localizedImageResource = new LocalizedImageResource(this);
if (parameters != null) {
localizedImageResource.setResourceReference(resourceReference, parameters);
} else {
localizedImageResource.setResourceReference(resourceReference);
}
localizedImageResources.add(localizedImageResource);
}
}
use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.
the class Video method onComponentTag.
@Override
protected void onComponentTag(ComponentTag tag) {
checkComponentTag(tag, "video");
super.onComponentTag(tag);
Integer _width = getWidth();
if (_width != null) {
tag.put("width", _width);
}
Integer _height = getHeight();
if (_height != null) {
tag.put("height", _height);
}
ResourceReference _poster = getPoster();
if (_poster != null) {
tag.put("poster", RequestCycle.get().urlFor(_poster, getPosterPageParameters()));
}
}
Aggregations