public class StandardThemeProvider extends java.lang.Object implements ThemeProvider
ThemeProvider.Aide
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_WCS
Default theme css file
|
Constructor and Description |
---|
StandardThemeProvider() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
beforeWCS(Execution exec,
java.lang.String uri)
Called when a WCS (Widget CSS descriptor) file is about to be loaded.
|
java.lang.String |
beforeWidgetCSS(Execution exec,
java.lang.String uri)
Called when a WCS (Widget CSS descriptor) file is about to load the CSS file associated
with a widget.
|
protected static java.lang.String |
getThemeFileSuffix() |
java.util.Collection<java.lang.Object> |
getThemeURIs(Execution exec,
java.util.List<java.lang.Object> uris)
Returns a list of the theme's URIs of the specified execution,
or null if no theme shall be generated.
|
int |
getWCSCacheControl(Execution exec,
java.lang.String uri)
Returns the number of hours that the specified WCS
(Widget CSS descriptor) file won't be changed.
|
public static final java.lang.String DEFAULT_WCS
protected static java.lang.String getThemeFileSuffix()
public java.util.Collection<java.lang.Object> getThemeURIs(Execution exec, java.util.List<java.lang.Object> uris)
ThemeProvider
String
or StyleSheet
.
If you want to specify the media
attribute, use StyleSheet
.
It is called when a desktop is about to be rendered. It is called only once for each desktop.
Notice that StyleSheet
is allowed since 5.0.3.
getThemeURIs
in interface ThemeProvider
exec
- the current execution (never null), where you can retrieve
the desktop, request and response.
Note: if your Web application supports multiple devices, you have
to check Desktop.getDevice()
.uris
- the default set of theme's URIs,
i.e., the themes defined in language definitions (lang.xml and lang-addon.xml)
and the configuration (the theme-uri
elements in web.xml).
Each URI is an instance of of either String
or StyleSheet
.
Notice that, unless it is customized by application specific lang-addon,
all URIs are, by default, String instances.String
or StyleSheet
.public int getWCSCacheControl(Execution exec, java.lang.String uri)
ThemeProvider
getWCSCacheControl
in interface ThemeProvider
uri
- the URI of the WCS file, e.g., ~./zul/css/zk.wcspublic java.lang.String beforeWCS(Execution exec, java.lang.String uri)
ThemeProvider
uri
parameter.
If you want to change the font size, you can set the attributes of the execution accordingly as follows.
For example,
String beforeWCS(Execution exec, String uri) {
exec.setAttribute("fontSizeM", "15px");
return uri;
}
beforeWCS
in interface ThemeProvider
exec
- the current execution (never null), where you can retrieve
the request and response. However, unlike
ThemeProvider.getThemeURIs(org.zkoss.zk.ui.Execution, java.util.List<java.lang.Object>)
, the desktop might not be available when this
method is called.uri
- the URI of the WCS file, e.g., ~./zul/css/zk.wcspublic java.lang.String beforeWidgetCSS(Execution exec, java.lang.String uri)
ThemeProvider
uri
parameter.
This method is usually overridden to load the CSS files from a different directory. For example,
String beforeWidgetCSS(Execution exec, String uri) {
return uri.startsWith("~./") ? "~./foo/" + uri.substring(3): uri;
}
beforeWidgetCSS
in interface ThemeProvider
exec
- the current execution (never null), where you can retrieve
the request ad response. However, unlike
ThemeProvider.getThemeURIs(org.zkoss.zk.ui.Execution, java.util.List<java.lang.Object>)
, the desktop might not be available when this
method is called.uri
- the URI of the CSS file associated with a widget, e.g.,
~./js/zul/wgt/css/a.css.dspCopyright © 2005-2018 Potix Corporation. All Rights Reserved.