Search in sources :

Example 1 with ResourceBundleThemeSource

use of org.springframework.ui.context.support.ResourceBundleThemeSource in project spring-framework by spring-projects.

the class RequestContext method getFallbackTheme.

/**
	 * Determine the fallback theme for this context.
	 * <p>The default implementation returns the default theme (with name "theme").
	 * @return the fallback theme (never {@code null})
	 */
protected Theme getFallbackTheme() {
    ThemeSource themeSource = RequestContextUtils.getThemeSource(getRequest());
    if (themeSource == null) {
        themeSource = new ResourceBundleThemeSource();
    }
    Theme theme = themeSource.getTheme(DEFAULT_THEME_NAME);
    if (theme == null) {
        throw new IllegalStateException("No theme defined and no fallback theme found");
    }
    return theme;
}
Also used : ResourceBundleThemeSource(org.springframework.ui.context.support.ResourceBundleThemeSource) Theme(org.springframework.ui.context.Theme) ThemeSource(org.springframework.ui.context.ThemeSource) ResourceBundleThemeSource(org.springframework.ui.context.support.ResourceBundleThemeSource)

Aggregations

Theme (org.springframework.ui.context.Theme)1 ThemeSource (org.springframework.ui.context.ThemeSource)1 ResourceBundleThemeSource (org.springframework.ui.context.support.ResourceBundleThemeSource)1