use of org.apache.wicket.request.resource.UrlResourceReference in project wicket by apache.
the class UrlResourceReferenceMapper method mapHandler.
@Override
public Url mapHandler(IRequestHandler requestHandler) {
Url url = null;
if (requestHandler instanceof ResourceReferenceRequestHandler) {
ResourceReferenceRequestHandler resourceReferenceRequestHandler = (ResourceReferenceRequestHandler) requestHandler;
ResourceReference resourceReference = resourceReferenceRequestHandler.getResourceReference();
while (resourceReference instanceof ResourceBundleReference) {
// unwrap the bundle to render the url for the actual reference
resourceReference = ((ResourceBundleReference) resourceReference).getBundleReference();
}
if (resourceReference instanceof UrlResourceReference) {
UrlResourceReference urlResourceReference = (UrlResourceReference) resourceReference;
url = urlResourceReference.getUrl();
}
}
return url;
}
use of org.apache.wicket.request.resource.UrlResourceReference in project webanno by webanno.
the class ActionBarLink method onBeforeRender.
@Override
protected void onBeforeRender() {
// the embedding component/page
if (!hasBeenRendered()) {
ResourceReference _imageRes = imageRes;
if (_imageRes == null) {
_imageRes = new UrlResourceReference(Url.parse(getString("icon"))).setContextRelative(true);
}
Image image = new Image("image", _imageRes);
try {
// The getString method throws an MissingResourceException if the property is
// not available. In this case, we simply do not set a tooltip
getString("tooltip");
image.add(new AttributeModifier("title", new StringResourceModel("tooltip", ActionBarLink.this)));
} catch (MissingResourceException e) {
// Nothing to do
}
link.add(image);
}
super.onBeforeRender();
}
use of org.apache.wicket.request.resource.UrlResourceReference in project wicket by apache.
the class CryptoMapperTest method urlResourceReference.
/**
* UrlResourceReferences, WICKET-5319
*/
@Test
public void urlResourceReference() {
UrlResourceReference resource = new UrlResourceReference(Url.parse("http://wicket.apache.org/"));
Url url = mapper.mapHandler(new ResourceReferenceRequestHandler(resource));
assertEquals("http://wicket.apache.org/", url.toString(StringMode.FULL));
}
Aggregations