Package org.springframework.ui.context

Examples of org.springframework.ui.context.Theme


  public Theme getTheme(String themeName) {
    if (themeName == null) {
      return null;
    }
    synchronized (this.themeCache) {
      Theme theme = (Theme) this.themeCache.get(themeName);
      if (theme == null) {
        String basename = this.basenamePrefix + themeName;
        MessageSource messageSource = createMessageSource(basename);
        theme = new SimpleTheme(themeName, messageSource);
        initParent(theme);
View Full Code Here


   */
  protected void initParent(Theme theme) {
    if (theme.getMessageSource() instanceof HierarchicalMessageSource) {
      HierarchicalMessageSource messageSource = (HierarchicalMessageSource) theme.getMessageSource();
      if (getParentThemeSource() != null && messageSource.getParentMessageSource() == null) {
        Theme parentTheme = getParentThemeSource().getTheme(theme.getName());
        if (parentTheme != null) {
          messageSource.setParentMessageSource(parentTheme.getMessageSource());
        }
      }
    }
  }
View Full Code Here

  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;
  }
View Full Code Here

  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;
  }
View Full Code Here

  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;
  }
View Full Code Here

  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;
  }
View Full Code Here

  /**
   * Use the theme MessageSource for theme message resolution.
   */
  protected MessageSource getMessageSource() {
    Theme theme = getRequestContext().getTheme();
    return theme.getMessageSource();
  }
View Full Code Here

  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;
  }
View Full Code Here

    wac.setServletContext(sc);
    wac.setNamespace("test-servlet");
    wac.setConfigLocations(new String[] {"/org/springframework/web/context/WEB-INF/test-servlet.xml"});
    wac.refresh();

    Theme theme = ((ThemeSource) wac).getTheme(AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME);
    assertNotNull(theme);
    assertTrue("Theme name has to be the default theme name", AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME.equals(theme.getName()));
    themeMsgSource = theme.getMessageSource();
    assertNotNull(themeMsgSource);
    return wac;
  }
View Full Code Here

  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;
  }
View Full Code Here

TOP

Related Classes of org.springframework.ui.context.Theme

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.