`
编程足球
  • 浏览: 250994 次
  • 性别: Icon_minigender_1
  • 来自: 福州
社区版块
存档分类
最新评论

ZK 控件

    博客分类:
  • ZK
 
阅读更多
1.ZK 客户端和服务端之间的交互



官网对上图的解释如下:

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. All are done at the server. 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.

2. ZK UI开发可以用zul或纯java代码来实现



<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);

3. ZK UI的创建

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



4. 在java中查找控件
Finding a Component Programmatically in Java
例子如下:
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>



结构图如下:



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

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



可以使用的方法如下:





  • 大小: 120.4 KB
  • 大小: 97.7 KB
  • 大小: 89.3 KB
  • 大小: 86 KB
  • 大小: 91.1 KB
  • 大小: 152.8 KB
  • 大小: 38.3 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics