Robbie Cheng is the author of the book "ZK: Ajax without the Javascript Framework". He is a software developer at Potix Corporation, and the principle developer of ZK Android and ZK Forum. Recently, he become a ZK evangelist, and has been invited to give speeches at Google Developer Day and Mobile Monday, as well as published many articles on the Internet. Robbie has posted 19 posts at DZone. View Full User Profile

Intuive MVC Pattern for Ajax Applications

04.29.2009
| 3324 views |
  • submit to reddit

ZK 3.6.1 released recently. ZK is a Direct RIA framework to increase developer’s productivity by integrating frontend and backend of applications transparently to deliver rich, and engaging user experience.

The main focus of ZK 3.6.1 was on bug-fixing, with over 47 bugs fixed. In addition to the host of bugs eradicated 20 new features have been added, including a debug mode for unit-testing and MVC enhancement!

Features Highlights:

  • MVC pattern enhanced.
  • Use Component ID as UUID for unit test.
  • A way to delay databinding behaviors.

Intuive MVC Pattern

Using ZK 3.6.1, the developer has easier access to the Cotroller by using a generic variable called ($composer). Developers can define required resources inside the Controller and access them easier.

View:

<window id="win" width="300px" apply="MyController">
<grid model="win$composer"/>
<button id="btn"/>
</window>

Controller:

public class MyController extends GenericForwardComposer {
Window win;
Button btn;
DataModel model = new DataModel();

public DataModel getModel() {
return mode;
}

public void btn$onClick(){
win.setTitle("Hi ZK!");
}
}

ZK programming is all about event handling and UI components manipulation. To make MVC programming easier, we have made the interaction between controller and view easier.

Read New Features

0
Published at DZone with permission of its author, Robbie Cheng.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: