Dear visitor,
welcome to the tutorial to develop a Fat-Client application in Java !

However you were guided to this site, maybe by mere accident or by a recommendation, you will find the documentation about my method to develop 'Fat-Clients' in Java.
As commercial programs usually work with persistant data, they need an access to a database.
The documentation shows, how database access can be directly integrated into the 'Fat-Client' or the 'Fat-Client' uses EJBs running on a Java-Application-Server (JAS) which are responsible for database-access.

If this documentation helps you to learn how to utilize this technology I am pleased !

The J2EE-developer:
Kurt Gstöttner - Information-Technology with Java
To write me an E-Mail, please click onto the hungry mailbox in the upper left corner.

If you are looking for the step-by-step guideline to develop a Fat-Client in Java, you may directly skip to this document.

* For this document and all references (links) please obey the hints and regulations concerning copyright, disclaimer and trademarks.

  • The owner of this web-site (www.javascout.biz) is not responsible for the content of web-sites linked within this document or linked within other documents of www.javascout.biz.

  • If this document or other documents of this web-site (www.javascout.biz) infringes your rights or you think that rights of others (third parties) are infringed, please inform the author.
    An e-mail can be sent by clicking onto the 'hungry mailbox' in the upper right corner.

Last revision of this document:
2007-01-31

Prerequisites:

General scheme of the Fat-Client architecture:

When the Java-Application is started, the main function contains the code to create a Frame of type JFrame.

Within the Constructor of the Frame, the function initialize is called.
Within initialize,

  • first some prerequisites have to be set up;
    e.g. the xml-file with the text-element have to be loaded and the connection to the database or the Java-Application-Server has to be established;

  • then the Frame (called 'Command-Center' in this tutorial) is displayed.

Thereafter the 'Command-Center' is waiting for an user-interaction.

After the user has decided what to do (and choosing the right selection), another Frame of Type JFrame is created.

Depending on the intention (and correct implementation) of this Frame (furthermore called 'Task-Frame'), the user can fulfill the proposition.

Contents:

The following table shows you the steps to develop a 'Fat-Client' that maintains error-messages in a database and produces a file in xml-format that contains the data.
As sidesteps the code in the base-classes (that is inhereted from the application that is developed in this tutorial) will be explained.

Furtheron, the locally connected database will be connected to an EJB (Enterprise Java Bean) running in an application server and the 'Fat-Client' will be expanded by code to maintain the data using the EJB instead of directly writing to / reading from the locally connected database.

As final task, the data is written out into a file in xml-format and in the base-classes is implemented, that an 'Error-Dialog' can be called.

Tutorial

Task

Prerequisites

Basic knowledge for developing Fat-Clients with Java

Index of the tutorials with base-knowledge for developing Fat-Clients with Java.
This 'task' is not a prerequisite for tasks following up - it is a link to the index for Architectural Decisions, Structure of XML-files and code of the base-classes.

None

JS_ErrDB_CommandCenter,
JS_ErrDB_CommandCenter__ActionHandler,

JS_ErrDB_Project,
JS_ErrDB_Project_BO,
JS_ErrDB_Project_BOC,
JS_ErrDB_Project_BOS,
JS_ErrDB_Project_DBA,
JS_ErrDB_Project_Set_BO,
JS_ErrDB_Project_Set_BOC,
JS_ErrDB_Project_Set_BOS,

JS_ErrDB_Project_Set_DBA,

Index of the documents with complete code developed for this tutorial.
Not a prerequisite for the following steps - just a reference !

For a list of Code for the Base-Classes, please follow this link.

None

DisplayStrings.xml,

Index of the files with the XML-structures to control various parts of the application.

None


Description of the database-table to understand the values used for the 'Error-Dialog' later on.

None

JS_FC01b - Create a new workspace and the Project in Eclipse

Create a new workspace in Eclipse.
This is recommended as there will be several 'Projects' created and it is not advisible to mix 'Projects' which have not much in common.
After the workspace is created, create a new Project.

