Example usage for org.apache.wicket.util.resource IResourceStream setVariation

List of usage examples for org.apache.wicket.util.resource IResourceStream setVariation

Introduction

In this page you can find the example usage for org.apache.wicket.util.resource IResourceStream setVariation.

Prototype

void setVariation(String variation);

Source Link

Document

This method shouldn't be used from the outside.

Usage

From source file:com.evolveum.midpoint.web.util.MidPointResourceStreamLocator.java

License:Apache License

@Override
public IResourceStream locate(Class<?> clazz, String path, String style, String variation, Locale locale,
        String extension, boolean strict) {
    IResourceStream stream = null;

    // If path contains a locale, then it'll replace the locale provided to this method
    ResourceUtils.PathLocale data = ResourceUtils.getLocaleFromFilename(path);
    if ((data != null) && (data.locale != null)) {
        path = data.path;//w  ww. j  av a  2s  . c  o m
        locale = data.locale;
    }

    // Try the various combinations of style, locale and extension to find the resource.
    IResourceNameIterator iter = newResourceNameIterator(path, locale, style, variation, extension, strict);
    while (iter.hasNext()) {
        String newPath = iter.next();

        stream = locate(clazz, newPath);

        if (stream != null) {
            stream.setLocale(iter.getLocale());
            stream.setStyle(iter.getStyle());
            stream.setVariation(iter.getVariation());
            break;
        }
    }

    return stream;
}