New Features of ZK 3.0.2"
m (correct highlight (via JWB)) |
|||
(One intermediate revision by one other user not shown) | |||
Line 16: | Line 16: | ||
=Ease of Use= | =Ease of Use= | ||
− | ==The < | + | ==The <code>fulfill</code> Attribute Supports Multiple Events== |
You could register more than one event in fulfill attribute as follows, | You could register more than one event in fulfill attribute as follows, | ||
Line 30: | Line 30: | ||
</source> | </source> | ||
− | ==EL-Expression Is Allowed in the < | + | ==EL-Expression Is Allowed in the <code>use</code> Attribute== |
It becomes more convenient to use a customized component using EL expression. | It becomes more convenient to use a customized component using EL expression. | ||
Line 52: | Line 52: | ||
− | ==Using the < | + | ==Using the <code>forward</code> Directive to Forward to Another Page== |
Currently, we used to embed codes within zscript to determine whether to forward the user to another page. | Currently, we used to embed codes within zscript to determine whether to forward the user to another page. | ||
Line 75: | Line 75: | ||
==New Components== | ==New Components== | ||
− | ===< | + | ===<code>jasperreports</code> Component=== |
[http://www.jasperforge.org/jaspersoft/opensource/business_intelligence/jasperreports/ 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. | [http://www.jasperforge.org/jaspersoft/opensource/business_intelligence/jasperreports/ 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 [ | + | For more information, please refer to this [[Small_Talks/2010/December/Report_with_ZK:_JasperReports_Component |small talk]]. |
− | |||
==New Features== | ==New Features== | ||
− | ===< | + | ===<code>Combobox</code> 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_Talks/2008/January/ListModel_and_Databinding_Enhanced_Combobox | small talk]]. | 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]]. | ||
Line 116: | Line 115: | ||
</source> | </source> | ||
− | ===< | + | ===<code>Datebox</code> Supports Valid Range of Date=== |
You could restrict user’s input of Datebox as follows, | You could restrict user’s input of Datebox as follows, | ||
Line 143: | Line 142: | ||
==More Events Supported== | ==More Events Supported== | ||
− | ===< | + | ===<code>Echo</code> Event=== |
Echo event allows you to provide more richer message before doing long operation. | Echo event allows you to provide more richer message before doing long operation. | ||
Line 169: | Line 168: | ||
− | ==EJB3 - Using ZK < | + | ==EJB3 - Using ZK <code>JpaUtil</code> to Retrieve <code>EntityManager</code> and <code>EntityManagerFactory</code>== |
JpaUtil is an utility class for Java Persistence API, providing methods to retrieve entityManagers and entityManagerFactories. | JpaUtil is an utility class for Java Persistence API, providing methods to retrieve entityManagers and entityManagerFactories. |
Latest revision as of 04:16, 20 January 2022
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. |