Eclipse installed.

JS_FC01ca - Create a project for the base-classes.
or

JS_FC01cb - Download the jar-file for the base-classes.

Depending
* if you want to develop the base classes in parallel,
then a project for the base-classes has to be created and defined in the 'Java Build Path'
* if you want to use the jar-file with the base-classes,
then the jar-file has to be defined in the 'Java Build Path' .

JS_FC01b - Create a new workspace and the Project in Eclipse completed - and its prerequisites too.

JS_FC01d - Create and code the class for the GUI.

A very simple Graphic User Interface is created.
This is a prerequisite to test the code implemented in the following steps.

JS_FC01ca - Create a project for the base-classes or JS_FC01cb - Download the jar-file for the base-classes completed - and its prerequisites too.

Recommended:
JS_Base02 - DataBase-Loader with a GUI completed.
This is not absolutely a prerequisite but gives you a more indepth knowledge about developing an application with a GUI.

JS_FC01e - Universal structure for parameters and getting the directory-names

A step with no visible result.
A structure with variables for internal use is introduced and implemented.
Part of this step is to determine in which subdirectory the files for the application are stored and to build the names of the subdirectories with various content.

JS_FC01d - Create and code the class for the GUI. completed - and its prerequisites too.

Recommended:
Directory Architecture read.
This introduces the - fixed - names for the subdirectories and their content.

JS_FC01f - Base-Class for reading a file with XML-structure

This step deals with Java-libraries to read files containing data in xml-format and to search within the xml-structure.

JS_FC01e - Universal structure for parameters and getting the directory-names completed - and its prerequisites too.

Recommended:
Structure of the xml-file with language-dependant strings for the user-interface read.
This introduces the structure of the xml-tree with text-elements for the GUI.
Base lesson 2, step 3 - Read parameters for the connection to the database implemented or read at least.

JS_FC01g - Setting the properties of the GUI-elements

The ability to call methods recursively is used to 'pass by' all GUI-elements of the frame, determine their type (JFrame, JLabel, JText, etc) and search the XML-structure for language dependant text for the processed GUI-element.

JS_FC01f - Base-Class for reading a file with XML-structure completed - and its prerequisites too.

Recommended:
Structure of the xml-file with language-dependant strings for the user-interface read.
This introduces the structure of the xml-tree with text-elements for the GUI.

Building a GUI in Java using Panels read.
This introduces the tree-structure (parent-child-relationship) of elements forming a GUI in Java.

JS_FC01h - Setting the properties of the GUI-elements, Part 2

The setting of properties, which was shown for JFrame in the previous step, is extended to JLabel, JTextField and JButton.

JS_FC01g - Setting the properties of the GUI-elements completed - and its prerequisites too.

JS_FC01i - Create and code the class for the 'Task-Frame' to maintain 'Projects'.

A Graphic User Interface to maintain 'Projects' is created.
The 'Task-Frame' is a child of the 'Command-Center', created by the click onto the button and has a user-interface to add or delete project-codes and -descriptions.
For a description, how 'Projects' are placed within the whole data-model please refer to <Database-description>

JS_FC01h - Setting the properties of the GUI-elements, Part 2 completed - and its prerequisites too.

JS_FC01j – Develop the Base Class for Business Objects

Warning:
The steps to to make data persistent (or in other words: store it on a database) are pretty long without seeing a result – but the job has to be done.
To make the lessons less boring, somewhere in the middle the debugger is used to verify, if the transfer of the text from the GUI-elements to the variables of the Business Object works as expected.

For some theory please consult Using Business Objects to handle data-storage and -retrieval .

This lesson starts with creating a Base Class for Business Objects.

In fact, this step is independant from previous steps;
recommended is, that JS_FC01i - Create and code the class for the 'Task-Frame' to maintain 'Projects'. is completed - and its prerequisites too.
So, in one of the following steps, the debugger can be used to verify if the code works as expected.

