Widget Package Descriptor"

From Documentation
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{ZKClient-sideReferencePageHeader}}
 
{{ZKClient-sideReferencePageHeader}}
  
<blockquote>
+
This section describes what a '''Widget Package Descriptor''' is. This is required for the component. However, you could skip it if you do not have to develop components. For more information about component development, please refer to [[ZK Component Development Essentials]].
----
+
 
This section describes what a Widget Package Descriptor is. This is required for the component.However, you could skip it if you won't develop components. For more information about component development, please refer to [[ZK Component Development Essentials]].
 
</blockquote>
 
  
 
The Widget Package Descriptor (WPD) is a file describing the information of a package, such as its widget classes and external JavaScript files. WPD must be named '''zk.wpd''' and placed in the same directory as the widget classes. For example we would place it under '''web/js/com/foo'''.
 
The Widget Package Descriptor (WPD) is a file describing the information of a package, such as its widget classes and external JavaScript files. WPD must be named '''zk.wpd''' and placed in the same directory as the widget classes. For example we would place it under '''web/js/com/foo'''.
  
Below an example '''zk.wpd''' of our SimpleLabel.
+
Below is an example <code>zk.wpd</code> of our <code>SimpleLabel</code>.
  
 
<source lang="xml">
 
<source lang="xml">
Line 19: Line 17:
 
The table below describes the elements used within the above XML and their descriptions.
 
The table below describes the elements used within the above XML and their descriptions.
  
{| border="1"
+
{| class='wikitable'
 
! Name !! Description
 
! Name !! Description
 
|-
 
|-
Line 30: Line 28:
  
  
Having created the configuration the basic implementation of our component is complete. However it doesn』t have any interactive events. Therefore the next logical step is to start adding events to the component.
+
Having created the configuration the basic implementation of our component is complete. However it doesn't have any interactive events. Therefore the next logical step is to start adding events to the component.
  
 
= Package Dependence =
 
= Package Dependence =
  
It is common for JavaScript packages to depend on another package. For example, <tt>zul.grid</tt> depends on <tt>zul.mesh</tt> and <tt>zul.menu</tt>. This can easily be specified by placing them within the <tt>depends</tt> attribute as follows.
+
It is common for JavaScript packages to depend on another package. For example, <code>zul.grid</code> depends on <code>zul.mesh</code> and <code>zul.menu</code>. This can easily be specified by placing them within the <code>depends</code> attribute as follows.
  
 
<source lang="xml">
 
<source lang="xml">
Line 50: Line 48:
 
= Including additional JavaScript files =
 
= Including additional JavaScript files =
  
If a JavaScript package has to include other JavaScript files, this can be done easily by specifying the file with the <tt>script</tt> element. For example, the following is the content of <tt>zul.db</tt>'s WPD:
+
If a JavaScript package has to include other JavaScript files, this can be done easily by specifying the file with the <code>script</code> element. For example, the following is the content of <code>zul.db</code>'s WPD:
  
 
<source lang="xml">
 
<source lang="xml">

Latest revision as of 10:12, 24 January 2022


DocumentationZK Client-side ReferenceWidget Package Descriptor
Widget Package Descriptor



This section describes what a Widget Package Descriptor is. This is required for the component. However, you could skip it if you do not have to develop components. For more information about component development, please refer to ZK Component Development Essentials.


The Widget Package Descriptor (WPD) is a file describing the information of a package, such as its widget classes and external JavaScript files. WPD must be named zk.wpd and placed in the same directory as the widget classes. For example we would place it under web/js/com/foo.

Below is an example zk.wpd of our SimpleLabel.

<package name="com.foo" language="xul/html">
	<widget name="SimpleLabel"/>
</package>


The table below describes the elements used within the above XML and their descriptions.

Name Description
package The root element denotes the package name and the language it belongs to
widget The widget class name (without the package name). If the package contains multiple widgets list them one by one


Having created the configuration the basic implementation of our component is complete. However it doesn't have any interactive events. Therefore the next logical step is to start adding events to the component.

Package Dependence

It is common for JavaScript packages to depend on another package. For example, zul.grid depends on zul.mesh and zul.menu. This can easily be specified by placing them within the depends attribute as follows.

<package name="zul.grid" language="xul/html" depends="zul.mesh,zul.menu">
	<widget name="Column"/>
	<widget name="Columns"/>
	<widget name="Grid"/>
	<widget name="Row"/>
	<widget name="Rows"/>
	<widget name="Foot"/>
	<widget name="Footer"/>
</package>

Including additional JavaScript files

If a JavaScript package has to include other JavaScript files, this can be done easily by specifying the file with the script element. For example, the following is the content of zul.db's WPD:

<package name="zul.db" language="xul/html" depends="zk.fmt,zul.inp">
	<script src="datefmt.js"/>
	<widget name="Calendar"/>
	<widget name="Datebox"/>
</package>




Last Update : 2022/01/24

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