Diff for /books/www/chapters/appb.html between versions 1.1 and 1.2

version 1.1, 2002/09/17 21:10:35 version 1.2, 2002/09/23 15:23:31
Line 7 Line 7
 <P>Mozilla does not yet have a full set of development tools, but currently several development projects help with part of the application creation process. These tools don't make up a full-featured development environment, but they are useful. They also point the way to an area in Mozilla development that has a bright future and is worth watching.  <P>Mozilla does not yet have a full set of development tools, but currently several development projects help with part of the application creation process. These tools don't make up a full-featured development environment, but they are useful. They also point the way to an area in Mozilla development that has a bright future and is worth watching.
 <P>This appendix describes some of the new tools--including XULKit, Patch Maker, the DOM Inspector, the JavaScript Debugger, and MozillaTranslator--that are already becoming a part of the regular repertoire of Mozilla developers. By learning about how to use these tools for your own project, you can radically simplify the application development process, especially when you combine these tools.  <P>This appendix describes some of the new tools--including XULKit, Patch Maker, the DOM Inspector, the JavaScript Debugger, and MozillaTranslator--that are already becoming a part of the regular repertoire of Mozilla developers. By learning about how to use these tools for your own project, you can radically simplify the application development process, especially when you combine these tools.
 <H2><A NAME="77022"></A> XULKit</H2>  <H2><A NAME="77022"></A> XULKit</H2>
<P>Much of the manual  <!--INDEX STARTRANGE--XULKit development tools -->  <!--INDEX STARTRANGE--development:tools:XULKit --> editing described in Chapters <A HREF="ch06.htm#15291">6</A>, <A HREF="ch07.htm#70326">7</A>, and <A HREF="ch08.htm#78382">8</A> can be automated with special scripts and templates being developed in the Mozilla source tree's <I>tools/wizards</I> section (these files are referred to collectively as the XULKit and can be found at <I><A HREF="http://www.hacksrus.com/~ginda/xulkit/doc/">http://www.hacksrus.com/~ginda/xulkit/doc/</A></I>).<P>Much of the manual  <!--INDEX STARTRANGE--XULKit development tools -->  <!--INDEX STARTRANGE--development:tools:XULKit --> editing described in 
 Chapters <A HREF="ch06.html#15291">6</A>, <A HREF="ch07.html#70326">7</A>, and <A HREF="ch08.html#78382">8</A> can be automated with special 
 scripts and templates being developed in the Mozilla source tree's <I>tools/wizards</I> section (these files are referred to collectively as the XULKit and can be found at <I><A HREF="http://www.hacksrus.com/~ginda/xulkit/doc/">http://www.hacksrus.com/~ginda/xulkit/doc/</A></I>).
 <P>These tools help you develop your Mozilla application by generating as much of the basic content, structure, and packaging of an application as possible, leaving you free to work only on the aspects of your application that you care about. We mention XULKit first because it can make setting up new Mozilla applications a snap.  <P>These tools help you develop your Mozilla application by generating as much of the basic content, structure, and packaging of an application as possible, leaving you free to work only on the aspects of your application that you care about. We mention XULKit first because it can make setting up new Mozilla applications a snap.
 <P>XULKit is essentially a set of two scripts: <I>new-from-template.pl</I>, which creates a new application framework, and <I>makexpi.pl</I>, which packages your application once you finish developing it.  <P>XULKit is essentially a set of two scripts: <I>new-from-template.pl</I>, which creates a new application framework, and <I>makexpi.pl</I>, which packages your application once you finish developing it.
 <H3><A NAME="77023"></A> new-from-template.pl Script</H3>  <H3><A NAME="77023"></A> new-from-template.pl Script</H3>
 <P>Though it's not named very elegantly, the <I> <!--INDEX new-from-template.pl Perl script (XULKit) -->  <!--INDEX scripts:new-from-template.pl --> new-from-template.pl</I> Perl script takes information you provide in the form of a simple text file and uses it to create various parts of a Mozilla application. These parts include the XUL content, which has a basic menubar you can add to; an overlay that puts an item for your application into the Tools menu in the Mozilla browser; CSS for your XUL; and an installation script for the application package. You can base your application off of a couple of different templates, including a sophisticated one that lets you generate XPCOM interfaces for components you wish to use in your application, described below.  <P>Though it's not named very elegantly, the <I> <!--INDEX new-from-template.pl Perl script (XULKit) -->  <!--INDEX scripts:new-from-template.pl --> new-from-template.pl</I> Perl script takes information you provide in the form of a simple text file and uses it to create various parts of a Mozilla application. These parts include the XUL content, which has a basic menubar you can add to; an overlay that puts an item for your application into the Tools menu in the Mozilla browser; CSS for your XUL; and an installation script for the application package. You can base your application off of a couple of different templates, including a sophisticated one that lets you generate XPCOM interfaces for components you wish to use in your application, described below.
<P>Using these scripts, you can add content and logic to your application, restyle it, or build your application however you would like. You can also register the resulting directory with the chrome registry to see it working in your local copy of Mozilla, and when you finish developing it, the application directory is already structured in exactly the way it must be to be checked into the Mozilla source tree's extensions directory (if you want to check it into this common location for applications that become a part of Mozilla). When you want to distribute your application as described in <A HREF="ch06.htm#77063">Chapter 6</A>, you can use the other script in the XULKit, <I>makexpi.pl</I>, to package your application files into a cross-platform archive that can be installed from a regular web page.<P>Using these scripts, you can add content and logic to your application, restyle it, or build your application however you would like. You can 
 also register the resulting directory with the chrome registry to see it working in your local copy of Mozilla, and when you finish developing it, the application directory is already structured in exactly the way it must be to be checked into the Mozilla source tree's extensions directory (if you want to check it into this common location for applications that become a part of Mozilla). When you want to distribute your application as described in <A HREF="ch06.html#77063">Chapter 6</A>, you can use the other script in the XULKit, <I>makexpi.pl</I>, to package your application files into a cross-platform archive that can be installed from a regular web page.
 <P>To use the <I>new-from-template.pl</I> script, point it at a template that you filled out with your own information. It then generates the basic application code in the appropriate subdirectory structure:  <P>To use the <I>new-from-template.pl</I> script, point it at a template that you filled out with your own information. It then generates the basic application code in the appropriate subdirectory structure:
 <PRE>new-from-template.pl      -t FILE [-o DIRECTORY] [-f[d]] [-h] [-?]</PRE>  <PRE>new-from-template.pl      -t FILE [-o DIRECTORY] [-f[d]] [-h] [-?]</PRE>
 <P>When you run the script, the XULKit creates a new top-level application directory. In this directory, the script creates the three main package directories, and it places some basic content in each one: a CSS file called <I>mozreg.css</I> in the <I>skins</I> subdirectory, a few XUL files in the <I>content</I> directory (including the overlay that defines a new menu item for the main browser that opens this new application), and localizable data in the <I>mozref.dtd</I> file in the <I>locale</I> subdirectory.  <P>When you run the script, the XULKit creates a new top-level application directory. In this directory, the script creates the three main package directories, and it places some basic content in each one: a CSS file called <I>mozreg.css</I> in the <I>skins</I> subdirectory, a few XUL files in the <I>content</I> directory (including the overlay that defines a new menu item for the main browser that opens this new application), and localizable data in the <I>mozref.dtd</I> file in the <I>locale</I> subdirectory.
