New Features of ZK 3.0.7

Robbie Cheng, Engineer, Potix Corporation
August 1, 2008

ZK 3.0.7 focuses mainly on fixing bugs. In addition to over 22 bug fixes, there are 9 new features.

These new features include component enhancement, and ease-of-use utilities. For example, Tree supports paging mold, which is more convenient and useful. An easier way to forward event in Java files. And from now on, Image accepts javax.awt.image.RenderedImage.

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

Ease of Use

A more convenient way to forward events in Java

Before ZK 3.0.7, develoeprs used to write forward attribute in ZUL files. Here comes another option which makes the UI even cleaner. Developers are allowed to forward events in Java files directly with the help of GenericForwardComposer as follows,
Java file,

public class MyComposer extends GenericForwardComposer{
	private txt1;
	private lb1;

	public void onChange$txt1(Event evt) {
		lb1.setValue(txt1.getValue());
	}
}


ZUL file,

<window id="mywin" apply="MyComposer">
	<textbox id="txt1"/>
	<label id="lb1"/>
</window>

There is no need to write forward in since GenericForwardComposer will add the forward for you as long as you write your eventlistener in the form of onXxx$id. Here the example (onChange$txt1) says forward onChange event from txt1 to the applied component.

Component Reloaded

New Features

Tree supports Paging mold.

ZK 3.0.7 enhance Tree to support paging mold, and Tree supports individual or external Paging component. The major difference lies in the pagination of the tree which is based on the total number of visible tree items instead of the tree children of certain treeitem. For example, if the page size is 5, and the user can see 6 nodes, there will be 2 pages.

5 nodes in the first page.

1 node in the second page.

Here is the example code,


	<zscript>
	
		import org.zkoss.zkdemo.test2.tree.BinaryTreeModel;
		
		ArrayList al = new ArrayList();
		int i=0;
		for(; i < 100000; i++)
		{
			Object obj = ""+i;
			al.add(obj);
		}
		BinaryTreeModel btm = new BinaryTreeModel(al);
		
	</zscript>
	<tree  model="${btm}" id="tree" mold="paging" pageSize="5">

Image supports javax.awt.image.RenderedImage

ZK 3.0.7 allows image, button and related components to support RenderedImage directly without format conversion. Here is the example code,


<window title="Test of Live Image">
	<image id="img"/>
	<zscript>
	import java.awt.*;
	import java.awt.image.*;
	import java.awt.geom.*;
	int x = 10, y = 10;

	void draw(int x1, int y1, int x2, int y2) {
		BufferedImage bi = new BufferedImage(400, 300, BufferedImage.TYPE_INT_RGB);
		Graphics2D g2d = bi.createGraphics();
		Line2D line = new Line2D.Double(x1, y1, x2, y2);
		g2d.setColor(Color.blue);
		g2d.setStroke(new BasicStroke(3));
		g2d.draw(line);
		img.setContent(bi);
	}
	draw(x, y, x += 10, y += 10);
	</zscript>
	<button label="change" onClick="draw(x, y, x += 10, y += 10)"/>
</window>
Comments
 
Bernd
2008-08-01

Great work, once again !

Greetings
bernd

Horst Neumann
2008-08-01

Great !

The GenericForwardComposer allows us a cleaner MVC implementation!

Well done

lerf
2008-08-01

hi :
why don't zk group integrated zk_Freshly's style into zk,zk_Freshly's style looked very beautiful;

Dominic
2008-08-01

lerf,

I'm not on the ZK dev team, but as a user, it makes a lot more sense to run two branches as the dev team seem to be doing. Changing the entire theme of the framework affects anybody who has customised it or added their own graphics that match the ZK theme (like us).

If it were to suddenly appear in a small point release, it would be a major blocker for us. We're testing 3.5.0 freshly builds regularly in our development process, but I don't think it's a small change suitable for this version. It's something that people need to be able to switch over to and evaluate without holding up bug fixes.

I am looking forward to seeing 3.5.0 with its new theme and excellent server-push support though!

vic
2008-08-01

Good, thank you.
mold="paging" looks not so good as previous version of paging with glass :)
So I have to use 3.0.6 version of ZK :(

How I can use old paging for Tree component? I didnt find changes in documentation.

Aliyu Musa Aliyu
2008-08-02

zk not working properly in opera 9.5 jst tried to run my application on all browser but opera 9.5 is making a mess of the beautiful app. even the new zk site will not display properly on opera 9.5

Aliyu Musa Aliyu
2008-08-02

please zk is to good to be messed with. development team please check the opera 9.5 issue

good
2008-08-03

好东西,你们要继续努力啊 ,哥哥我还要学习呢

henrichen
2008-08-06

@Aliyu

Please post to bug list so we can track it.

http://sourceforge.net/tracker/?group_id=152762&atid=785191

mike
2008-08-11

brilliant! keep on going!

Simon Massey
2008-08-11

GenericForwardComposer is now discussed on the how-to wiki at http://en.wikibooks.org/wiki/ZK/How-Tos#Model_View_Controller_Pattern

zk support ie8
2008-08-13

i found zk not support ie8,my program always error in ie8;failed to invoke the
zkcicapt.init

 
 
Leave a Reply
 
Name (required)
Mail (will not be published) (required)
Website
(Case Insensitive)
Bold textItalic textUnderLine textSource CodeHorizontal rulerExternal Link
Post
Preview