ZK 控件

[size=large][color=red]1.ZK 客户端和服务端之间的交互[/color][/size]

[img]http://dl.iteye.com/upload/attachment/0067/8880/b3e7f469-03a7-35f8-949a-f9533699b2e1.jpg[/img]

官网对上图的解释如下:

When a ZK application runs on the server, it can have access to the backend resources, assemble UI with
components, listen to user's activity, and then manipulate components to update UI. [color=red]All are done at the server[/color]. The
synchronization of the states of the components between the browser and the server is done automatically by ZK and
transparently to the application.
When running at the server, the application can access full Java technology stack. User activities, including Ajax and
Server Push, are abstracted to event objects. UI are composed of POJO-like components. ZK is the most productive
approach to develop a modern Web application.

[size=large][color=red]2. ZK UI开发可以用zul或纯java代码来实现[/color][/size]

[img]http://dl.iteye.com/upload/attachment/0067/8890/48a54b3d-995f-3459-aedf-121c78a28c4a.jpg[/img]


<window title="ZK Essentials" border="normal" width="250px">
<button label="Hello"/>
<button label="Good-bye "/>
</window>

等同于下面的

Window win = new Window();
win.setTitle("ZK Essentials");
win.setBorder("normal");
win.setWidth("250px");
Button helloBtn = new Button();
helloBtn.setLabel("Hello");
helloBtn.setParent(win);
Button byeBtn = new Button();
byeBtn.setLabel("Good-bye");
byeBtn.setParent(win);

[size=large][color=red]3. ZK UI的创建[/color][/size]

Components declared using ZUML in a ZUL file are [color=red]parsed by a ZK enhanced[/color] XML parser. The components
declared are created as[color=red] Plain Old Java Objects (POJO)[/color] in the JVM on the server. Suppose we have a ZUL page that
outlines the tree of components. Please see the following:

[img]http://dl.iteye.com/upload/attachment/0067/8892/d51b0f48-92b6-3f11-a455-81ad4375e34b.jpg[/img]

[size=large][color=red]4. 在java中查找控件 [/color][/size]
[color=red]Finding a Component Programmatically in Java[/color]
例子如下:
1. java 代码生成的UI

Window outerWin = new Window();
Button outerBtn = new Button();
btn.setParent(outerWin);
Window innerWin = new Window();
innerWin.setParent(outerWin);
Button innerBtn = new Button();
innerBtn.setParent(innerWin);


2. zul代码生成的UI

<window id="outerWin">
<button id="outerBtn">
<window id="innerWin">
<button id="innerBtn"/>
</window>
</window>



结构图如下:

[img]http://dl.iteye.com/upload/attachment/0067/8908/4f0f2e66-af32-3cfd-847a-b1d991f78030.jpg[/img]

在相同的ID空间中可以使用 [color=red]getFellow [/color]方法来获得控件
We can call the getFellow method on any component to access another component in the [color=red]same ID Space[/color].


Window innerWin = (Window)outerWin.getFellow("innerWin");



可以使用的方法如下:

[img]http://dl.iteye.com/upload/attachment/0067/8910/11a3e208-4d4f-34be-afd7-5d42a3b2adde.jpg[/img]

[img]http://dl.iteye.com/upload/attachment/0067/8912/b2d27d63-d0a3-31de-9445-409efefae35a.jpg[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值