New Features of ZK 5.0.7

From Documentation
DocumentationSmall Talks2011MayNew Features of ZK 5.0.7
New Features of ZK 5.0.7

Timothy Clare, Technology Evangelist, Potix Corporation
May 11, 2011
ZK 5.0.7

ZK 5.0.7 is a maintenance release focusing on fixing bugs and releasing new improved features for ZK components.

iPad improvements

ZK 5.0.7 brings with it improved support for the iPad's browser now supporting drag & drop functionality and the iPad's double click event on a widget by widget basis.

i18n improvements

ZK 5.0.7 has introduced two improvements, an easy way to access i18n labels from EL and an easier way to specify multiple property files for i18n labels.

Access i18n labels from EL

In ZK 5.0.7, an implicit object called labels has been introduced, enabling developers direct access to internationalization labels. For example, assume you have a label named app.title, you can access it as follows:

<window title="${}">

The labels object is a map (java.util.Map), so you can access the label directly by using labels.whatever in an EL expression. Moreover, as shown above, you can access the label even if a key is named as (a string containing dot), such as app.title in the above example.

For more information please see ZK's Developer's Reference.

Specify multiple property files for i18n labels

Developers can now specify the location of each property file with the label-location element. For example,


Once you specify label-location, the default loading of /WEB-INF/ won't take place. In other words, only the properties files specified in the label-location elements are loaded. Thus, if you'd like to load /WEB-INF/ too, you have to add it to label-location with others.

In addition to the servlet path, you can specify a file path by starting with file://. For example, file://foo/ If the target environment is Windows, you are able to specify the drive too, such as file://C:/myapp/ The advantage is that additional property files can be added after the project has been built into a WAR file.


For more information please see ZK's Developer's Reference.

Datebox/timebox allows different styles and locales

Datebox and Timebox allow a developer to specify any date/time format regardless of the locale. ZK 5.0.7 gives developers the ability to format dateboxes and timeboxes using a style rather than the real format in the format property (Datebox.setFormat(String) and Timebox.setFormat(String)). There are four different styling: short, medium, long and full (representing the styling defined in java.text.DateFormat, SHORT, MEDIUM, LONG and FULL). For example,

<datebox format="short"/>
<datebox format="long"/>
<timebox format="medium"/>

The real format will then be decided by your implementation of DateFormatInfo, or the JVM's default if one is not specified.

In addition, you can specify the date/time format in the syntax of styling_for_date+styling_for_time which enables developers to specify different styling for date and times.

<datebox format="long+medium"/>

For more information please see ZK's Developer Reference.

Per-component Locale

In addition to the current locale, you can specify the locale for individual instances of datebox and timebox. The format will then depend on the locale and the format you specified. For example,

<datebox format="medium" locale="de"/>
<timebox format="long" locale="fr"/>

For more information please see ZK's Developer Reference.

Enhanced Tree sorting

The Tree component has been enhanced and now maintains it's open and selected state when sorted. In addition to this a new custom attribute has been introduced named autosort which enables developers to set whether to sort the model when the following cases occur:

For more information please the ZK Component Reference

Listbox sorts model based on the current state

Listbox supports Listgroup selection

The Listbox has been updated enabling section of Group elements. This gives developers more options when creating their applications.


Developer can now specify an empty message for Grid/Listbox

Using ZK 5.0.7 developers can now show a message in listboxes and Grids when they have no items. To do this the emptyMessage attribute should be set. For example:

		<listbox id="test1" emptyMessage="No items match your search">
			<listhead sizable="true">
				<listheader label="Type" width="520px" />
				<listheader label="Content" hflex="min" />
				<listheader label="Content" hflex="1" />

Specify another zk.xml

Not serializable and ignored objects now logged

If an attribute or a listener is not serializable, ZK will skip it. It is hard to know what is ignored, since it is common for a developers to forget to declare a value or a listener as serializable.

ZK 5.0.7 has introduced advanced logging capabilities to detect this problem. Developer's can now enable this logging functionality by consulting how to configure you Web server's configuration or by invoking the following statement in your application:


For more information please consult ZK's Developer Reference.

Client-side smartUpdate now disabled by default

Menuitem supports auto disable


Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.