New Features of ZK 5.0.7"

From Documentation
Line 54: Line 54:
 
For more information please see [[ZK Developer's Reference/Internationalization/Labels#Loading Labels from Multiple Resources | ZK's Developer's Reference]].
 
For more information please see [[ZK Developer's Reference/Internationalization/Labels#Loading Labels from Multiple Resources | ZK's Developer's Reference]].
  
==Datebox/timebox allows different formats and locales==
+
==Datebox/timebox allows different styles and locales==
 +
 
 +
[[ZK Component Reference/Input/Datebox|Datebox]] and [[ZK Component Reference/Input/Timebox|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 (<javadoc method="setFormat(java.lang.String)">org.zkoss.zul.Datebox</javadoc> and <javadoc method="setFormat(java.lang.String)">org.zkoss.zul.Timebox</javadoc>). 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,
 +
 
 +
<source lang="xml">
 +
<datebox format="short"/>
 +
<datebox format="long"/>
 +
<timebox format="medium"/>
 +
</source>
 +
 
 +
Then, the real format will be decided by your implementation of <javadoc type="interface">org.zkoss.text.DateFormatInfo</javadoc>, if any, or the JVM's default.
 +
 
 +
In additions, you could specify the date/time format in the syntax of <code>styling_for_date+styling_for_time</code>, such as:
 +
 
 +
<source lang="xml">
 +
<datebox format="long+medium"/>
 +
</source>
 +
 
 +
which specifies the date/time format with the long styling for date and the medium styling for time.
 +
 
 +
=== Per-component Locale ===
 +
 
 +
In additions to [[ZK Developer's Reference/Internationalization/Locale|the current locale]], you could specify the locale for individual instances of datebox and timebox. Then, the real format will depend on the locale and the format you specified. For example,
 +
 
 +
<source lang="xml">
 +
<datebox format="medium" locale="de"/>
 +
<timebox format="long" locale="fr"/>
 +
</source>
  
 
==Enhanced Tree sorting==
 
==Enhanced Tree sorting==

Revision as of 01:44, 10 May 2011

DocumentationSmall Talks2011MayNew Features of ZK 5.0.7
New Features of ZK 5.0.7

Author
Timothy Clare, Technology Evangelist, Potix Corporation
Date
May 11, 2011
Version
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="${labels.app.title}">
...
</window>

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 aa.bb.cc (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,

<system-config>
    <label-location>/WEB-INF/labels/order.properties</label-location>
    <label-location>/WEB-INF/labels/invoice.properties</label-location>
</system-config>

Once you specify label-location, the default loading of /WEB-INF/i3-labels.properties 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/i3-labels.properties 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/labels.properties. If the target environment is Windows, you are able to specify the drive too, such as file://C:/myapp/foo.properties. The advantage is that additional property files can be added after the project has been built into a WAR file.

<system-config>
    <label-location>file:///labels/order.properties</label-location>
    <label-location>file:///labels/invoice.properties</label-location>
</system-config>

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"/>

Then, the real format will be decided by your implementation of DateFormatInfo, if any, or the JVM's default.

In additions, you could specify the date/time format in the syntax of styling_for_date+styling_for_time, such as:

<datebox format="long+medium"/>

which specifies the date/time format with the long styling for date and the medium styling for time.

Per-component Locale

In additions to the current locale, you could specify the locale for individual instances of datebox and timebox. Then, the real format will depend on the locale and the format you specified. For example,

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

Enhanced Tree sorting

Listbox sorts model based on the current state

Listbox supports Listgroup selection

Developer can now specify an empty message for Grid/Listbox

Specify another zk.xml

Not serializable and ignored objects now logged

Client-side smartUpdate now disabled by default

Menuitem supports auto disable

Comments



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