The Widget Package Descriptor"

From Documentation
(Including additional JavaScript files)
Line 28: 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.
  
= depends =
+
= Package Dependence =
  
 
It is common that a JavaScript package depends on other package. For example, <tt>zul.grid</tt> depends on <tt>zul.mesh</tt> and <tt>zul.menu</tt>. It can be done easily by specifying them in the <tt>depends</tt> attribute as follows.
 
It is common that a JavaScript package depends on other package. For example, <tt>zul.grid</tt> depends on <tt>zul.mesh</tt> and <tt>zul.menu</tt>. It can be done easily by specifying them in the <tt>depends</tt> attribute as follows.
Line 44: Line 44:
 
</source>
 
</source>
 
{{ZKComponentDevelopmentEssentialsPageFooter}}
 
{{ZKComponentDevelopmentEssentialsPageFooter}}
 +
 +
= Including additonal JavaScript files =
 +
 +
If a JavaScript package has to include other JavaScript files, it 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:
 +
 +
<source lang="xml">
 +
<package name="zul.db" language="xul/html" depends="zk.fmt,zul.inp">
 +
<script src="datefmt.js"/>
 +
<widget name="Calendar"/>
 +
<widget name="Datebox"/>
 +
</package>
 +
</source>

Revision as of 08:07, 14 July 2010


The Widget Package Descriptor



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.

<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 that a JavaScript package depends on other package. For example, zul.grid depends on zul.mesh and zul.menu. It can be done easily by specifying them in 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>


Last Update : 2010/07/14

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


Including additonal JavaScript files

If a JavaScript package has to include other JavaScript files, it 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>