Top Description Fields Constructors Methods
org.springframework.ui.context.support

public Class ResourceBundleThemeSource

extends Object
implements HierarchicalThemeSource, BeanClassLoaderAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.Aware, org.springframework.ui.context.HierarchicalThemeSource, org.springframework.ui.context.ThemeSource
Annotations
@Deprecated
since:6.0
Imports
java.util.Map, java.util.concurrent.ConcurrentHashMap, org.apache.commons.logging.Log, .LogFactory, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.context.HierarchicalMessageSource, .MessageSource, org.springframework.context.support.ResourceBundleMessageSource, org.springframework.lang.Nullable, org.springframework.ui.context.HierarchicalThemeSource, .Theme, .ThemeSource

Deprecated

since 6.0.

as of 6.0 in favor of using CSS, without direct replacement

ThemeSource implementation that looks up an individual java.util.ResourceBundle per theme. The theme name gets interpreted as ResourceBundle basename, supporting a common basename prefix for all themes.
Authors
Jean-Pierre Pawlak, Juergen Hoeller
See Also
setBasenamePrefix, java.util.ResourceBundle, org.springframework.context.support.ResourceBundleMessageSource

Field Summary

Modifier and TypeField and Description
private String
private ClassLoader
private String
private Boolean
protected final Log
private ThemeSource
parentThemeSource

References Deprecated ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.
private final Map<String, Theme>
themeCache

Map from theme name to Theme instance.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected MessageSource

Returns:

the MessageSource
createMessageSource
(String
the basename to create a MessageSource for
basename
)

Create a MessageSource for the given basename, to be used as MessageSource for the corresponding theme.

public ThemeSource
getParentThemeSource()

Implements org.springframework.ui.context.HierarchicalThemeSource.getParentThemeSource.

References Deprecated ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.

Return the parent of this ThemeSource, or null if none.

public Theme
getTheme(String
the name of the theme
themeName
)

Implements org.springframework.ui.context.ThemeSource.getTheme.

References Deprecated Theme is deprecated or references (maybe indirectly) at least one deprecated element.

This implementation returns a SimpleTheme instance, holding a ResourceBundle-based MessageSource whose basename corresponds to the given theme name (prefixed by the configured "basenamePrefix").

protected void
initParent(Theme
the Theme to (re-)initialize
theme
)
References Deprecated Theme is deprecated or references (maybe indirectly) at least one deprecated element.

Initialize the MessageSource of the given theme with the one from the corresponding parent of this ThemeSource.

public void
setBasenamePrefix(String basenamePrefix)

Set the prefix that gets applied to the ResourceBundle basenames, i.e. the theme names.

public void
setBeanClassLoader(ClassLoader
the owning class loader
beanClassLoader
)

Implements org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Callback that supplies the bean class loader to a bean instance.

public void
setDefaultEncoding(String defaultEncoding)

Set the default charset to use for parsing resource bundle files.

public void
setFallbackToSystemLocale(boolean fallbackToSystemLocale)

Set whether to fall back to the system Locale if no files for a specific Locale have been found.

public void
setParentThemeSource(ThemeSource
the parent ThemeSource that will be used to resolve messages that this object can't resolve. May be null, in which case no further resolution is possible.
parent
)

Implements org.springframework.ui.context.HierarchicalThemeSource.setParentThemeSource.

References Deprecated ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.

Set the parent that will be used to try to resolve theme messages that this object can't resolve.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

basenamePrefixback to summary
private String basenamePrefix
beanClassLoaderback to summary
private ClassLoader beanClassLoader
Annotations
@Nullable
defaultEncodingback to summary
private String defaultEncoding
Annotations
@Nullable
fallbackToSystemLocaleback to summary
private Boolean fallbackToSystemLocale
Annotations
@Nullable
loggerback to summary
protected final Log logger
parentThemeSourceback to summary
private ThemeSource parentThemeSource

References Deprecated

ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@Nullable
themeCacheback to summary
private final Map<String, Theme> themeCache

Map from theme name to Theme instance.

Constructor Detail

ResourceBundleThemeSourceback to summary
public ResourceBundleThemeSource()

Method Detail

createMessageSourceback to summary
protected MessageSource createMessageSource(String basename)

