Package org.springframework.ui.context

Examples of org.springframework.ui.context.HierarchicalThemeSource


  public static ThemeSource initThemeSource(ApplicationContext context) {
    if (context.containsLocalBean(THEME_SOURCE_BEAN_NAME)) {
      ThemeSource themeSource = context.getBean(THEME_SOURCE_BEAN_NAME, ThemeSource.class);
      // Make ThemeSource aware of parent ThemeSource.
      if (context.getParent() instanceof ThemeSource && themeSource instanceof HierarchicalThemeSource) {
        HierarchicalThemeSource hts = (HierarchicalThemeSource) themeSource;
        if (hts.getParentThemeSource() == null) {
          // Only set parent context as parent ThemeSource if no parent ThemeSource
          // registered already.
          hts.setParentThemeSource((ThemeSource) context.getParent());
        }
      }
      if (logger.isDebugEnabled()) {
        logger.debug("Using ThemeSource [" + themeSource + "]");
      }
      return themeSource;
    }
    else {
      // Use default ThemeSource to be able to accept getTheme calls, either
      // delegating to parent context's default or to local ResourceBundleThemeSource.
      HierarchicalThemeSource themeSource = null;
      if (context.getParent() instanceof ThemeSource) {
        themeSource = new DelegatingThemeSource();
        themeSource.setParentThemeSource((ThemeSource) context.getParent());
      }
      else {
        themeSource = new ResourceBundleThemeSource();
      }
      if (logger.isDebugEnabled()) {
View Full Code Here


  public static ThemeSource initThemeSource(ApplicationContext context) {
    if (context.containsLocalBean(THEME_SOURCE_BEAN_NAME)) {
      ThemeSource themeSource = (ThemeSource) context.getBean(THEME_SOURCE_BEAN_NAME, ThemeSource.class);
      // Make ThemeSource aware of parent ThemeSource.
      if (context.getParent() instanceof ThemeSource && themeSource instanceof HierarchicalThemeSource) {
        HierarchicalThemeSource hts = (HierarchicalThemeSource) themeSource;
        if (hts.getParentThemeSource() == null) {
          // Only set parent context as parent ThemeSource if no parent ThemeSource
          // registered already.
          hts.setParentThemeSource((ThemeSource) context.getParent());
        }
      }
      if (logger.isDebugEnabled()) {
        logger.debug("Using ThemeSource [" + themeSource + "]");
      }
      return themeSource;
    }
    else {
      // Use default ThemeSource to be able to accept getTheme calls, either
      // delegating to parent context's default or to local ResourceBundleThemeSource.
      HierarchicalThemeSource themeSource = null;
      if (context.getParent() instanceof ThemeSource) {
        themeSource = new DelegatingThemeSource();
        themeSource.setParentThemeSource((ThemeSource) context.getParent());
      }
      else {
        themeSource = new ResourceBundleThemeSource();
      }
      if (logger.isDebugEnabled()) {
View Full Code Here

TOP

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

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.