Example usage for org.apache.wicket.core.util.resource.locator IResourceNameIterator getStyle

List of usage examples for org.apache.wicket.core.util.resource.locator IResourceNameIterator getStyle

Introduction

In this page you can find the example usage for org.apache.wicket.core.util.resource.locator IResourceNameIterator getStyle.

Prototype

String getStyle();

Source Link

Document

Get the exact Style which has been used for the latest resource path.

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;/*ww  w.  j  a v a 2  s .c  o  m*/

    // 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;
        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;
}