Create a MessageSource for the given basename, to be used as MessageSource for the corresponding theme.

Default implementation creates a ResourceBundleMessageSource. for the given basename. A subclass could create a specifically configured ReloadableResourceBundleMessageSource, for example.

Parameters
basename:String

the basename to create a MessageSource for

Returns:MessageSource

the MessageSource

See Also
org.springframework.context.support.ResourceBundleMessageSource, org.springframework.context.support.ReloadableResourceBundleMessageSource
getParentThemeSourceback to summary
public ThemeSource getParentThemeSource()

Implements org.springframework.ui.context.HierarchicalThemeSource.getParentThemeSource.

Doc from org.springframework.ui.context.HierarchicalThemeSource.getParentThemeSource.

References Deprecated

ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Return the parent of this ThemeSource, or null if none.

Annotations
@Override
@Nullable
getThemeback to summary
public Theme getTheme(String themeName)

Implements org.springframework.ui.context.ThemeSource.getTheme.

References Deprecated

Theme is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

This implementation returns a SimpleTheme instance, holding a ResourceBundle-based MessageSource whose basename corresponds to the given theme name (prefixed by the configured "basenamePrefix").

SimpleTheme instances are cached per theme name. Use a reloadable MessageSource if themes should reflect changes to the underlying files.

Parameters
themeName:String

Doc from org.springframework.ui.context.ThemeSource.getTheme.

the name of the theme

Returns:Theme

Doc from org.springframework.ui.context.ThemeSource.getTheme.

the corresponding Theme, or null if none defined. Note that, by convention, a ThemeSource should at least be able to return a default Theme for the default theme name "theme" but may also return default Themes for other theme names.

Annotations
@Override
@Nullable
See Also
setBasenamePrefix, createMessageSource
initParentback to summary
protected void initParent(Theme theme)

References Deprecated

Theme is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Initialize the MessageSource of the given theme with the one from the corresponding parent of this ThemeSource.

Parameters
theme:Theme

the Theme to (re-)initialize

setBasenamePrefixback to summary
public void setBasenamePrefix(String basenamePrefix)

Set the prefix that gets applied to the ResourceBundle basenames, i.e. the theme names. E.g.: basenamePrefix="test.", themeName="theme" → basename="test.theme".

Note that ResourceBundle names are effectively classpath locations: As a consequence, the JDK's standard ResourceBundle treats dots as package separators. This means that "test.theme" is effectively equivalent to "test/theme", just like it is for programmatic java.util.ResourceBundle usage.

See Also
java.util.ResourceBundle#getBundle(String)
setBeanClassLoaderback to summary
public void setBeanClassLoader(ClassLoader beanClassLoader)

Implements org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Doc from org.springframework.beans.factory.BeanClassLoaderAware.setBeanClassLoader.

Callback that supplies the bean class loader to a bean instance.

Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean's InitializingBean#afterPropertiesSet() method or a custom init-method.

Parameters
beanClassLoader:ClassLoader

the owning class loader

Annotations
@Override
setDefaultEncodingback to summary
public void setDefaultEncoding(String defaultEncoding)

Set the default charset to use for parsing resource bundle files.

ResourceBundleMessageSource's default is the java.util.ResourceBundle default encoding: ISO-8859-1.

Since
4.2
See Also
ResourceBundleMessageSource#setDefaultEncoding
setFallbackToSystemLocaleback to summary
public void setFallbackToSystemLocale(boolean fallbackToSystemLocale)

Set whether to fall back to the system Locale if no files for a specific Locale have been found.

ResourceBundleMessageSource's default is "true".

Since
4.2
See Also
ResourceBundleMessageSource#setFallbackToSystemLocale
setParentThemeSourceback to summary
public void setParentThemeSource(ThemeSource parent)

Implements org.springframework.ui.context.HierarchicalThemeSource.setParentThemeSource.

Doc from org.springframework.ui.context.HierarchicalThemeSource.setParentThemeSource.

References Deprecated

ThemeSource is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Set the parent that will be used to try to resolve theme messages that this object can't resolve.

Parameters
parent:ThemeSource

the parent ThemeSource that will be used to resolve messages that this object can't resolve. May be null, in which case no further resolution is possible.

Annotations
@Override