com.sun.portal.providers.context
Class Theme

java.lang.Object
  |
  +--com.sun.portal.providers.context.Theme

public class Theme
extends Object

A Theme is a collection of visual elements to be used when displaying a desktop. For example, channel background color, font face etc. Theme is a global setting (independent of channels) which a user can select from a preset list or customizing to his/her perference. The global preset list of themes is configured by the administrator and it cannot be changed using this API. The custom theme is the theme that each user can manipulate according to his/her perference. The constant CUSTOM_THEME defined in this class is to refer to the custom theme.

Themes are stored as properties accessed through ProviderContext . This class serves as a wrapper over ProviderContext to encapsulate the implementation details of theme.

For details of the theme design and steps to configure the global preset themes, please refer to the Desktop Customization Guide and the Administrator's Guide.

See Also:
ProviderContext

Field Summary
static String CUSTOM_THEME
          Constant refering to the custom theme.
 
Constructor Summary
Theme()
           
 
Method Summary
static String getAttribute(String channel, ProviderContext pc, String name)
          Gets an attribute value of the selected theme.
static String getAttribute(String channel, ProviderContext pc, String theme, String name)
          Gets an attribute value of a theme.
static Collection getGlobal(String channel, ProviderContext pc)
          Gets the global list of preset theme that is available.
static Map getMap(String channel, ProviderContext pc, String theme)
          Gets the attributes of a theme as a map.
static String getSelectedName(String channel, ProviderContext pc)
          Gets the theme name to be used for displaying desktop.
static void setCustomAttribute(String channel, ProviderContext pc, String name, String value)
          Sets an attribute value of the custom theme.
static void setSelectedName(String channel, ProviderContext pc, String name)
          Sets the theme to be used for displaying desktop.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CUSTOM_THEME

public static final String CUSTOM_THEME
Constant refering to the custom theme.
Constructor Detail

Theme

public Theme()
Method Detail

getSelectedName

public static String getSelectedName(String channel,
                                     ProviderContext pc)
                              throws ProviderContextException
Gets the theme name to be used for displaying desktop. The theme can be one from the global preset theme list or CUSTOM_THEME for the custom built theme.
Parameters:
ProviderContext -  
Returns:
the name of the selected theme name as a String.
Throws:
ProviderContextException - if an error occurs in getting the selected theme name.

getGlobal

public static Collection getGlobal(String channel,
                                   ProviderContext pc)
                            throws ProviderContextException
Gets the global list of preset theme that is available. The list is configured by Portal admin. The list as well as the attributes in those preset themes cannot be changed using this API.
Parameters:
ProviderContext -  
Returns:
the list of globally defined preset theme as a collection.
Throws:
ProviderContextException - if an error occurs in getting the global theme names.

getMap

public static Map getMap(String channel,
                         ProviderContext pc,
                         String theme)
                  throws ProviderContextException
Gets the attributes of a theme as a map. The returned map has the attribute names as the keys and the theme values as the values.
Parameters:
ProviderContext -  
theme - Theme name, either one from the preset list or CUSTOM_THEME for the custom theme.
Returns:
The map that maps attribute names to attribute values of the theme.
Throws:
ProviderContextException - if an error occurs in getting the attributes of the theme.

getAttribute

public static String getAttribute(String channel,
                                  ProviderContext pc,
                                  String theme,
                                  String name)
                           throws ProviderContextException
Gets an attribute value of a theme.
Parameters:
ProviderContext -  
theme - Theme name, either one from the preset list or CUSTOM_THEME for the custom theme.
name - Attribute name
Returns:
the attribute value as a String.
Throws:
ProviderContextException - if an error occurs getting the attribute, or the theme is not CUSTOM_THEME or one in the preset list.

getAttribute

public static String getAttribute(String channel,
                                  ProviderContext pc,
                                  String name)
                           throws ProviderContextException
Gets an attribute value of the selected theme.
Parameters:
ProviderContext -  
name - Attribute name
Returns:
the attribute value as a String
Throws:
ProviderContextException - if an error occurs getting the attribute.

setCustomAttribute

public static void setCustomAttribute(String channel,
                                      ProviderContext pc,
                                      String name,
                                      String value)
Sets an attribute value of the custom theme. This sets a value for the theme named CUSTOM_THEME
Parameters:
ProviderContext -  
name - Attribute name
value - Attribute value

setSelectedName

public static void setSelectedName(String channel,
                                   ProviderContext pc,
                                   String name)
                            throws ProviderContextException
Sets the theme to be used for displaying desktop.
Parameters:
ProviderContext -  
name - Theme name, either one from the preset list or CUSTOM_THEME for the custom theme.
Throws:
ProviderContextException - if an error occurs in setting the selected theme name.