Example usage for org.apache.wicket.request.resource PackageResource exists

List of usage examples for org.apache.wicket.request.resource PackageResource exists

Introduction

In this page you can find the example usage for org.apache.wicket.request.resource PackageResource exists.

Prototype

public static boolean exists(final ResourceReference.Key key) 

Source Link

Document

Checks whether a resource for a given set of criteria exists.

Usage

From source file:org.apache.isis.viewer.wicket.ui.pages.PageAbstract.java

License:Apache License

/**
 * Contributes theme specific Bootstrap CSS overrides if there is such resource
 *
 * @param response The header response to contribute to
 *///from   w w w . j  a  va2 s.c om
private void contributeThemeSpecificOverrides(final IHeaderResponse response) {
    final IBootstrapSettings bootstrapSettings = Bootstrap.getSettings(getApplication());
    final ITheme activeTheme = bootstrapSettings.getActiveThemeProvider().getActiveTheme();
    final String name = activeTheme.name().toLowerCase(Locale.ENGLISH);
    final String themeSpecificOverride = "bootstrap-overrides-" + name + ".css";
    final ResourceReference.Key themeSpecificOverrideKey = new ResourceReference.Key(
            PageAbstract.class.getName(), themeSpecificOverride, null, null, null);
    if (PackageResource.exists(themeSpecificOverrideKey)) {
        response.render(CssHeaderItem.forReference(new CssResourceReference(themeSpecificOverrideKey)));
    }
}