ZUML

From Documentation
Revision as of 07:09, 3 December 2010 by Tomyeh (talk | contribs)

There are two ways to compose UI: XML-based approach and pure-Java approach. Here we describe XML-based approach. For pure-Java approach, please refer the next chapter.

The declaration language is called ZK User Interface Markup Language (ZUML). It is based on XML. Each XML element instructs the ZK Loader which component to create. Each XML attribute describes what value to be assigned to the created component. Each XML processing instruction describes how to process the whole page, such as the page title. For example,

<?page title="Super Application"?>
<window title="Super Hello" border="normal">
    <button label="hi" onClick='alert("hi")'/>

where the first line specifies the page title, the second line creates a root component with title and border, and the third line creates a button with label and an event listener.

This chapter is about the general use of ZUML. For a complete reference, please refer to ZUML Reference.

Auto-completion with Schema

When working with a ZUML document, ZK Studio is suggested since it provides a lot features, such as content assist.

If you prefer not to use ZK Studio, you could specified the XML schema in a ZUML document as follows. Many XML editors supports auto-completion if XML schema is specified correctly.

 <window xmlns="http://www.zkoss.org/2005/zul"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">

The ZUL schema can be downloaded from http://www.zkoss.org/2005/zul/zul.xsd. In additions, you can find zul.xsd under the dist/xsd directory in the ZK binary distribution.




Last Update : 2010/12/03

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.