Packing as a Jar"

From Documentation
 
(60 intermediate revisions by 4 users not shown)
Line 2: Line 2:
  
  
== The Jar Archive ==  
+
== Jar Files ==  
 +
Packing a component as a Jar file will make it easy to deployment. This article demonstrates the steps and requirements of it.
  
This step is to pack a jar for our ZK component , and then you can include it to your project or share with others.
 
  
To this we are going to show what a component jar need , and what configuration you can set in the jars.
+
{| class="wikitable"
 +
! style="width: 70%" |
 +
! style="width: 30%" |
 +
|-
 +
|
 +
*Requirements of a component Jar
 +
*:Configurations
 +
*:Component classes
 +
*:Widget Resources
 +
*:Static Resources
 +
|
  
== Config files ==
+
''what do they look like , example from zul.jar''
 +
[[File:Jar_File_summary.jpg]]
  
<pre>
+
|}
----/META-INF/MANIFEST.MF
 
   
 
----/metainfo/mesg/msgzul.properties                              (optional)
 
                              /msgzul_<locale>.properties              (optional ...)
 
 
                    /xml/<component-name>.xsd                      (optional)
 
  
                    /zk/lang.xml                                                  (optional)
+
== Configurations ==
                    /zk/lang-addon.xml 
 
  
