New Features of ZK 3.0.2

From Documentation
Revision as of 04:16, 20 January 2022 by Hawk (talk | contribs) (correct highlight (via JWB))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
DocumentationSmall Talks2008JanuaryNew Features of ZK 3.0.2
New Features of ZK 3.0.2

Robbie Cheng, Engineer, Potix Corporation
January 22, 2008

ZK 3.0.2 focuses mainly on fixing bugs and improving performance. In addition to over 44 bug fixes, there are 30 new features.

In this release, more components are introduced and enhanced. jasperreports component is supported. ListModel and databind supports combobox. Datebox supports valid range of date. Moreover, the performance of live data of listbox and grid is improved. JpaUtil and OpenEntityManagerInView allow you to integrate with J2EE more easily.

In the following paragraphs, I'll introduce the most exciting new additions to ZK 3.0.2.

Ease of Use

The fulfill Attribute Supports Multiple Events

You could register more than one event in fulfill attribute as follows,

<button label="create" id="xyz"/>
 <combobox id="cbx" fulfill="self.onOpen,xyz.onClick">
  <comboitem label="Simple"/>    
  <comboitem label="Rich"/>

EL-Expression Is Allowed in the use Attribute

It becomes more convenient to use a customized component using EL expression.

<combobox use="${l.value}"/>

A Way to Import Directives from Another Page

There many web resources to include, including CSS definition, taglib, variable-resolver, and xel-method. For easier maintenance, these resources should be included in a singe page, and then those pages which need these resources should import from the page. From now on, you could include resources from another page to avoid redundant inclusion in pages as follows,

<!--Import all-->
<?import src="x.zul" directives="*"?>

<!--Import particular directives -->
<?import src="x.zul" directives="taglib, variable-resolver"?>

Using the forward Directive to Forward to Another Page

Currently, we used to embed codes within zscript to determine whether to forward the user to another page.

if (...)

However, it will more convenient to do forwarding without zero code. Since 3.0.2, you could define the forward condition using forward directive as follows.

<?forward uri="/some/where.zul" if="..."?>

Component Reloaded

New Components

jasperreports Component

jasperreports is an open source Java reporting tool that can write to screen, to a printer or into PDF files. It can be used in Java-enabled applications, including J2EE or Web applications, to generate dynamic content.

For more information, please refer to this small talk.

New Features

Combobox Supports Data-Binding, ListModel, Type-Ahead, and etc.

For ease of use, Combobox supports ListModel and DataBinding. For more information, please refer to this small talk.

In addition, type-ahead of combobox is supported to provide hint for user while type-in data.


	<comboitem label="Simple and Rich"/>
	<comboitem label="Cool!"/>
	<comboitem label="Thumbs Up!"/>

Moreover, an easier way to provide auto-complete is introduced by implementing org.zkoss.zul.ListSubModel. Here is an example of auto-complete using SimpleListModel which implements the ListSubModel interface to get data which qualifies the predefined condition.

	String[] data = new String[30];
	for(int j=0; j < data.length; ++j) {
	  data[j] = "option "+j;
	ListModel strset = new SimpleListModel(data);
  <combobox id="list" width="200px" model="${strset}"/> 

Datebox Supports Valid Range of Date

You could restrict user’s input of Datebox as follows,


<!-- Between Oct.12, 2007 and Dec. 23, 2007 -->
<datebox constraint="between 20071012 and 20071223"/>

Change Number of Upload File Dynamically

Before ZK 3.0.2, you have to decide the number of upload files in advance. But, it will be the best case that the user could decide the number of files by himself/herself. You could allow the user to add the number of upload files as follows,


<fileupload number="-1"/>

It will generates 1 upload dialogue, and there appears a + symbol to add more upload files.

More Events Supported

Echo Event

Echo event allows you to provide more richer message before doing long operation.

<window id="w" width="200px" title="Test echoEvent" border="normal">
  <attribute name="onLater">
  Clients.showBusy(null, false);
  new Label("Done.").setParent(w);

  <button label="Echo Event">
  <attribute name="onClick">
  Clients.showBusy("Execute... (about 5 sec.)", true);
  Events.echoEvent("onLater", w, null);

For more information, please refer to this small talk.

Integration with Other Frameworks

EJB3 - Using ZK JpaUtil to Retrieve EntityManager and EntityManagerFactory

JpaUtil is an utility class for Java Persistence API, providing methods to retrieve entityManagers and entityManagerFactories.

OpenEntityManagerInView listener, adapting hibernate's "Open Session In View" pattern, is supported to use entityManager without taking care of transcation begin, commit, close.

For more information, please refer to this small talk.

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