<P>In addition to these files, the XULKit script creates <I>contents.rdf</I> files that describe each package, some Makefiles that instruct the Mozilla build process how to integrate this application into the build (which is a later step and not necessary to run the application), and an <I>install.js</I> file that executes the installation of this application when it appears in a XPI. (See <A HREF="ch06.htm#77063">Chapter 6</A> for more information about XPI, Mozilla's cross-platform installation file format.)<P>In addition to these files, the XULKit script creates <I>contents.rdf</I> files that describe each package, some Makefiles that instruct the 
 Mozilla build process how to integrate this application into the build (which is a later step and not necessary to run the application), and an <I>install.js</I> file that executes the installation of this application when it appears in a XPI. (See <A HREF="ch06.html#77063">Chapter 6</A> for more information about XPI, Mozilla's cross-platform installation file format.)
 <P>If you look at Example B-1-<I>xul-app.tpl</I>, which comes with the distribution of <I>new-from-template.pl-</I>you can see how easy it is to fill out the basic information and create your own template.  <P>If you look at Example B-1-<I>xul-app.tpl</I>, which comes with the distribution of <I>new-from-template.pl-</I>you can see how easy it is to fill out the basic information and create your own template.
   
 <P><I>Example B-1: <A NAME="77016"></A></I>  <P><I>Example B-1: <A NAME="77016"></A></I>
Line 102  ${interface_name}, ${interface_guid}</PR Line 106  ${interface_name}, ${interface_guid}</PR
 <TR><TD> -r REVISION</TD>       <TD>  Specifies the value of the </TD><I>${revision}</I> variable. This specification overrides any value specified in the configuration file and defaults to ``0.01''. Typically, this number is used in the <I>install.js</I> script and as part of the XPI filename.</TR>  <TR><TD> -r REVISION</TD>       <TD>  Specifies the value of the </TD><I>${revision}</I> variable. This specification overrides any value specified in the configuration file and defaults to ``0.01''. Typically, this number is used in the <I>install.js</I> script and as part of the XPI filename.</TR>
 <TR><TD> -?</TD>        <TD>  Shows usage information and exits.</TD></TR></TABLE><P>  <TR><TD> -?</TD>        <TD>  Shows usage information and exits.</TD></TR></TABLE><P>
   
<P>When you run the script against the configuration file, you end up with two separate pieces-the XPI in which your application and its installation script are stored and a web page that you can post on a server to guide the XPI's installation. As described in <A HREF="ch06.htm#77063">Chapter 6</A>, the web page interacts with the XPI's <I>install.js</I> to install and register your application in Mozilla. If you start your application with the <I>new-from-template.pl</I> script, then a template-processed version of <I>install.js</I> that works with your application is included as <I>templates/xpi/install.js</I> as part of the XULKit package.<P>When you run the script against the configuration file, you end up with two separate pieces-the XPI in which your application and its 
 installation script are stored and a web page that you can post on a server to guide the XPI's installation. As described in <A HREF="ch06.html#77063">Chapter 6</A>, the web page interacts with the XPI's <I>install.js</I> to install and register your application in Mozilla. If you start your application with the <I>new-from-template.pl</I> script, then a template-processed version of <I>install.js</I> that works with your application is included as <I>templates/xpi/install.js</I> as part of the XULKit package.
 <H3><A NAME="77026"></A> Using XULKit</H3>  <H3><A NAME="77026"></A> Using XULKit</H3>
 <P>Given these two scripts and the templates that go with them, the XULKit encourages and makes the following application development workflow possible:  <P>Given these two scripts and the templates that go with them, the XULKit encourages and makes the following application development workflow possible:
 <OL><P><LI>Fill out a <I>new-from-template.pl</I> template with your application information.<P>  <OL><P><LI>Fill out a <I>new-from-template.pl</I> template with your application information.<P>
Line 176  ${interface_name}, ${interface_guid}</PR Line 181  ${interface_name}, ${interface_guid}</PR
 <I>The DOM inspector interface</I>  <I>The DOM inspector interface</I>
   
 <P>As you click on the nodes in the tree in the left panel, the DOM Inspector highlights the nodes that are part of the visible interface by pointing them out with a blinking red border. You can peck through the tree in the DOM Inspector and find all parts of the interface.  <P>As you click on the nodes in the tree in the left panel, the DOM Inspector highlights the nodes that are part of the visible interface by pointing them out with a blinking red border. You can peck through the tree in the DOM Inspector and find all parts of the interface.
<P>The DOM Inspector also displays any anonymous content that is part of the window. See <A HREF="ch07.htm#77027">Chapter 7</A> for information about anonymous content and the way it relates to the DOM. The anonymous content nodes that are bound to the window you specify become part of the DOM that the Inspector reads and can be analyzed and manipulated like any other node.<P>The DOM Inspector also displays any anonymous content that is part of the window. See <A HREF="ch07.html#77027">Chapter 7</A> for information 
 about anonymous content and the way it relates to the DOM. The anonymous content nodes that are bound to the window you specify become part of the DOM that the Inspector reads and can be analyzed and manipulated like any other node.
 <P>The pull-down widgets to the left of the pane headers let you select which portions of the DOM are displayed in the panels. By default, the DOM nodes are displayed, as shown in Figure B-1, but you can also display the associated stylesheets, the Java-Script objects, the XBL bindings, the document's box model, and other information.  <P>The pull-down widgets to the left of the pane headers let you select which portions of the DOM are displayed in the panels. By default, the DOM nodes are displayed, as shown in Figure B-1, but you can also display the associated stylesheets, the Java-Script objects, the XBL bindings, the document's box model, and other information.
 <H2><A NAME="77032"></A> The Component Viewer</H2>  <H2><A NAME="77032"></A> The Component Viewer</H2>
 <P>The  <!--INDEX Component Viewer development tool -->  <!--INDEX development:tools:Component Viewer --> Component Viewer is a Mozilla application that displays all components and interfaces available to the XPCOM developer on the Mozilla platform. It is not installed by default in the Mozilla browser, like the DOM Inspector, but you can get binary installations that have it or you can build it from <I>mozilla/extensios/cview</I> if you use CVS.  <P>The  <!--INDEX Component Viewer development tool -->  <!--INDEX development:tools:Component Viewer --> Component Viewer is a Mozilla application that displays all components and interfaces available to the XPCOM developer on the Mozilla platform. It is not installed by default in the Mozilla browser, like the DOM Inspector, but you can get binary installations that have it or you can build it from <I>mozilla/extensios/cview</I> if you use CVS.
Line 230  ${interface_name}, ${interface_guid}</PR Line 236  ${interface_name}, ${interface_guid}</PR
 <P><LI>Type cont.<P>  <P><LI>Type cont.<P>
 <P>The <TT>cont</TT> command continues execution. The context menu should pop up as it always  <!--INDEX ENDRANGE--Venkman development tool -->  <!--INDEX ENDRANGE--development:tools:Venkman --> does.<P></OL>  <P>The <TT>cont</TT> command continues execution. The context menu should pop up as it always  <!--INDEX ENDRANGE--Venkman development tool -->  <!--INDEX ENDRANGE--development:tools:Venkman --> does.<P></OL>
 <H2><A NAME="77034"></A> MozillaTranslator</H2>  <H2><A NAME="77034"></A> MozillaTranslator</H2>
<P><A HREF="ch11.htm#77028">Chapter 11</A> provides <!--INDEX MozillaTranslator development tool -->  <!--INDEX development:tools:MozillaTranslator -->  information about how to make a Mozilla application usable in many different languages. Localizing an application can be simple if your application is small. For large applications, though, localizing can be a long and complicated process. Fortunately, interested and enthusiastic developers created a tool that makes this process easier.<P><A HREF="ch11.html#77028">Chapter 11</A> provides <!--INDEX MozillaTranslator development tool -->  <!--INDEX 
 development:tools:MozillaTranslator -->  information about how to make a Mozilla application usable in many different languages. Localizing an application can be simple if your application is small. For large applications, though, localizing can be a long and complicated process. Fortunately, interested and enthusiastic developers created a tool that makes this process easier.
 <P>MozillaTranslator is a program written in Java that reads in a package, provides an interface for changing the strings, and when finished, repackages the files for distribution. It is sophisticated enough to read JAR archives and output cross-platform installers (XPI). This type of solution is ideal for nontechnical people who translate the interface strings.  <P>MozillaTranslator is a program written in Java that reads in a package, provides an interface for changing the strings, and when finished, repackages the files for distribution. It is sophisticated enough to read JAR archives and output cross-platform installers (XPI). This type of solution is ideal for nontechnical people who translate the interface strings.
 <BLOCKQUOTE><CENTER><B>NOTE</B></CENTER>  <BLOCKQUOTE><CENTER><B>NOTE</B></CENTER>
 <P>MozillaTranslator is more than just a program for inputting translated strings. The web site (<I><A HREF="http://www.MozillaTranslator.org/">http://www.MozillaTranslator.org/</A></I>) has resources for setting up projects, uploading language packs, and finding the latest news on localization issues among other features.<P></BLOCKQUOTE>  <P>MozillaTranslator is more than just a program for inputting translated strings. The web site (<I><A HREF="http://www.MozillaTranslator.org/">http://www.MozillaTranslator.org/</A></I>) has resources for setting up projects, uploading language packs, and finding the latest news on localization issues among other features.<P></BLOCKQUOTE>

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>