zk

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » zk 
ZK
License:GNU General Public License (GPL)
URL:http://www.zkoss.org/
Description:ZK is an AJAX-based, event-driven, XUL-compliant, all Java framework for enabling Web applications to have the rich user experiences.
Package NameComment
org.zkforge.dojo
org.zkforge.dojo.impl
org.zkforge.fckez
org.zkforge.fckez.connector
org.zkforge.fckez.uploader
org.zkforge.json.simple
org.zkforge.json.simple.parser
org.zkforge.timeline
org.zkforge.timeline.data
org.zkforge.timeline.decorator
org.zkforge.timeline.event
org.zkforge.timeline.impl
org.zkforge.timeline.util
org.zkoss Potix Common Library

Potix Component Library

org.zkoss.idom org.zkoss.idom

The iDOM representation of XML DOM tree.


Author: Tom M. Yeh
Contributors:
Copyright (C) 2001 Potix Corporation. All Rights Reserved.

Overview

It is Potix's DOM representation for XML. The concept is similar to JDOM -- using Java collections and concrete classes. However, we do have many enhancements (many of them are the reasons we don't extend JDOM, but writing a new one). Refer to Port from JDOM to iDOM for more details.

Although iDOM supports W3C/DOM, W3C/DOM's API is generated deprecated unless using them with third part utilities, like Xalan's XPath. The reason is that W3C/DOM API is another complete set of API that is easily confusing with iDOM API. The iDOM API is designed to avoid making any connection between their names. However, some cases are hardly avoided. For example, org.w3c.dom.Element.getAttribute returns an empty string if the attribute not found, while Element.getAttributeValue returns null if the attribute not found.


Usage

Generic Sample

Method 1: Let SAXBuilder create the SAX parser

import org.zkoss.idom.input.SAXBuilder;
import org.zkoss.idom.Document;

SAXBuilder builder = new SAXBuilder(true, false, true);
Document doc = builder.build("file.xml");

Advantages: simple. Caller needs no anything about a SAX parser.

Method 2: Create a parser explicitly

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.zkoss.idom.input.SAXBuilder;
import org.zkoss.idom.Document;

SAXParserFactory factory = SAXParserFactory.newInstance();
...//configure factory as you want
SAXParser parser = factory.newSAXParser();
SAXBuilder builder = new SAXBuilder(parser);
Document doc = builder.build("file.xml");

Advantages: a SAX parser could be used in different palces.

Parsing a XML

for (Iterator it = document.getElements("product").iterator();
it.hasNext();){
  String name = ((Element)it.next()).getElementValue("name", true);
  ...
}

The getElements and getElement methods of Group are powerful to drill down a iDOM tree sequentially.

To select beyond sequence searching (and regular expression), org.zkoss.xml.XPath could be used.


Extension to W3C DOM

  • A new item/node is added, called Binary (Item.BINARY_NODE), to hold any kind of Object (not just String-type).

Notes

  • Adding attributes with namespace might cause the tree to be illegal W3C/DOM. Examples, conflict prefix (same prefix but different URI). We will implement a method to check the consistency, which will be done before output.
  • Every item has zero or one owning document. To be safe, only vertices without any owning document are allowed to be added to other tree. Otherwise, Item.detach or clone must be called explicitly.
  • Some methods in Item look similar to those of Node, but behave differently as follows.
    Item Node
    getText

    Returns the text content.

    getNodeValue

    The same as getText, except Element whose getValue returns always null.


Histroy

September 27, 2001 Tom M. Yeh Project created. The original plan is to be an extension of JDOM.
October 4, 2001 Tom M. Yeh Alpha 1 as an extenstion of JDOM. Tested with JDOM beta 7.
October 22-26, 2001 Tom M. Yeh Alpha 1 of the rewritten version. On October 21, decide to rewrite to be independent of JDOM.
November 3-4, 2001 Tom M. Yeh Alpha 2.
  • SAXBuilder is enhance to support more options like DocumentBuilderFactory.
  • All un-expanding entities are put under EntityReference (if isExpandEntityReferences is true).
January 7-8, 2002 Tom M. Yeh Alpha 3.
  • The modification flag is introduced.
  • The content concept is introduced.
org.zkoss.idom.impl Implementation of iDOM Implementation of iDOM. It used only to implement the org.zkoss.idom package.
org.zkoss.idom.input iDOM Parser SAX builder and factory for iDOM.
org.zkoss.idom.transform iDOM Transformer XSL Transformer for iDOM.
org.zkoss.idom.util iDOM Utilities Utilities that simplifies the use of iDOM.
org.zkoss.image Image Image classes and interfaces.
org.zkoss.io File I/O File and stream I/O utilities.
org.zkoss.jsf.zul
org.zkoss.jsf.zul.impl
org.zkoss.jsf.zul.tag
org.zkoss.jsf.zul.tag.impl
org.zkoss.jsf.zul.util
org.zkoss.jsp.zul
org.zkoss.jsp.zul.impl
org.zkoss.lang Fundamental Java Utilities The most fundamental Java utilities relevant.
org.zkoss.lang.reflect Reflection utilities Utilities for Java reflection.
org.zkoss.math Mathematic Utilities Mathematic utilities, such as BigDecimal and BigInteger.
org.zkoss.mesg Common Messages

Message for multi-language messages (locale-dependent).

org.zkoss.mil MIL Component Set in RMIL(

MIL component set that are used for RMIL-based clients.

Table of Contents

What is ZK Mobile?

ZK Mobile is a JavaME program that runs as a thin client on mobile device. It interacts with the ZK server to display the RMIL page sent from ZK server and sent event triggered by the user back to server and so on.

What is MIL?

MIL is abbreviated from Mobile Interactive Language. It represents a set of components specifically for ZK Mobile thin client. A ZK Mobile to MIL is like a HTML browser to ZUL.

What is RMIL?

RMIL is abbreviated from Raw Mobile Interactive Language. It is a set of "low level" XML elements used to instruct ZK Mobile thin client how to "draw" a MIL page. A ZK Mobile to RMIL is like a HTML browser to HTML.

Components of MIL in RMIL

Introduction

The implementation of MIL components for ZK.

Directive Elements

page

<?page [id="..."] [title="..."] [language="mil"]?>
  • The language must be mil.
  • The title is not used in MIL.
  • The id is used for ID Space navigation.
  • It must be at the same level as the root element.

Special Elements

zk

Due to XML's syntax limitation, we can only specify one document root. Thus, if you have multiple root components, you must use <zk> as the document root to group these root components. In other words, <zk> is not a component and it, if used, must be the document root.

zscript

<zscript>...</zscript>
<zscript src="/WEB-INF/xx/yy.bs">
  • Specifies a script that shall be interpret when executing this page.
  • If you want to pre-compile Java codes, you could do
    <zscript>
    import com.MyCompany.MyPackage.MyClass;
    MyClass.doThis();
    MyClass.doThat();
    .</zscript>
  • Predefined variables:
    self
    The component itself
    self.parent
    The parent component, if any
    page
    The page (org.zkoss.zk.ui.Page)
    session
    The session (org.zkoss.zk.ui.Session)
    this
    The BeanShell namespace to interpret the script defined in this component. Advanced users only.
    super
    The BeanShell namespace to interpret the script defined in the parent component, if any. Advanced users only.
  • If you specify the id attribute for a component, a variable the same as the specified ID is created automatically.
  • If you want to resolve the EL's variables, such as a parameter, use page.resolveVariable(). Example: page.getELVariable('param').get('some')

Simple Elements

Common Attributes

<xxx [id="..."] [use="..."]/>
  • If id is not specified, it is generated automatically. If specified, it must be unique in the whole page.
  • The class attribute defines the CSS class that this component shall refer.
  • The use attribute defines the Java class to use instead of the Java class defined in zk-xul-*.xml

textbox

<textbox [id="..."] [use="..."]
[onChange="script"] [onChanging="script"] [value="value"] [type="|password"]
[maxlength="0|num"] [readonly="false|true"] />
  • The onChange attribute is called after the value is really set.
    • Note: the script of the onChange attribute is called only if user input a different value. On the other hand, the setValue method is called either by a program or by user's input (if by a program, the value might not be changed).
  • The onChanging attribute is called when a user is chaning its content. onChanging won't cause the content being set. It is simply used to notify server for implementing auto-completion and other features.

frame

<frame [id="..."] [use="..."] [title="..."] [border="normal|none"]/>
  • The title attribute defines the frame title.

Implicit Objects

Depending on invoking from a script or from an EL expression, different implicit objects might be used.
NameDescriptionFrom ScriptFrom EL
self The current component that script/EL is interpreted upon.
It is the same as this in Java.
YesYes
spaceOwner The owner of the ID space that the current component belongs to (See What is an ID space"). It is null, if the current component doesn't belong to any space.
It is the same as self.getSpaceOwner() in script, self.root in EL and this.getSpaceOwner() in Java.
YesYes
desktopScope The attributes defined in the current desktop.
It is the same as this.getPage().getAttributes(name,DESKTOP_SCOPE) in Java.
YesYes
pageScope The attributes defined in the current page.
It is the same as this.getPage().getAttributes() in Java.
YesYes
spaceScope The attributes defined in the ID space that the current component belongs to (See What is an ID space"). It is the same as this.getAttributes() with SPACE_SCOPE in Java. YesYes
componentScope The attributes defined in the current component. It is the same as this.getAttributes() with COMPONENT_SCOPE in Java. YesYes
arg A map of parameters that are passed to Execution.createComponents(...).
It is the same as desktop.getExecution().getArg() in Java.
YesYes

How to browse components

In Java

Each frame forms an independent ID space. To get a component from an ID space, use Component.getFellow against any component in the same ID space. If a frame, say C, is a child of another frame, say P, then C belongs the ID space of P, but descendants of C don't. Rather, descendants of C belong to the ID space of C. Notice: C belongs to the ID spaces of both C and P.

A page is also an independent ID space, Page.getFellow is used to retrieve a fellow in it.

  • To get the current page, use Component.getPage().
  • To get another page (in the same desktop), use Component.getPage(String).
  • To get a component of a page, use Page.getFellow(String) -- assuming the component is not a descendant of any frame..
  • To get a child component of frame, use Window.getFellow(String).
  • To get a fellow component, use Componnet.getFellow(String). All components belongs (aka., child or descendant of) to the same frame are called fellows. If a frame, say X, belongs to another frame, say Y, then X, like other type of components, is a fellow of Y. However, children and descendants of X are NOT fellow of Y because they belong to X's space. Only X belongs to both X's and Y's spaces.

In Script and EL

Components that are specified with the id attribute (i.e., you have assign an ID) can be accessed directly by the value of the id attribute.

For example,

<label id="label" value="Not good enough?"/>
<button label="Change label" onClick="label.value = label.value + 'A'"/>
The scope of visibility, same as in Java, is controlled by the ID space. In other words, each frame has an independent ID space. When you specified an ID, only the current ID space is searched.

Events

org.zkoss.mil.au.in
org.zkoss.mil.au.out
org.zkoss.mil.device MIL Device

MIL Device

org.zkoss.mil.event
org.zkoss.mil.fn
org.zkoss.mil.impl
org.zkoss.mil.mesg
org.zkoss.seam
org.zkoss.seam.jsf
org.zkoss.sound Sound Sound classes and interfaces.
org.zkoss.text Format Utilities Utilities for formatting numbers, dates and others.
org.zkoss.util Data Structure Utilities Utilities for handling data structures.
org.zkoss.util.logging Logging Logging utilities.
org.zkoss.util.media Media Utilities Media classes, interfaces and utilities. A media is an object representing image, audio and others.
org.zkoss.util.resource Resources Resources and their locators and loaders.
org.zkoss.util.resource.impl Implementation of Resources Implementation of resources and their locators and loaders.
org.zkoss.web Potix Web Common Library The Web common library. It is a collection of utilities relevant to servlets and portlets.
org.zkoss.web.fn Functions used for EL Expressions Functions used for EL expressions. They are defined part of builtin TLD files, URI: http://www.zkoss.org/dsp/web/core and http://www.zkoss.org/dsp/web/html.
org.zkoss.web.init Listener for Initialization of Web Applications Listeners used to register to web.xml, and then initialize Web applications.
org.zkoss.web.mesg
org.zkoss.web.portlet Portlet Utilities Portlet relevant utilities.
org.zkoss.web.servlet Servlet Utilities Servlet relevant utilities.
org.zkoss.web.servlet.dsp Dynamic Servlet Page Dynamic Servlet Page (DSP). DSP is similar to JSP, but it is interpreted dynamically without compiling.
org.zkoss.web.servlet.dsp.action DSP Actions DSP actions, such as ForEach, Include and If
org.zkoss.web.servlet.dsp.action.html DSP HTML Actions DSP actions that are used only with HTML.
org.zkoss.web.servlet.dsp.impl Implementation of DSP Classes used to implement DSP.
org.zkoss.web.servlet.http HTTP Utilities HTTP relevant utilities.
org.zkoss.web.servlet.xel XEL Utilities Depending on Servlets

XEL Utilities that depends on Servlets.

org.zkoss.web.util.resource Web Resources Utilities to access Web resources.
org.zkoss.xel Extensible Expression Language

XEL - Extensible Expression Language to encapsulate different implementations, such as EL, MVEL and OGNL.

org.zkoss.xel.el Implementations based on zcommons-EL

This implementation is based on zcommons-EL. It includes ELFactory.

org.zkoss.xel.fn XEL functions

A collections of functions used in XEL expressions (for TLD only). They are accessible by declaring them in TLD files.

org.zkoss.xel.taglib Utilities to Access Taglib

Utilities to access taglibs, aka., the TLD files.

org.zkoss.xel.util Utilities of XEL expressions

Utilties of XEL expressions.

org.zkoss.xml XML Utilities Utilities for handling XML and HTML.
org.zkoss.zhtml ZHTML Component Set

ZHTML component set.

Implementation Consideration

Currently, zhtml depends on zul, but it is not necessary. If we implement Fileupload and Messagebox in different way, such dependence could be removed. This might be important when we support XAML and user might want to minimize the foot print.

org.zkoss.zhtml.impl Classes Implementing ZHTML Component Set Classes used to implement ZHTML component set.
org.zkoss.zk ZK Core

ZK core library.

org.zkoss.zk.au Asynchronous Updates

Requests and responsed used to communicate between client and server, called asynchronous updates. Application developers rarely need to know them. Rather, use org.zkoss.zk.ui.util.Clients instead.

org.zkoss.zk.au.http HTTP Related Asynchronous Updates HTTP related classes used to do asynchronous updates.
org.zkoss.zk.au.impl Deprecated Deprecated as of release 3.0.0, replaced with the org.zkoss.zk.au.in package.
org.zkoss.zk.au.in Asynchronous Update Commands

The commands of the requests of asynchronous updates (sent from client to server).

Note: commands in this package is not what an application developer handles. Rather, use the org.zkoss.zk.event package.

org.zkoss.zk.au.out Asynchronous Update Responses

The responses of asynchronous updates (sent from server to client).

Note: they are the responses sent from the server to the client.

org.zkoss.zk.device Device Relevant Classes

Device (such as Ajax browsers and mobile devices) relevant classes.

org.zkoss.zk.fn Functions for EL Expressions

A collections of functions used in EL expressions (implementation only).

org.zkoss.zk.mesg
org.zkoss.zk.scripting Scripting Interpreter Revelant Classes

Scripting intepreter relevant classes, including interpreter, namespace and so on.

org.zkoss.zk.scripting.bsh BeanShell - Java Interpreter

BeanShell - Java Interpreter.

org.zkoss.zk.scripting.util Utilities for Implementing Interpters

Utilities for implementing interpters and namespaces.

org.zkoss.zk.ui User Interfaces

Interfaces of the common user-interfaces, such as Page and Component.

Application developers usually need only classes defined in this package. For advance control, they might see also the org.zkoss.zk.ui.event and org.zkoss.zk.ui.util

Component developers might need also the org.zkoss.zk.ui.ext package.

All other packages are mostly used internally.

See Page for an overview.

org.zkoss.zk.ui.event Events The org.zkoss.zk.ui and org.zkoss.zk.ui.event packages are the only packages that component and application developers need to know.

For application developers they usually need only the org.zkoss.zk.ui package.

org.zkoss.zk.ui.ext Additional Interfaces for Special Components Additional Interfaces that might be implemented by special components, such as AfterCompose.
org.zkoss.zk.ui.ext.client Additional Interfaces for ComponentCtrl.getExtraCtrl()

Additional Interfaces that might be implemented by the returned object of getExtraCtrl(). ZK Update Engine uses them to update the content of a component caused by user's activity at the client. In other words, it means a component's content is controlled by the client.

See getExtraCtrl for details

Application developers need NOT to access any of them.

org.zkoss.zk.ui.ext.render Additional Interfaces for ComponentCtrl.getExtraCtrl()

Additional Interfaces that might be implemented by the returned object of getExtraCtrl(). ZK uses them to decide how to render a component specially.

See also getExtraCtrl

Application developers need NOT to access any of them.

org.zkoss.zk.ui.http HTTP Relevant User Interfaces Utilities

HTTP relevant utilities and servlets for implementing user interfaces (implementation only).

org.zkoss.zk.ui.impl Implementation of User Interfaces

Implementation of user interfaces and factories (implementation only).

org.zkoss.zk.ui.metainfo Metainfo of Pages and Languages

Metainfo representing pages and languages (implementation only).

LanguageDefinition

ComponentDefinition

PageDefinition

PageDefinition represents a ZUML page. The XML nodes in the ZUML page are represented by ComponentInfo, AttributesInfo, VariablesInfo, InitiatorInfo

org.zkoss.zk.ui.metainfo.impl Implementation of Metainfo

The implementation class of the metainfos.

org.zkoss.zk.ui.render Component Renderer

The component render is a way to render a component in addition to the use of JSP, DSP, and other Servlet technologies.

org.zkoss.zk.ui.sys Internal Interfaces of User-Interfaces

Internal interfaces of user interfaces and factories (behind the scene). Most user interface, such as Component, has an internal interface, such as ComponentCtrl, used only by ZK internals. Application developers shall never use them.

org.zkoss.zk.ui.util Utitilies to Handle User Interfaces

Utilities to handle user interfaces.

org.zkoss.zk.xel ZK XEL Utilities

ZK XEL utilities.

org.zkoss.zk.xel.impl XEL Utilities for Implementation Only

XEL utilities for implementation only.

org.zkoss.zkex The Extension to ZK Core and additional ZUL Components

The extension to ZK core and additional ZUL components. The extension includes the client-pooling-based server push. Additional components include layouts, JFreeChart-based chart engine, and others.

org.zkoss.zkex.ui.impl ZK UI Related Implementations

ZK UI related implementation, such as server push.

org.zkoss.zkex.zul Zul Extension

Zul Extension library.

Zul Extension

Zul Extension library.

org.zkoss.zkex.zul.impl Classes for Implementing ZUL Extension Classes used to implement ZUL Component extension Set (implementation only).
org.zkoss.zkmax ZK MAX Plugins

Versatile plugins such as Ruby, Groovy, JavaScript, MVEL, OGNL, and other plugins.

In addition, it provides the performance enhancement version of ZUL.

org.zkoss.zkmax.au.http HTTP Related Asynchronous Updates HTTP related classes used to do asynchronous updates.
org.zkoss.zkmax.scripting.groovy Groovy Interpreter

Groovy Interpreter

org.zkoss.zkmax.scripting.jruby JRuby Interpreter

JRuby interpreter

org.zkoss.zkmax.scripting.rhino Rhino - JavaScript Interpreter

Rhino - JavaScript Interpreter

org.zkoss.scripting.bsf.rhino.RhinoInterpreter
An implementation based on Rhino
org.zkoss.scripting.bsf.rhino.RhinoInterpreter
An implementation based on Rhino but went through BSF.
org.zkoss.zkmax.xel.el Implementation based on Apache Commons EL

This implementation is based on Apache Commons EL, ApacheELFactory.

org.zkoss.zkmax.xel.el21 Implementation based on JSP 2.1 EL

This implementation is based on JSP 2.1 EL. It includes ApacheELFactory.

org.zkoss.zkmax.xel.mvel A XEL Implementation based on MVEL

A XEL implemetation based on MVEL.

org.zkoss.zkmax.xel.ognl A XEL Implementation based on OGNL

A XEL implemetation based on OGNL.

org.zkoss.zkmax.xel.util Utilities to Implement XEL Factories

Utilities to implement XEL factories.

org.zkoss.zkmax.zul.render Component Renderers

Component renderers for rendering ZUL components.

org.zkoss.zkmob
org.zkoss.zkmob.factory Implementation of ZK Mobile Components Factories

The implementation of ZK Mobile JavaMe component factories (implementation only).

org.zkoss.zkmob.ui
org.zkoss.zkplus ZK Plus

The ZK plus utilities, including data binding and integration of hibernate, acegi and so on.

org.zkoss.zkplus.acegi Utilities to support Acegi

Utilities to support Acegi Security System

org.zkoss.zkplus.databind Databinder

The DataBinder used for binding ZK UI component and the backend data bean.

org.zkoss.zkplus.hibernate Utilities to Support Hibernate

Utilities to support Hibernate.

org.zkoss.zkplus.jndi JNDI Utilities

Utilities to support JNDI

org.zkoss.zkplus.jpa JPA Utilities

Utilities to support JPA

org.zkoss.zkplus.seasar Utilities to Support Seasar

Utilities to support Seasar Framework.

org.zkoss.zkplus.spring Utilities to Support Spring

Utilities to support Spring Application Framework.

org.zkoss.zkplus.util Generic Utilities

Utilities that can be applied to several situations.

org.zkoss.zml The ZK XML Component Set

The ZK XML Component Set.

org.zkoss.zml.device XML Device

XML Device

org.zkoss.zul ZUL Component Set in HTML

ZUL component set that are used for HTML-based clients.

Table of Contents

Components of XUL in HTML

Introduction

The implementation of XUL components for ZK.

Directive Elements

page

<?page [id="..."] [title="..."] [language="xul/html"]?>
  • The language must be xul/html.
  • The title is used as the HTML page title. Used only if it is rendered as a standalone page (rather than included).
  • The id, if specified, must be unique in the same request. Note: a request might contain multiple pages (such as a portal page).
  • It must be at the same level as the root element.

Special Elements

zk

Due to XML's syntax limitation, we can only specify one document root. Thus, if you have multiple root components, you must use <zk> as the document root to group these root components. In other words, <zk> is not a component and it, if used, must be the document root.

zscript

<zscript>...</zscript>
<zscript src="/WEB-INF/xx/yy.bs">
  • Specifies a script that shall be interpret when executing this page.
  • If you want to pre-compile Java codes, you could do
    <zscript>
    import com.MyCompany.MyPackage.MyClass;
    MyClass.doThis();
    MyClass.doThat();
    .</zscript>
  • Predefined variables:
    self
    The component itself
    self.parent
    The parent component, if any
    page
    The page (org.zkoss.zk.ui.Page)
    session
    The session (org.zkoss.zk.ui.Session)
    this
    The BeanShell namespace to interpret the script defined in this component. Advanced users only.
    super
    The BeanShell namespace to interpret the script defined in the parent component, if any. Advanced users only.
  • If you specify the id attribute for a component, a variable the same as the specified ID is created automatically.
  • If you want to resolve the EL's variables, such as a parameter, use page.resolveVariable(). Example: page.getELVariable('param').get('some')

Simple Elements

Common Attributes

<xxx [id="..."] [class="..."] [style="...] [use="..."]/>
  • If id is not specified, it is generated automatically. If specified, it must be unique in the whole page.
  • The class attribute defines the CSS class that this component shall refer.
  • The use attribute defines the Java class to use instead of the Java class defined in zk-xul-*.xml

textbox

<textbox [id="..."] [class="..."] [style="...] [use="..."]
[onChange="script"] [onChanging="script"] [value="value"] [type="|password"]
[maxlength="0|num"] [rows="3|num"] [cols="0|num"]
[disabled="false|true"] [readonly="false|true"] [multiline="false|true"] />
  • The onChange attribute is called after the value is really set.
    • Note: the script of the onChange attribute is called only if user input a different value. On the other hand, the setValue method is called either by a program or by user's input (if by a program, the value might not be changed).
  • The onChanging attribute is called when a user is chaning its content. onChanging won't cause the content being set. It is simply used to notify server for implementing auto-completion and other features.

window

<window [id="..."] [class="..."] [style="...] [use="..."] [title="..."] [border="normal|none"]/>
  • The title attribute defines the window title.

Implicit Objects

Depending on invoking from a script or from an EL expression, different implicit objects might be used.
NameDescriptionFrom ScriptFrom EL
self The current component that script/EL is interpreted upon.
It is the same as this in Java.
YesYes
spaceOwner The owner of the ID space that the current component belongs to (See What is an ID space"). It is null, if the current component doesn't belong to any space.
It is the same as self.getSpaceOwner() in script, self.root in EL and this.getSpaceOwner() in Java.
YesYes
desktopScope The attributes defined in the current desktop.
It is the same as this.getPage().getAttributes(name,DESKTOP_SCOPE) in Java.
YesYes
pageScope The attributes defined in the current page.
It is the same as this.getPage().getAttributes() in Java.
YesYes
spaceScope The attributes defined in the ID space that the current component belongs to (See What is an ID space"). It is the same as this.getAttributes() with SPACE_SCOPE in Java. YesYes
componentScope The attributes defined in the current component. It is the same as this.getAttributes() with COMPONENT_SCOPE in Java. YesYes
arg A map of parameters that are passed to Execution.createComponents(...).
It is the same as desktop.getExecution().getArg() in Java.
YesYes

How to browse components

In Java

Each window forms an independent ID space. To get a component from an ID space, use Component.getFellow against any component in the same ID space. If a window, say C, is a child of another window, say P, then C belongs the ID space of P, but descendants of C don't. Rather, descendants of C belong to the ID space of C. Notice: C belongs to the ID spaces of both C and P.

A page is also an independent ID space, Page.getFellow is used to retrieve a fellow in it.

  • To get the current page, use Component.getPage().
  • To get another page (in the same desktop), use Component.getPage(String).
  • To get a component of a page, use Page.getFellow(String) -- assuming the component is not a descendant of any window..
  • To get a child component of window, use Window.getFellow(String).
  • To get a fellow component, use Componnet.getFellow(String). All components belongs (aka., child or descendant of) to the same window are called fellows. If a window, say X, belongs to another window, say Y, then X, like other type of components, is a fellow of Y. However, children and descendants of X are NOT fellow of Y because they belong to X's space. Only X belongs to both X's and Y's spaces.

In Script and EL

Components that are specified with the id attribute (i.e., you have assign an ID) can be accessed directly by the value of the id attribute.

For example,

<label id="label" value="Not good enough?"/>
<button label="Change label" onClick="label.value = label.value + 'A'"/>
The scope of visibility, same as in Java, is controlled by the ID space. In other words, each window has an independent ID space. When you specified an ID, only the current ID space is searched.

Events

onOK and onCancel

When window intercepts whether ENTER or ESC is pressed, the onOK or onCancel event is sent, resprectively.

onCtrlKey

Window intercepts whether control or function keys is pressed if you specify what to intercept by use of the ctrlKeys attribute. For example, If ctrlKeys="GW2" is specified, it means Ctrl+G, Ctrl+W and F2 are all intercepted. Once user press one of them, the onCtrlKey event is sent.

org.zkoss.zul.au.in Requests/Commands of Asynchronous Updates of ZUL

ZUL specific requests and commands of asynchronous updates.

org.zkoss.zul.au.out Responses of Asynchronous Updates of ZUL

ZUL specific responses of asynchornous updates.

org.zkoss.zul.event Events of ZUL Component Set

Events of ZUL Component Set.

org.zkoss.zul.ext Interfaces that ZUL Components Might Implement

Interfaces that might be implemented by ZUL components.

org.zkoss.zul.fn Functions for EL Expressions

A collections of functions used in EL expressions (implementation only).

org.zkoss.zul.impl Classes for Implementing ZUL Classes used to implement ZUL Component Set (implementation only).
org.zkoss.zul.mesg
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.