Chapter 3. Creating An Application Using the CLI Tools


When you look inside the unpacked directory of the GWT, as in Figure 1, four of the files represent the toolkit's command-line interface (CLI) tools.

Figure 3-1. The GWT's command-line tools inside the unpacked toolkit


The CLI scripts are designed to be run from a command-line window such as Terminal in Mac OS X. They include:


applicationCreator

This generates the skeleton directory structure for your application.


projectCreator

This script generates a project skeleton, as well as Ant build files or Eclipse projects, according to what the command line specifies.


i18nCreator

This creates some of the files required to use internationalized messages with GWT. The shortcut describes this application aspect in another section.


junitCreator

The script can be used to get you started using JUnit with GWT. A later section describes using this command line tool.

We are using applicationCreator with our application. I opened up a Terminal or CLI window and typed:

 applicationCreator -out /users/bruceperry/1ebooks/gwt -overwrite com.parkerriver.gwt.intro.client.GwtAjax 

This command uses the provided applicationCreator shell script to create a skeleton directory structure. I will use this structure to develop an Ajax application inside a file named GwtAjax.java. The first option with the applicationCreator command, -out, specifies the directory for your application or project (it defaults to the existing directory, the one where applicationCreator resides, which is the top-level directory when you unpack GWT).

The -overwrite option specifies that the command should overwrite any existing files. The final segment is the fully qualified name of the class where your application logic resides, usually representing the "entry point" class.

An entry point is the first screen the user interacts with in the Ajax application, such as a login window or a dashboard.

NOTE

The projectCreator command-line tool will optionally generate an Eclipse project or Ant build file using the -eclipse or -ant options. For example, if your project name is myproject:

 projectCreator -ant myproject -out /users/bruceperry/1gwt/test -overwrite 

this command creates an Ant file that will compile the Java files in /users/bruceperry/1gwt/src into /users/bruceperry/1gwt/bin. The command also creates the /users/bruceperry/1gwt/src and /users/bruceperry/1gwt/test directories.

For more details, see the documentation at: http://code.google.com/webtoolkit/documentation/.projectCreator.html

Figure 2 shows the folders and files that applicationCreator generated.

Figure 3-2. Application setup for a GWT project





Google Web Toolkit for Ajax
Google Web Toolkit GWT Java AJAX Programming: A step-by-step to Google Web Toolkit for creating Ajax applications fast
ISBN: 1847191002
EAN: 2147483647
Year: 2006
Pages: 29

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net