The desktop-config Element

It is used to customize how ZK handles desktops. You might have multiple desktop-config elements in one zk.xml.

<desktop-config>
    <desktop-timeout>3600</desktop-timeout>    
    <disable-theme-uri>~./zul/css/norm*.css.dsp*</disable-theme-uri>    
    <file-check-period>5</file-check-period>    
    <theme-uri>/my/blue**.css</theme-uri>    
    <theme-provider-class>my.MyThemeProvider</theme-provider-class>    
</desktop-config>

The desktop-timeout Element

[Default: 3600]

It specifies the time, in seconds, between client requests before a desktop is invalidated. A negative time indicates the desktop should never timeout.

The disable-theme-uri Element

[Default: none]

It specifies what theme URI to be disabled. The theme URI shall be one of the default theme URI. For example, the following statement disables the generation of the default theme URI for the ZK XUL component set.

<desktop-config>
    <disable-theme-uri>~./zul/css/norm*.css.dsp*</disable-theme-uri>    
</desktop-config>

It is usually used with the theme-uri element to replace the default theme. Refer to the Themes section of the Internationalization chapter in the Developer's Guide for details.

The file-check-period Element

[Default: 5]

It specifies the time, in seconds, to wait before checking whether a file is modified.

For better performance, ZK has employed a cache to store parsed ZUML file. The time specified here controls how often ZK checks whether a file is modified. The larger the number the better the performance.

The theme-uri Element

[Default: none]

It specifies the URI of an addition theme (aka., a style sheet file).

Like other URI, it accepts "*" for loading browser and Locale dependent style sheet. Refer to the Browser and Locale Dependent URI section in the Internationalization chapter for details.

You can specify any number of them-uri as follows.

<desktop-config>
    <theme-uri>/my/blue**.css</theme-uri>    
    <theme-uri>/my/second.css</theme-uri>    
</desktop-config>

If you want to replace a default theme, you have to use theme-uri with disable-theme-uri. Refer to the Themes section of the Internationalization chapter in the Developer's Guide for details.

Notice:

  1. All style sheets defined in lang.xml and lang-addon.xml are loaded, no matter this parameter is defined or not. It is convenient for developers to override certain styles.

  2. Each JAR could specify a lang-addon.xml file (under the metainfo/zk directory), so you could specify style sheets there if you have more than one style sheets.

  3. You could specify extra CSS files for individual ZUML pages by use of the style component. Refer to the ZUML with the XUL Component Set chapter.

The theme-provider-class Element

[Default: none]

It specifies the class to provide the theme (aka., a style sheet file) URI dynamically. If you want to determine the theme based on the current user, cookie or locale. You can implement a class with the org.zkoss.zk.ui.util.ThemeProvider interface, and specify it with the theme-provider-class element. Then, an instance of the class will be created, and it is called each time a desktop is rendered to the client to determine the theme URI.

Notice that the theme provider is called with all theme URIs that shall be generated (including what are specified in theme-uri and excluding what are specified in disable-theme-uri). And, only the return collection of URIs are actually generated. In other words, the theme provider has the highest priority.