JS_FC01k – Develop the General Class for the Business Object 'Project'

The General Class of a Business Object contains the variables and all methods that are needed on both the Server-Side and the Client-Side of the application.
For a more detailed description of the General Class of a Business Object please see Business Object, General Class – Advanced Java Fat-Client-Development.

JS_FC01j – Develop the Base Class for Business Objects completed - and its prerequisites too.

JS_FC01l – Develop the Client-Side Class for the Business Object 'Project'

The Client-Side Class of a Business Object is an extension of the General Class and contains methods that are only needed on the Client-Side of an application.
In this step, emphasis is on using the debugger to verify that the text of the GUI-elements is transferred to the variables of the Business Object.
For a more detailed description of the Client-Side Class of a Business Object please see Business Object, Client-Side Class – Advanced Java Fat-Client-Development.

JS_FC01k – Develop the General Class for the Business Object 'Project' completed - and its prerequisites too.

JS_FC01m – Develop the Data-Base-Access (DBA) Object for the table 'Project'

The Data-Base-Access (DBA) Object is the low-level implementation to perform SQL-operations toward the database.
While Business Objects may collect data from several database-tables, DBA Objects are allocated to one database-table.
For a more detailed description of DBA Objects please see Using Data-Base-Access (DBA) Objects for low level access to database-tables – Java Base Knowledge.

In fact, this step could be the first one when developing an application;
in the context of this tutorial it is recommended, that JS_FC01l – Develop the Client-Side Class for the Business Object 'Project' is completed - and its prerequisites too.

JS_FC01n – Develop the Base Class for the DataBase-ConnectionManager

The Server-Side derivation of the Business Object 'Projject' (developed in the next step) needs to open a connection to the database.
As opening and closing connections takes pretty long (compared to processing other Java-code), a class is developed that allows re-use of already open connections to the database.

This step has only to be done if you decided to code the Base-Classes by yourself.
In that case you need JS_FC01f – Base-Class for reading a file with XML-structure – and its prerequisites too.

Recommended:
Structure of the xml-file with the parameters for database- and JAS-connection (Connections.xml in directory CONNECTIONS) read.
This introduces the parameters that are needed to incorporate the access to a database in a JAVA-application.
For more explanations using a database-system in a JAVA-application, please browse through JS_Base02d, Step3 – Read parameters for the connection to the database and JS_Base02e, Step 4 – Connect to the database – if you not already made this exercise.

JS_FC01o – Develop the Server-Side Class for the Business Object 'Project'

The Server-Side Class of a Business Object is an extension of the General Class and contains methods that are only needed on the Client-Side of an application.
It uses one or more DBA Objects to store and retrieve data from a database.
For a more detailed description of the Server-Side Class of a Business Object please see Business Object, Server-Side Class – Advanced Java Fat-Client-Development.

JS_FC01m – Develop the Data-Base-Access (DBA) Object fot the table 'Project' completed - and its prerequisites too.

JS_FC01p – Create the database table 'Project' and establish the connection

Before data can be stored, a database and the database-table with its attributes has to be created.
The connection-parameters are stored in a file with XML-structure and the method to establish the connection has to be called within the 'CommandCenter'.

Within this turorial, JS_FC01f - Base-Class for reading a file with XML-structure has to be completed - and its prerequisites too.
There is also the prerequisite, that a database-system is installed; please refer to the document with the detailed description.

JS_FC01q – React to the 'Store' button and save the data in the database

Now it is time to store the entered data in the database.
The step dsicusses, what should happen after the 'Store'-button was clicked.

JS_FC01p – Create the database table 'Project' and establish the connection completed - and its prerequisites too.

JS_FC01r – Re-Display the list with the Project/Language combinations

As a re-display of the entered data was missing in the previous step, here is documented how a list of existing database-records can be displayed.

JS_FC01q – React to the 'Store' button and save the data into the database completed - and its prerequisites too.



top.

Recommended Documents: