|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Theme
The Theme
interface defines a set of methods that
return resources that define a theme; for example a set of name value
pairs defined in properties files representing strings and data,
such as messages, image, CSS style sheet and JavaScript file paths.
These resources are collectively known as a "Theme" and are typically
bundled together in a Jar file. Themes based on the same set of name
value pairs should be swappable allowing an application to switch
from one Theme to another.
Themes may consist of resources that are used directly
by the Java classes at runtime (for example ResourceBundles
and Properties
files)
and resources that are requested by the application users' browser
(for example image files). In order to make Theme resources available
over HTTP, you can configure the ThemeServlet
in the Web UI web application on the server.
For more information on how to configure a Web UI web application
w.r.t. Themes, see the documentation for see
ThemeServlet
.
A Theme
implementation instance is used to obtain
the resources defined by a concrete Theme, like the "suntheme".
A Theme
instance is obtained from a ThemeFactory
implementation. A web application can define the the
class that should
be used by Web UI components to obtain a ThemeFactory
Theme
instance.
Typically implementations will provide support for Locale
variants for all resources that it provides, as appropriate.
Field Summary | |
---|---|
static java.lang.String |
THEME_ATTR
Deprecated. |
Method Summary | |
---|---|
java.lang.String[] |
getGlobalJSFiles()
Returns a String array of URIs to the JavaScript files to be included in every application page. |
java.lang.String[] |
getGlobalStylesheets()
Returns a String array of URIs to the CSS style sheet files to be included in every application page. |
com.sun.webui.theme.ThemeImage |
getImage(java.lang.String key)
Return a
instance for an image identified by key . |
java.lang.String |
getImagePath(java.lang.String key)
Return a String URI that can be used to access the physical image resource. |
java.lang.String |
getImageString(java.lang.String key)
Returns the literal String value of the key image
theme property. |
java.lang.String |
getJSString(java.lang.String key)
Returns the literal String value of the key JavaScript
theme property. |
java.lang.String[] |
getMasterStylesheets()
Returns a String array of URIs to the CSS style sheet files to be included in every application page. |
java.lang.String |
getMessage(java.lang.String key)
Returns a literal message value defined by key . |
java.lang.String |
getMessage(java.lang.String key,
java.lang.Object[] params)
Return a message that has been formatted using MessageFormat to substitute params
for placeholders in the literal value of key . |
boolean |
getMessageBoolean(java.lang.String key,
boolean defaultValue)
Return a boolean value for key . |
int |
getMessageInt(java.lang.String key,
int defaultValue)
Return an int value for key . |
java.lang.String |
getPathToJSFile(java.lang.String key)
Returns a String URI to a JavaScript file defined by key . |
java.lang.String |
getPathToTemplate(java.lang.String key)
Returns a String URI that represents a path to the HTML template defined by key . |
java.lang.String |
getStyleClass(java.lang.String key)
Returns a CSS selector defined by key ,
unless key does not exist, in which case key
is returned. |
java.lang.String[] |
getStylesheets(java.lang.String key)
Returns a String array of URIs to the CSS style sheet files to be included in every application page, defined by key . |
Field Detail |
---|
static final java.lang.String THEME_ATTR
Method Detail |
---|
java.lang.String[] getGlobalJSFiles()
Note that an implementation may return a value that is not the literal value defined in a theme resource bundle. For example an implementation may return the literal value prepended with a web application context.
null
.java.lang.String getPathToJSFile(java.lang.String key)
key
.
Note that an implementation may return a value that is not the literal value defined in a theme resource bundle. For example an implementation may return the literal value prepended with a web application context.
key
- Defines a JavaScript file path.
null
.java.lang.String getJSString(java.lang.String key)
key
JavaScript
theme property.
key
- Defines a JavaScript theme property.
key
or null
.java.lang.String[] getMasterStylesheets()
The implicatation of a Master
style sheet is that
these style sheets should be loaded first, before any other
style sheets.
Note that an implementation may return a value that is not the literal value defined in a theme resource bundle. For example an implementation may return the literal value prepended with a web application context.
java.lang.String[] getGlobalStylesheets()
Note that an implementation may return a value that is not the literal value defined in a theme resource bundle. For example an implementation may return the literal value prepended with a web application context.
java.lang.String[] getStylesheets(java.lang.String key)
key
.
Note that these style sheets should be loaded after the
Master
and Global
style sheets.
Note that an implementation may return a value that is not the literal value defined in a theme resource bundle. For example an implementation may return the literal value prepended with a web application context.
key
- Defines a style sheet file path.
null
.java.lang.String getPathToTemplate(java.lang.String key)
key
.
Note that an implementation may return a value that is not
the literal value defined in a theme resource bundle. For
example an implementation may return the literal value prepended
with a web application context.
key
- Defines an HTML template file path.
key
.java.lang.String getStyleClass(java.lang.String key)
key
,
unless key
does not exist, in which case key
is returned.
key
- Defines a CSS selector.
key
.java.lang.String getMessage(java.lang.String key)
key
.
key
- Defines a theme message or string.
java.lang.String getMessage(java.lang.String key, java.lang.Object[] params)
MessageFormat
to substitute params
for placeholders in the literal value of key
.
key
- Defines a theme message or string.params
- Substitution parameters suitable for use by a
MessageFormat.format
call.
boolean getMessageBoolean(java.lang.String key, boolean defaultValue)
boolean
value for key
.
If key
is not defined, return defaultValue
.
If defaultValue
is null
and key
is not defined RuntimeException
is thrown.
key
- Defines a boolean value.defaultValue
- The value to return if key
is not
defined.
key
int getMessageInt(java.lang.String key, int defaultValue)
int
value for key
.
If key
is not defined, return defaultValue
.
key
- Defines an int
value.defaultValue
- The value to return if key
is not
defined.
int
value for key
java.lang.String getImagePath(java.lang.String key)
For example an implementation used by a web application
might prepend a servlet context path suitable for delivery by
ThemeServlet
key
- Defines an image path
java.lang.RuntimeException
- if key
cannot be found.com.sun.webui.theme.ThemeImage getImage(java.lang.String key)
ThemeImage
instance for an image identified by key
.
key
- Defines an image resource.
ThemeImage
or null if
key
cannot be found.
java.lang.String getImageString(java.lang.String key)
key
image
theme property.
key
- Defines an image resource.
key
.
java.lang.RuntimeException
- if key
cannot be found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |