ZUML"

From Documentation
m
 
(4 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
There are two ways to compose UI: XML-based approach and pure-Java approach. Here we will describe XML-based approach. For pure-Java approach, please refer to the next chapter.
 
There are two ways to compose UI: XML-based approach and pure-Java approach. Here we will describe XML-based approach. For pure-Java approach, please refer to 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 to create a component. 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,
+
The declaration language is called ZK User Interface Markup Language (ZUML). It is based on XML. Each XML element instructs ZK Loader to create a component. 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,
  
 
<source lang="xml">
 
<source lang="xml">
Line 15: Line 15:
 
'''Auto-completion with Schema'''
 
'''Auto-completion with Schema'''
  
When working with a ZUML document, [http://www.zkoss.org/product/zkstudio.dsp ZK Studio] is suggested since it provides a lot of features to simplify the editing, such as ''content assist'' and ''visual editor'.
+
When working with a ZUML document, it is suggested to use [http://www.zkoss.org/product/zkstudio.dsp ZK Studio] since it provides a lot of features to simplify editing, such as ''content assist'' and ''visual editor''.
  
If you prefer not to use ZK Studio, you could specify the XML schema in a ZUML document as shown below. Many XML editors works better, such as auto-complete, if XML schema is specified correctly.
+
If you prefer not to use ZK Studio, you could specify the XML schema in a ZUML document as shown below. Many XML editors work better, such as when with auto-complete, if XML schema is specified correctly.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 25: Line 25:
 
</source>
 
</source>
 
   
 
   
The ZUL schema can be downloaded from [http://www.zkoss.org/2005/zul/zul.xsd http://www.zkoss.org/2005/zul/zul.xsd]. In addition, you can find <tt>zul.xsd</tt> under the <tt>dist/xsd</tt> directory in the [[ZK Installation Guide/ZK Background/The Content of ZK Binary Distribution|ZK binary distribution]].
+
The ZUL schema can be downloaded from [http://www.zkoss.org/2005/zul/zul.xsd http://www.zkoss.org/2005/zul/zul.xsd]. In addition, you can find <code>zul.xsd</code> under the <code>dist/xsd</code> directory in the [[ZK Installation Guide/ZK Background/The Content of ZK Binary Distribution|ZK binary distribution]].
  
 
This section is about the general use of ZUML. For a complete reference, please refer to [[ZUML_Reference|ZUML Reference]].
 
This section is about the general use of ZUML. For a complete reference, please refer to [[ZUML_Reference|ZUML Reference]].
 
{{ZKDevelopersReferenceHeadingToc}}
 
{{ZKDevelopersReferenceHeadingToc}}
 
{{ZKDevelopersReferencePageFooter}}
 
{{ZKDevelopersReferencePageFooter}}

Latest revision as of 07:14, 22 January 2024

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

The declaration language is called ZK User Interface Markup Language (ZUML). It is based on XML. Each XML element instructs ZK Loader to create a component. 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.

Auto-completion with Schema

When working with a ZUML document, it is suggested to use ZK Studio since it provides a lot of features to simplify editing, such as content assist and visual editor.

If you prefer not to use ZK Studio, you could specify the XML schema in a ZUML document as shown below. Many XML editors work better, such as when with auto-complete, 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 addition, you can find zul.xsd under the dist/xsd directory in the ZK binary distribution.

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



Last Update : 2024/01/22

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