New Features of ZK 3.0.2"
Line 86: | Line 86: | ||
===<tt>Combobox</tt> Supports Data-Binding, ListModel, Type-Ahead, and etc.=== | ===<tt>Combobox</tt> Supports Data-Binding, ListModel, Type-Ahead, and etc.=== | ||
− | For ease of use, Combobox supports ListModel and DataBinding. For more information, please refer to this [ | + | For ease of use, Combobox supports ListModel and DataBinding. For more information, please refer to this [[Small_Talks/2008/January/ListModel_and_Databinding_Enhanced_Combobox | small talk]]. |
In addition, type-ahead of combobox is supported to provide hint for user while type-in data. | In addition, type-ahead of combobox is supported to provide hint for user while type-in data. |
Revision as of 02:56, 8 December 2010
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,
<window>
<button label="create" id="xyz"/>
<combobox id="cbx" fulfill="self.onOpen,xyz.onClick">
<comboitem label="Simple"/>
<comboitem label="Rich"/>
</combobox>
</window>
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.
<zscript>
if (...)
Executions.forward("/some/where.zul");
</zscript>
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.
<combobox>
<comboitem label="Simple and Rich"/>
<comboitem label="Cool!"/>
<comboitem label="Thumbs Up!"/>
</combobox>
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.
<zk>
<zscript>
String[] data = new String[30];
for(int j=0; j < data.length; ++j) {
data[j] = "option "+j;
}
ListModel strset = new SimpleListModel(data);
</zscript>
<combobox id="list" width="200px" model="${strset}"/>
</zk>
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">
Thread.sleep(5000);
Clients.showBusy(null, false);
new Label("Done.").setParent(w);
</attribute>
<button label="Echo Event">
<attribute name="onClick">
Clients.showBusy("Execute... (about 5 sec.)", true);
Events.echoEvent("onLater", w, null);
</attribute>
</button>
</window>
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. |