</pre>
+
{| class="wikitable"
 +
! style="width: 70%" |
 +
! style="width: 30%" |
 +
|-
 +
|
 +
===File Structure===
 +
*/META-INF/
 +
**MANIFEST.MF 
 +
*/metainfo/
 +
**mesg/
 +
***msg<jar name>.properties'''(optional)'''
 +
***msg<jar name>_<locale>.properties '''(optional ...)'''
 +
**xml/
 +
***<component-name>.xsd    '''(optional)'''
 +
**zk/
 +
***lang.xml  '''(optional)'''
 +
***lang-addon.xml '''(optional)'''
  
'''File descriptions'''
+
===File descriptions===
* META-INF
+
* /META-INF/
 
** MANIFEST.MF
 
** MANIFEST.MF
 
*** ''The file for jar defino''
 
*** ''The file for jar defino''
* metainfo
+
* /metainfo/
** mesg
+
** mesg/
*** msgzul.properties  
+
*** msg<jar name>.properties  
**** ''These files are i18n resource files,you can define with the locale you want , the default file is msgzul.properties. ''
+
**** ''These files are i18n resource files,you can define with the locale you want , the default file is msg<jar name>.properties. '' <br /> [[ZK_Developer%27s_Reference/Internationalization/Warning_and_Error_Messages|ZK Internationalization]]
** xml
+
** xml/
*** <component-name>.xsd   
+
*** <jar-name>.xsd   
**** ''The xml schema for component tags''
+
**** ''The xml schema for component tags in zul''
* zk
+
** tld
** lang.xml  
+
*** config.xml
*** ''The language definition file (ex. "xul/html") , and you can define components here , too.''
+
**** '' For taglibs definition. (ex. zweb.jar use this for dsp.) ''
** lang-addon.xml
+
** zk/
*** ''The language add-on define components with specific language.''
+
*** lang-addon.xml
 +
**** ''The language add-on define components , and it defined the component classes, javascript widget/mold/css. <Br /> it should contains At least one lang.xml or lang-addon.xml '''usually you will need a lang-addon.xml''' . ''
 +
*** lang.xml
 +
**** ''The language definition file with namespace (ex. http://www.w3.org/1999/xhtml for zhtml)''
  
 +
|
 +
'''The example from zul.jar'''
 +
[[File:Jar_File_configuration1.jpg]]
 +
|}
  
* For exmaple.
+
== Component classes ==
 
 
<pre>
 
----/META-INF/MANIFEST.MF
 
   
 
----/metainfo/mesg/msgzul.properties
 
                              /msgzul_en_us.properties
 
                              /msgzul_ca.properties
 
                              /msgzul_ko.properties
 
                              /msgzul_cs.properties
 
                              /msgzul_zh.properties
 
                              /msgzul_zh_tw.properties   
 
                              (......and so on )
 
 
 
                    /xml/simplelabel.xsd
 
                    /zk/lang.xml
 
                    /zk/lang-addon.xml
 
</pre>
 
  
== Component classes ==
+
{| class="wikitable"
 +
! style="width: 70%" |
 +
! style="width: 30%" |
 +
|-
 +
|
 +
===File Structure===
 +
*/package-folder
 +
**classes
  
<pre>
 
  
----/<java-package-folder and classes>
+
===File descriptions===
  
</pre>
+
* ''The java classes of component. just like normal jar file.''
  
 +
|
 +
'''The example from zul.jar'''
 +
[[File:Jar_File_component1.jpg]]
  
* For exmaple.
+
|}
  
<pre>
+
== Widget  Resources ==
  
----/com/foo/SimpleLabel.class
 
                  /events/ClearEvent.class
 
  
</pre>
+
{| class="wikitable"
 +
! style="width: 70%" |
 +
! style="width: 30%" |
 +
|-
 +
|
 +
===File Structure===
 +
*/web/
 +
**js/
 +
***component-package/
 +
****mold/
 +
***** <widget-mold-js-file>
 +
****css/
 +
***** <widget-css-dsp-file>''' (optional)'''
 +
***** <widget-css-file>      '''(optional)'''
 +
****<widget-class-js-file>
 +
****/zk.wpd
  
== Widget  js-class/css/mold ==
+
===File descriptions===
  
<pre>
+
* /web/
 +
** js/
 +
*** <component-package>/
 +
****mold/
 +
***** <widget-mold-js-file>  (ex. simple-label.js )
 +
****** '' Widget mold file , you can write widget's html with javascript function here. ''
 +
**** css/
 +
***** <widget-css-dsp-file> (ex. simple-label.css.dsp )
 +
****** ''The css dsp files ,in the dsp you can use some variable with zk enviroment to write it.''
 +
***** <widget-css-file> (ex. simple-label.css )
 +
****** ''the pure css files.''
 +
**** <widget-class-file>  (ex. Simple-label.js)
 +
***** ''The widget class you write .''
 +
**** zk.wpd
 +
***** ''Define your component's package and widgets here, and the dependency with other package. ''
  
----/web/js/<component-package>/mold/<component-mold-file>.js
 
                                                      /css/<component-css-file>              (optional)
 
                                                      /<component-class-name>.js
 
                                                      /zk.wpd
 
</pre>
 
  
 +
|
  
* For exmaple.
+
'''Example for box from zul.jar '''
 +
[[File:Jar_File_widget1.jpg]]
  
<pre>
+
|}
  
----/web/js/com/foo/mold/simple-label.js
+
== Static Resources ==
                              /css/simple-label.css.dsp
 
                              /simple-label.js
 
                              /zk.wpd
 
  
</pre>
 
  
== Other files ==
+
{| class="wikitable"
+
! style="width: 70%" |
<pre>
+
! style="width: 30%" |
/web/<component-package>/css/zk.wcs                              (optional)
+
|-
                                                    /<css-files>                      (optional)
+
|
                                              /img                                        (optional)
+
===File Structure===
</pre>
 
  
 +
* /web/
 +
** <component-package> /  '''(optional)'''     
 +
*** css /'''(optional)'''
 +
**** <css files>'''(optional)'''                                       
 +
**** zk.wcs'''(optional)'''
 +
*** img /'''(optional)'''
 +
**** <img files>'''(optional)'''
  
'''File descriptions'''
+
===File descriptions===
  
* web
+
* /web/
** <component-package>  
+
** <component-package>/
*** css  
+
*** css/
 +
**** <css files>
 +
*****'' For some static css file you might need. ''
 
**** zk.wcs
 
**** zk.wcs
*****''Let you can config the CSS file for a particular language ''
+
*****''Let you can config the CSS file for particular language ''
*** img  
+
*** img/
**** '' This is a folder for some image files  , and you can access them in xxx.css.dsp files through  ${c:encodeURL('~./img/<component-package>/xxx.png')}   
+
**** <img files>
 +
***** '' This is a folder for some image files  , and you can access them in xxx.css.dsp files through  ${c:encodeURL('~./img/<component-package>/xxx.png')}   
  
 +
|
  
* For exmaple.
+
'''Example from zul.jar'''
  
<pre>
+
[[File:Jar_File_static_resources1.jpg]]
/web/com/foo/zk.wcs                     
 
                      /css/zk.wcs
 
                      /css/xxx.css.dsp
 
                      /img/label-background.png 
 
                      /img/label-background-hover.png   
 
</pre>
 
  
  
{{ZKComponentDevelopmentEssentialsHeadingToc}}
+
|}
  
 
{{ZKComponentDevelopmentEssentialsPageFooter}}
 
{{ZKComponentDevelopmentEssentialsPageFooter}}

Latest revision as of 07:22, 11 August 2011


Packing as a Jar




Jar Files

Packing a component as a Jar file will make it easy to deployment. This article demonstrates the steps and requirements of it.


  • Requirements of a component Jar
    Configurations
    Component classes
    Widget Resources
    Static Resources

what do they look like , example from zul.jar Jar File summary.jpg

Configurations

File Structure

  • /META-INF/
    • MANIFEST.MF
  • /metainfo/
    • mesg/
      • msg<jar name>.properties(optional)
      • msg<jar name>_<locale>.properties (optional ...)
    • xml/
      • <component-name>.xsd (optional)
    • zk/
      • lang.xml (optional)
      • lang-addon.xml (optional)

File descriptions

  • /META-INF/
    • MANIFEST.MF
      • The file for jar defino
  • /metainfo/
    • mesg/
      • msg<jar name>.properties
        • These files are i18n resource files,you can define with the locale you want , the default file is msg<jar name>.properties.
          ZK Internationalization
    • xml/
      • <jar-name>.xsd
        • The xml schema for component tags in zul
    • tld
      • config.xml
        • For taglibs definition. (ex. zweb.jar use this for dsp.)
    • zk/
      • lang-addon.xml
        • The language add-on define components , and it defined the component classes, javascript widget/mold/css.
          it should contains At least one lang.xml or lang-addon.xml usually you will need a lang-addon.xml .
      • lang.xml

The example from zul.jar Jar File configuration1.jpg

Component classes

File Structure

  • /package-folder
    • classes


File descriptions

  • The java classes of component. just like normal jar file.

The example from zul.jar Jar File component1.jpg

Widget Resources

File Structure

  • /web/
    • js/
      • component-package/
        • mold/
          • <widget-mold-js-file>
        • css/
          • <widget-css-dsp-file> (optional)
          • <widget-css-file> (optional)
        • <widget-class-js-file>
        • /zk.wpd

File descriptions

  • /web/
    • js/
      • <component-package>/
        • mold/
          • <widget-mold-js-file> (ex. simple-label.js )
            • Widget mold file , you can write widget's html with javascript function here.
        • css/
          • <widget-css-dsp-file> (ex. simple-label.css.dsp )
            • The css dsp files ,in the dsp you can use some variable with zk enviroment to write it.
          • <widget-css-file> (ex. simple-label.css )
            • the pure css files.
        • <widget-class-file> (ex. Simple-label.js)
          • The widget class you write .
        • zk.wpd
          • Define your component's package and widgets here, and the dependency with other package.


Example for box from zul.jar Jar File widget1.jpg

Static Resources

File Structure

  • /web/
    • <component-package> / (optional)
      • css /(optional)
        • <css files>(optional)
        • zk.wcs(optional)
      • img /(optional)
        • <img files>(optional)

File descriptions

  • /web/
    • <component-package>/
      • css/
        • <css files>
          • For some static css file you might need.
        • zk.wcs
          • Let you can config the CSS file for particular language
      • img/
        • <img files>
          • This is a folder for some image files , and you can access them in xxx.css.dsp files through ${c:encodeURL('~./img/<component-package>/xxx.png')}

Example from zul.jar

Jar File static resources1.jpg




Last Update : 2011/08/11

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