GWT Project Code

The code for complete project covered in this tutorial can be downloaded from GitHub

Source code of the GWT project is archived into part-1.zip, part-2.zip etc., corresponding to parts of the book. Each archive contains Chapter or Section wise code. Instead of sifting through a fully developed project, chapter/section wise code helps one to understand the source without much effort. Download section also contains a standalone java application, RStore, which is used to load the data to database in Part 2 of the book.. Download the relevant archives and use them as explained below.

Project - Fins

It is essential to go through the initial three chapters of the tutorial before attempting to run the project code. Some chapters/sections like 6.3 Title Panel, Google Charts, Chapter 9 DAO etc., requires some additional setup. In case of errors, refer the respective chapter or section.

Import Fins Code

Sample code is zipped into part-1.zip, part-2.zip etc., Use them for respective parts of the book. Please note that zips are just source code and not Eclipse project. It is essential to go through the first three chapters of the tutorial and create the GWT project as explained in those chapters and then import the source code as explained below.

Download the zip files from Fins Code tab of the site and unzip the archive to some location. Next, select Fins Project in Project Explorer and choose FileImport and in Select window expand General and select File System and click Next. In File System window, browse and select the location where you have extracted the archive. Extracted archive contains Chapter and Section folders and out of them, select the desired Chapter (ch- prefix) or Section ( sec- prefix) folder. Select src and war folders checkbox as shown in the next figure. In Into Folder field, enter fins. Check Overwrite existing resources, but deselect the Create top-level folder and click Finish. Now project has the source up to the end of that chapter or section.

Sample selection
Figure 5.3. Sample selection

 

For many of us browsing full blow source code is bit tedious and hence incremental source code are placed into Chapter and Section folders in the zip. If you are comfortable in browsing the full blown source, then you free to select src and war from full-code folder which imports source as at end of that part of the book.

After code is imported, clean the project using ProjectClean . This rebuilds all classes under war/WEB-INF/classes. Project may throw strange errors if old classes are lying around in that directory.

GWT compiler uses gwt-unitCache dir under project directory to speed-up the compile. After source import, delete gwt-unitCache dir else GWT may use earlier compilation units from cache. This step is only applicable when you import Fins code as file time-stamp may not be in proper order. No need to do this when you develop your own app except as a last resort.

 

 
 

Project - RStore

RStore is used in Part 2 of the book to load the data to database.

Prepare RStore project

Download RStore.zip from the book site. Create a regular Java project named rstore with default settings. Select the project in Project Explorer and choose FileImport. In Import dialog, expand general and choose Archive File and import RStore.zip into folder rstore.

Dependencies

RStore requires HSQLDB, Data Nucleus JDO, MyBatis and Hibernate libraries. Following table lists the dependencies.

 

Table 8.1. Dependencies
CommonJDOHibernateMyBatis
hsqldb-2.2.9.jarjdo-api-3.0.1.jarhibernate-commons-annotations-4.0.1.Final.jarmybatis-3.2.0.jar
commons-lang-2.6.jardatanucleus-api-jdo-3.1.3.jarhibernate-core-4.1.10.Final.jar
log4j-1.2.16.jardatanucleus-core-3.1.4.jarhibernate-jpa-2.0-api-1.0.1.Final.jar
datanucleus-rdbms-3.1.4.jarjboss-logging-3.1.0.GA.jar
datanucleus-enhancer-3.1.1.jarjboss-transaction-api_1.1_spec-1.0.0.Final.jar
asm-4.0.jarantlr-2.7.7.jar
dom4j-1.6.1.jar
javassist-3.15.0-GA.jar

 

Table 8.2. Download URL
CommonJDOHibernateMyBatis
Download zip for rdbms and extract. lib/ dir contains required jars.
lib/required contains all the jars
Download Core Framework zip

 

Download the packages and place the essential jars in projects lib directory. Also add the jars to project build path.

 
 

 

Automatic Dependency Management

That’s a handful of downloads. Rather than struggling with downloads, it makes a lot of sense to use dependency management software like Maven or Apache Ivy.

Maven is the leader in this space, but if you are in a hurry then go for Apache Ivy, which is equally powerful. Apache Ivy is quite easy to start with, requires zero configuration and comes with a Plugin for Eclipse.

With Eclipse Plugin, IvyDE, you may shift to automatic dependency management in just under ten minutes. All you have to do is, install IvyDE plugin and add the ivy.xml file, which is in the root folder of RStore project, as Ivy Library. That’s all, Ivy downloads all the dependencies and adds them to project. It also updates project build path, links package’s API documentation and source. In case jars are deleted from project workspace, it restores them from its cache to keep the project in shipshape. Refer ApacheIvy for quick start.