| java.lang.Object com.sun.rave.web.ui.theme.Theme
Theme | public class Theme (Code) | | 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:
- If your application only uses a single Theme, you can find out
what the message file for the Theme is called and provide a message
file for your locale using the same namebase in the application's
classpath. The usual fallback mechanism will apply.
- If your application uses multiple Themes, you can specify an
alternative message file to be used by all Themes using the context
parameter
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.
|
RESOURCE_PATH_ATTR | final public static String RESOURCE_PATH_ATTR(Code) | | The context parameter name used to specify a console path, if one is used.
|
THEME_ATTR | final public static String THEME_ATTR(Code) | | Attribute name used to store the user's theme name in the Session
|
configureClassMapper | protected void configureClassMapper(ResourceBundle classMapper)(Code) | | Configures a resource bundle which overrides the standard keys for
retrieving style class names.
Parameters: classMapper - A ResourceBundle that overrides the standard styleclass keys |
configureImages | protected void configureImages(ResourceBundle imageResources)(Code) | | Configures the image resource bundle.
Parameters: imageResources - A ResourceBundle whose keys specify the available images. |
configureJSFiles | protected void configureJSFiles(ResourceBundle jsFiles)(Code) | | Configures the JS resource files.
Parameters: jsFiles - A ResourceBundle whose keys specify the available JavaScript files |
configureMessages | protected void configureMessages(ResourceBundle base, ResourceBundle override)(Code) | | 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.
Parameters: base - The message bundle specified by the Theme configuration file. Parameters: override - A message bundle configured by the userin a context parameter, to override messages from the base bundle. |
configureStylesheets | protected void configureStylesheets(ResourceBundle stylesheets)(Code) | | Configures the stylesheets.
Parameters: stylesheets - A resource bundle specifying the stylesheet foreach @link ClientType |
getGlobalJSFiles | public String[] getGlobalJSFiles()(Code) | | Use this method to retrieve a String array of URIs
to the JavaScript files that should be included
with all pages of this application
String array of URIs to the JavaScript files |
getGlobalStylesheets | public String[] getGlobalStylesheets()(Code) | | 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
String array of URIs to the stylesheets |
getMessage | public String getMessage(String key)(Code) | | Retrieves a message from the appropriate ResourceBundle.
If the web application specifies a bundle that overrides
the standard bundle, that one is tried first. If no override
bundle is specified, or if the bundle does not contain the
key, the key is resolved from the Theme's default bundle.
Parameters: key - The key used to retrieve the message A localized message string |
getMessage | public String getMessage(String key, Object[] params)(Code) | | Retrieves a message from the appropriate ResourceBundle.
If the web application specifies a bundle that overrides
the standard bundle, that one is tried first. If no override
bundle is specified, or if the bundle does not contain the
key, the key is resolved from the Theme's default bundle.
Parameters: key - The key used to retrieve the message Parameters: params - An object array specifying the parameters ofthe message A localized message string |
getPathToJSFile | public String getPathToJSFile(String key)(Code) | | Returns a String that represents a valid path to the JavaScript
file corresponding to the key
Returns a String that represents a valid path to the JavaScriptfile corresponding to the key Parameters: key - Key to retrieve the javascript file |
getPathToMasterStylesheet | public String getPathToMasterStylesheet()(Code) | | Returns a String that represents a valid path to the CSS stylesheet
corresponding to the key
A String that represents a valid path to the CSS stylesheetcorresponding to the key |
getPathToStylesheet | public String getPathToStylesheet(FacesContext context)(Code) | | Returns a String that represents a valid path to the CSS stylesheet
corresponding to the key
Parameters: context - FacesContext of the request A String that represents a valid path to the CSS stylesheetcorresponding to the key |
getPathToStylesheet | public String getPathToStylesheet(String clientName)(Code) | | Returns a String that represents a valid path to the CSS stylesheet
corresponding to the key
A String that represents a valid path to the CSS stylesheetcorresponding to the key |
getStyleClass | public String getStyleClass(String name)(Code) | | Returns the name of a CSS style. If the Theme includes a class
mapper, the method checks it for the presence of a mapping for
the CSS class name passed in with the argument. If there
is no mapping, the name is used as is.
up in the class mapper if there is one, a valid path to the CSS stylesheet
corresponding to the key
Parameters: name - The style class name to be used the name of a CSS style. |
setPrefix | protected void setPrefix(String p)(Code) | | Sets the prefix to be prepended to the path names of the resources
Parameters: p - prefix for all URIs in the theme |
|
|