|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.rave.web.ui.theme.Theme
public class Theme
The Theme class is responsible for managing application resources such as style sheets, JavaScript files and message files.
Theme resources are delived in the form of Jar files which are
placed in the classpath of the application or of the Servlet
container. Themes must include a file called
META-INF/swc_theme.properties
which describe the
resources available to the theme.
To configure the default Theme to be used by an application,
ensure that the theme jar is the application's classpath and
configure the application's deployment descriptor to set the
context parameter com.sun.rave.web.ui.DEFAULT_THEME
to the
Theme's name.
If you need to add additional locale support, you have two options:
com.sun.rave.web.ui.MESSAGES
. The themes will
attempt to retrieve messages from the bundle(s) of this basename
first. If the message key does not resolve, the Theme's default
bundles are used instead.
Field Summary | |
---|---|
static java.lang.String |
RESOURCE_PATH_ATTR
The context parameter name used to specify a console path, if one is used. |
static java.lang.String |
THEME_ATTR
Attribute name used to store the user's theme name in the Session |
Constructor Summary | |
---|---|
Theme(java.util.Locale locale)
|
Method Summary | |
---|---|
protected void |
configureClassMapper(java.util.ResourceBundle classMapper)
Configures a resource bundle which overrides the standard keys for retrieving style class names. |
protected void |
configureImages(java.util.ResourceBundle imageResources)
Configures the image resource bundle. |
protected void |
configureJSFiles(java.util.ResourceBundle jsFiles)
Configures the JS resource files. |
protected void |
configureMessages(java.util.ResourceBundle base,
java.util.ResourceBundle override)
Configures the message bundles. |
protected void |
configureStylesheets(java.util.ResourceBundle stylesheets)
Configures the stylesheets. |
java.lang.String[] |
getGlobalJSFiles()
Use this method to retrieve a String array of URIs to the JavaScript files that should be included with all pages of this application |
java.lang.String[] |
getGlobalStylesheets()
Use this method to retrieve a String array of URIs to the CSS stylesheets files that should be included with all pages of this application |
Icon |
getIcon(java.lang.String identifier)
|
java.lang.String |
getMessage(java.lang.String key)
Retrieves a message from the appropriate ResourceBundle. |
java.lang.String |
getMessage(java.lang.String key,
java.lang.Object[] params)
Retrieves a message from the appropriate ResourceBundle. |
java.lang.String |
getPathToJSFile(java.lang.String key)
Returns a String that represents a valid path to the JavaScript file corresponding to the key |
java.lang.String |
getPathToMasterStylesheet()
Returns a String that represents a valid path to the CSS stylesheet corresponding to the key |
java.lang.String |
getPathToStylesheet(javax.faces.context.FacesContext context)
Returns a String that represents a valid path to the CSS stylesheet corresponding to the key |
java.lang.String |
getPathToStylesheet(java.lang.String clientName)
Returns a String that represents a valid path to the CSS stylesheet corresponding to the key |
java.lang.String |
getStyleClass(java.lang.String name)
Returns the name of a CSS style. |
void |
initializePath(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request)
|
protected void |
setPrefix(java.lang.String p)
Sets the prefix to be prepended to the path names of the resources |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String THEME_ATTR
public static final java.lang.String RESOURCE_PATH_ATTR
Constructor Detail |
---|
public Theme(java.util.Locale locale)
Method Detail |
---|
public java.lang.String[] getGlobalJSFiles()
public java.lang.String[] getGlobalStylesheets()
public java.lang.String getPathToJSFile(java.lang.String key)
key
- Key to retrieve the javascript file
public java.lang.String getPathToStylesheet(javax.faces.context.FacesContext context)
context
- FacesContext of the request
public java.lang.String getPathToMasterStylesheet()
public java.lang.String getPathToStylesheet(java.lang.String clientName)
public java.lang.String getStyleClass(java.lang.String name)
name
- The style class name to be used
public java.lang.String getMessage(java.lang.String key)
key
- The key used to retrieve the message
public java.lang.String getMessage(java.lang.String key, java.lang.Object[] params)
key
- The key used to retrieve the messageparams
- An object array specifying the parameters of
the message
protected void setPrefix(java.lang.String p)
p
- prefix for all URIs in the themeprotected void configureClassMapper(java.util.ResourceBundle classMapper)
classMapper
- A ResourceBundle that overrides the standard style
class keysprotected void configureMessages(java.util.ResourceBundle base, java.util.ResourceBundle override)
Configures the message bundles. All Themes must contain a default ResourceBundle for messages, which is configured in the Theme configuration file. This bundle is passed in as the first parameter (base).
Optionally, the web application developer can override the messages from all themes by specifying a resource bundle in a context init parameter (if they haven't done so, the second parameter will be null). If the second parameter is non-null, Theme.getMessage tries to get the message from the override bundle first. If that fails (or if there is no override bundle), getMessage() tries the base bundle.
base
- The message bundle specified by the Theme
configuration file.override
- A message bundle configured by the user
in a context parameter, to override messages from the base bundle.protected void configureImages(java.util.ResourceBundle imageResources)
Configures the image resource bundle.
imageResources
- A ResourceBundle whose keys specify
the available images.protected void configureJSFiles(java.util.ResourceBundle jsFiles)
Configures the JS resource files.
jsFiles
- A ResourceBundle whose keys specify the available
JavaScript filesprotected void configureStylesheets(java.util.ResourceBundle stylesheets)
Configures the stylesheets.
stylesheets
- A resource bundle specifying the stylesheet for
each @link ClientTypepublic void initializePath(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request)
public Icon getIcon(java.lang.String identifier)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |