Search in sources :

Example 11 with ResourceReference

use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.

the class ModalWindow method renderHead.

@Override
public void renderHead(final IHeaderResponse response) {
    super.renderHead(response);
    CoreLibrariesContributor.contributeAjax(getApplication(), response);
    response.render(JavaScriptHeaderItem.forReference(JAVASCRIPT));
    ResourceReference cssResource = newCssResource();
    if (cssResource != null) {
        response.render(CssHeaderItem.forReference(cssResource));
    }
}
Also used : ResourceReference(org.apache.wicket.request.resource.ResourceReference) CssResourceReference(org.apache.wicket.request.resource.CssResourceReference) JavaScriptResourceReference(org.apache.wicket.request.resource.JavaScriptResourceReference)

Example 12 with ResourceReference

use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.

the class WicketAjaxDebugJQueryResourceReference method getDependencies.

@Override
public List<HeaderItem> getDependencies() {
    final ResourceReference wicketAjaxReference;
    if (Application.exists()) {
        wicketAjaxReference = Application.get().getJavaScriptLibrarySettings().getWicketAjaxReference();
    } else {
        wicketAjaxReference = WicketAjaxJQueryResourceReference.get();
    }
    List<HeaderItem> dependencies = super.getDependencies();
    dependencies.add(JavaScriptHeaderItem.forReference(wicketAjaxReference));
    return dependencies;
}
Also used : JavaScriptResourceReference(org.apache.wicket.request.resource.JavaScriptResourceReference) ResourceReference(org.apache.wicket.request.resource.ResourceReference) HeaderItem(org.apache.wicket.markup.head.HeaderItem) JavaScriptHeaderItem(org.apache.wicket.markup.head.JavaScriptHeaderItem)

Example 13 with ResourceReference

use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.

the class WicketAjaxJQueryResourceReference method getDependencies.

@Override
public List<HeaderItem> getDependencies() {
    final ResourceReference jqueryReference;
    if (Application.exists()) {
        jqueryReference = Application.get().getJavaScriptLibrarySettings().getJQueryReference();
    } else {
        jqueryReference = JQueryResourceReference.getV2();
    }
    List<HeaderItem> dependencies = super.getDependencies();
    dependencies.add(JavaScriptHeaderItem.forReference(jqueryReference));
    return dependencies;
}
Also used : JavaScriptResourceReference(org.apache.wicket.request.resource.JavaScriptResourceReference) JQueryResourceReference(org.apache.wicket.resource.JQueryResourceReference) ResourceReference(org.apache.wicket.request.resource.ResourceReference) HeaderItem(org.apache.wicket.markup.head.HeaderItem) JavaScriptHeaderItem(org.apache.wicket.markup.head.JavaScriptHeaderItem)

Example 14 with ResourceReference

use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.

the class ResourceMapperTest method before.

/**
 * @throws Exception
 */
@Before
public void before() throws Exception {
    resource = new TestResource();
    tester.getApplication().getSharedResources().add(SHARED_NAME, resource);
    ResourceReference resourceReference = new SharedResourceReference(SHARED_NAME);
    mapper = new ResourceMapper("/test/resource", resourceReference);
    mapperWithPlaceholder = new ResourceMapper("/test2/${name}/resource", resourceReference);
    tester.getApplication().getRootRequestMapperAsCompound().add(mapper);
}
Also used : SharedResourceReference(org.apache.wicket.request.resource.SharedResourceReference) SharedResourceReference(org.apache.wicket.request.resource.SharedResourceReference) ResourceReference(org.apache.wicket.request.resource.ResourceReference) Before(org.junit.Before)

Example 15 with ResourceReference

use of org.apache.wicket.request.resource.ResourceReference in project wicket by apache.

the class SharedResources method add.

/**
 * Adds a resource.
 *
 * @param scope
 *            Scope of resource
 * @param name
 *            Logical name of resource
 * @param locale
 *            The locale of the resource
 * @param style
 *            The resource style (see {@link org.apache.wicket.Session})
 * @param variation
 *            The component specific variation of the style
 * @param resource
 *            Resource to store
 */
public final void add(final Class<?> scope, final String name, final Locale locale, final String style, final String variation, final IResource resource) {
    ResourceReference ref = new AutoResourceReference(scope, name, locale, style, variation, resource);
    registry.registerResourceReference(ref);
}
Also used : ResourceReference(org.apache.wicket.request.resource.ResourceReference)

Aggregations

ResourceReference (org.apache.wicket.request.resource.ResourceReference)46 IResource (org.apache.wicket.request.resource.IResource)10 PackageResourceReference (org.apache.wicket.request.resource.PackageResourceReference)8 SharedResourceReference (org.apache.wicket.request.resource.SharedResourceReference)7 Test (org.junit.Test)7 ResourceReferenceRequestHandler (org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler)6 HeaderItem (org.apache.wicket.markup.head.HeaderItem)5 Url (org.apache.wicket.request.Url)5 JavaScriptResourceReference (org.apache.wicket.request.resource.JavaScriptResourceReference)5 JavaScriptLibrarySettings (org.apache.wicket.settings.JavaScriptLibrarySettings)5 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)4 Page (org.apache.wicket.Page)3 WicketRuntimeException (org.apache.wicket.WicketRuntimeException)3 JavaScriptHeaderItem (org.apache.wicket.markup.head.JavaScriptHeaderItem)3 Image (org.apache.wicket.markup.html.image.Image)3 Properties (java.util.Properties)2 Application (org.apache.wicket.Application)2 StringResourceModel (org.apache.wicket.model.StringResourceModel)2 ByteArrayResource (org.apache.wicket.request.resource.ByteArrayResource)2 CssResourceReference (org.apache.wicket.request.resource.CssResourceReference)2