Project Setup

Before we can start developing the invoicing application, we must setup the Java project. In this chapter you will learn to:

Overview of the Downloads and Resources

If you haven't already done so, please download the JDK and the Netbeans IDE. In principle you can use any other IDE, but some essential steps like the GUI-design will work differently, the Ant build scripts must be modified and you cannot make use of the code-generation plugins for Netbeans. If your favorite IDE isn't Netbeans, this is a great opportunity for a test ride...
The tutorial refers to the JDK 1.6 and Netbeans 6.1.
You don't need to be a Netbeans expert to follow this tutorial. All essentials will be explained. However, setting up the JDK and installing Netbeans is beyond the scope of this tutorial. Please refer to the appropriate documentation.
Furthermore, you need the Tentackle framework and the Wurbelizer, which is a code generator used by Tentackle. Both are Open Source as well.
Optionally, you can install some jars for features like office-integration, jdbc-drivers or additional look-and-feels. Recommended are the JGoodies Look-and-Feel and Apache's POI to generate spreadsheet files from tables.
And, of course, you will need to download the tutorial snapshots.
Here are the links to all relevant download URLs:
  1. The current JDK
  2. Netbeans IDE
  3. Tentackle
  4. Tentackle Tutorial
  5. Wurbelizer
  6. JGoodies Look-and-Feel
  7. Apache POI
Which files you need and where to store them in the project directory is covered in the next sections.

Setting up the IDE

Please start the Netbeans-IDE and follow the next steps: Important: The spelling of the library names is relevant because the libraries are referenced from within the Ant scripts by their names (for example: the Tentackle library is refenced by the Ant property ${libs.Tentackle.classpath}).

Next, execute Tools -> Palette Manager -> Swing/AWT-Components. Click on New Category and create a palette named Tentackle. Execute Add from Library and select the Tentackle library. All Tentackle beans will be shown and you should select them all (Ctrl-A), like this:

add beans

Click on Next, select the previously created palette Tentackle and click on Finish. The Tentackle beans are now availabe within the Matisse GUI-Designer.

In a last step we will install the Tentackle templates. Download tentackle_templates.jar, execute Tools -> Template Manager and create a new folder for the Tentackle templates. The recommended name is Tentackle. Close the template manager. From the favorites view expand tentackle_templates.jar. Select all files, except META-INF. Right click on one of the selected files and execute Save as template....

add templates

Select the Tentackle folder and click OK. The templates are now installed.

Setting up the Project Directory

Create an empty project directory of your choice, for example Invoicer. Download and unzip snapshot1.zip into that directory. You should see the following directories and files:

project directories and files

The tutorial is based on a standard Netbeans project-type called Java Application, which has been extended by some Ant-targets for the generation of Java code and sql-scripts. The project contains the following directories and files: Next, download the Tentackle-wurblets to the download directory, go to cg/lib and make sure that it contains three jars that you downloaded already: On Linux- or Unix-Systems it is sufficient to create symbolic links to the jar-files in the download directory. On Windows, you have to copy the files!

Now open the project in Netbeans with File -> Open Project.... The Invoicer-project should open without errors:

project

In a last step we'll create a shortcut to the code-generation target, which we need frequently later in this tutorial. In the Files-tab expand the file build.xml, scroll down and right-click on the wurbel-target and execute Create Shortcut.... A dialog will open:

wurbel shortcut

Check the first three options and follow the instructions. The recommended keyboard shortcut which is used throughout the rest of this tutorial is Ctrl-Shift-F11. Of course, you are free to choose another one.

Prepare the Database Backend

During the rest of the tutorial, we will refer to MySQL as the database backend. However, you are free to use other databases as well. Tentackle supports the major databases out-of-the-box. Currently supported are: The database type is easily configured in cg/codegen.properties by setting the property dbtype. Note that this property is only necessary for generating the database-dependent SQL scripts (to create tables or to migrate to an updated data model). It does not affect in any way the Java code or the application at runtime, because Tentackle applications are database agnostic.

Adding support for other databases is possible, but beyond the scope of this tutorial. So you better stick to one of the above.

Please create a database named invoicer and make sure that there is a user with sufficient privileges.

Congratulations! The project has been successfully setup.

... Here we go ... >



Notes