com.sun.rave.web.ui.theme
Class ThemeManager

java.lang.Object
  extended by com.sun.rave.web.ui.theme.ThemeManager

public class ThemeManager
extends java.lang.Object

The ThemeManager manages the locale specific versions of each Theme. The ThemeManager is created by the ThemeConfigurationListener and placed in an application parameter of the same name as the theme itself.

Components do not need to interact with the ThemeManager directly - use com.sun.rave.web.ui.util.ThemeUtilities instead.

To specify a default theme, set it in a context init parameter in the deployment descriptor. Use the parameter name com.sun.rave.web.ui.DefaultTheme.


Field Summary
static java.lang.String THEME_MANAGER
          The context attribute name used to place/retrieve the ThemeManager.
 
Constructor Summary
protected ThemeManager()
          Constructor for the ThemeManager
 
Method Summary
protected  void addThemeMap(java.lang.String name, java.util.Map themeMap)
          This method adds a named Theme to the ThemeManager.
 java.lang.String getDefaultThemeName()
          Use this method to retrieve the name of the default Theme for the locale.
 Theme getTheme(java.lang.String name, java.util.Locale locale)
          Retrieve a Theme instance for a Theme and for a specified locale.
protected  void setDefaultLocale(java.util.Locale defaultLocale)
          Use this method to specify the default locale for the web application
protected  void setDefaultThemeName(java.lang.String name)
          Use this method to specify the default theme for the web application
 java.lang.String toString()
          String representation of this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

THEME_MANAGER

public static final java.lang.String THEME_MANAGER
The context attribute name used to place/retrieve the ThemeManager.

See Also:
Constant Field Values
Constructor Detail

ThemeManager

protected ThemeManager()
Constructor for the ThemeManager

Method Detail

addThemeMap

protected void addThemeMap(java.lang.String name,
                           java.util.Map themeMap)
This method adds a named Theme to the ThemeManager.

Parameters:
name - The name for which this Theme was created
themeMap - The mapObject of themes

getTheme

public Theme getTheme(java.lang.String name,
                      java.util.Locale locale)

Retrieve a Theme instance for a Theme and for a specified locale.

If no Theme instances can be found for the specified name, the method uses the name of the default theme instead. If no default theme has been specified, any available theme name will be used. If none is found, a ThemeConfigurationException is thrown.

If no Theme instance can be found for the locale, the default locale from the faces-config.xml file is used. If no default theme was specified, any theme instance will be used. If no theme instances are found, a ThemeConfigurationException is thrown.

Parameters:
name - The for which this Theme was created
locale - The locale for which the Theme instance is needed
Returns:
The Theme for the locale

setDefaultThemeName

protected void setDefaultThemeName(java.lang.String name)
Use this method to specify the default theme for the web application

Parameters:
name - The name of the default Theme

setDefaultLocale

protected void setDefaultLocale(java.util.Locale defaultLocale)
Use this method to specify the default locale for the web application

Parameters:
defaultLocale - The defaultLocale

getDefaultThemeName

public java.lang.String getDefaultThemeName()
Use this method to retrieve the name of the default Theme for the locale.

Returns:
The default Theme's name

toString

public java.lang.String toString()
String representation of this class

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this class