Trying Out JGuiGen
[Previous] [Main] [Next]

Trying out JGuiGen


There are four ways to quickly try out the JGuiGen.

1. Download the system using Java Web start. This will not have the source code, but it does come with the HSQL database system and allows you to run the DataDictionary, create files, (compile from a command prompt or and IDE) and then run them from the JGuiGen main program. The main program has already been set up to show you a completed application screen and to run a screen called "UserLogData.class" that you create.

2.    Download the source code and class files and unzip them. I place mine in a JGuiGen folder on a driver other than C. On Linux I use \home\JGuiGen. You can place them whereever you want. JGuiGen Source code Vesion 1.0

   By default, you will be using the HSQL database here. See the ReadMe.HTML for more information. This is a small self contained SQL database. By simply copying a jar file file and a couple of text files to your system you have a completely functions SQL database installed. It also comes with a small front end that lets you execute SQL commands directly on the database to create new tables, modify tables, view selected rows etc.

3.   You can download the source code and unzip it (from step 2). There is a copy of the JGuiGenIni.xml file in a zip called JGuiGen-Postgres-XML. If you unzip this, this system will use a PostgreSQL database at halepringle.com. This option is subject to being closed without warning if there is abuse. I also do not guarantee that it will be up 24/7.

4.   You can download the source code and unzip it (from step 1). The readme.html file contains instruction on putting the tables JGuiGen needs into your own database. JGuiGen comes with small java applications that will fill these table with data. The tables are 1) UserLogData - this is used by the use log in system, the query builder and as a demo of most of JGuiGens features. 2) JGuiGen_I18N - this contains the key=value pair information used to generate I18N resource bundles and data used by JGuiGen to create comboboxes, radiobuttons etc. in your applications and 3) data_dict - this is a table that contains the data dictionary information. It is filled by JGuiGen from your data base tables, documents your tables and is used to tell JGuiGen how you want your application to look and feel.

Running the JGuiGen Application.

   In the home folder where you unzipped the project. You will find a generic application call JGuiGen. This file is designed to be copied, renamed and setup as the main screen in an application that will call the JPanels that JGuiGen creates.

   You can run this file (java JGuiGen). There are three menu options that are important for a test run.

   User Demo - This will run a JPanel that was created using JGuiGen. This panel has been manually tweaked to create a finished edit screen. Under this menu option you can view the source code, run the JPanel, view the resource bundle or run the testcase application that tests the panel. (Note: You will need to manually close the JPanel after the testcase run.) You can also view run the TestCase application that test UserDemo.java, view the java source code (in HTML format)

   Data Dictionary - This option runs the creation portion of JGuiGen. For this sample we will create a screen called Userlogdata.java This JPanel edits the same data the User Demo does. The resulting program is exactly the same as the one I used to create the User Demo option.

   Here are the steps inside the Data Dictionary option to create your own JPanel.

When you first run JGuiGen several steps will occur. A) You will be asked to select a user name. Pick any of them or add your own in the list of users in the JGuiGenIni.xml file. B) You will be asked to enter the name of the file (along with the path) that runs your Web Browser and the path and file to your Word Processor. These are stored in the database and used to launch these applications later. (I find it much more reliable than using system calls to automatically "find" these applications.) JGuiGen will insert a new row with the user name you chose and the machine name you are running on. This lets it obtain the correct path even when you move from machine to machine.

   Next you will run the options in the Data Dictionary.

data_dictionary_menu.png

   CHECK DATA DICT - Click on the first menu option in the Data Dictionary men - This will access the database you are using an compare the MetaData with the data in the data_dict table. It update the data_dict table and generates an HTML file that documents your tables and shows you any changes that have been made since the last run. It will ask you if you want to Leave the FLAGS. Go ahead and leave them for now. When you are finished you can browse the resulting HTML file is you wish.  




EDIT DATA DICT - Choose userlogdata from the top combo box. You will see "**Table Description" in the first field. Click on the "File" tab when "**Table Description" is showing. The screen has several active components that describe options that are available for build the screen (e.g. menus at the top, menus contain Icons, Include a JTable) These will be described in more detail later. For now you can look and see what is there. At the bottom of the screen is a scrolling table that shows all of the columns that are contained in the table. Click on one and the data for that column witll fill the fields in the screen. If you rerun the CHECK options, the documentation, options and notes you enter here will be included in the resulting HTML documentation file. The options on this screen will be discussed later in this help.  
 

Information about the Application to be Created.
data_dictionary_edit_table.png


Information about One Column in the SQL Table
data_dictionary_edit_column.png


   CODES BANK - When you choose some of the more advanced java visual components you will need to supply additional information before the java code can be generated. For example if you wish to put M for male, F for female and U for Unknown into a char column in your table using a radiobutton, you will need to tell JGuiGen about the radio buttion group. In this case you need to tell JGuiGen that the group will contain three buttons names Male, Female and Unknown and what to put into the table when one of the buttons is selected. The Codes Bank table is where you supply this infomation. You supply a code (in this case "gender") and enter one record for each radio button you want in your group.


data_dictionary_codes_bank.png

 
GENERATE APPLICATION - this is where you actually create the application. There are three main options you can run from this menu option.  
 

data_dictionary_generate_menu.png  


Model - Click on the MODEL option. This will create a UserlogdataTableModel file. All access to your SQL database goes through this class. The generated java file should be put into a file that is called UserlogdataTableModel.java. Compile this file. Note I do not overwrite your existing file here. This file is used by any screen you create that edits the userlogdata table. If you have done any manual tweaking of the existing file I do not want to overwrite them. (Note, in this case the file already exists. It is used by the UserDemo.)  

Order - You can modify the order that columns will be inserted into your final application by choosing the ORDER option, highlighting a column name and clicking on the up or down arrow to move the column name relative to the other names. When you EXIT this screen your sort order is saved to the data_dict table. (Obviously if you are using the database at my site the order will be changed by whoever most recently editing the file.)  

Create - Click on this option, choose the default file name (i.e. UserLogData) and click on the Create Java button. A few seconds later the application will let you view the created code. There are five java files created here. Create files with different names if you want to save your existing code. This option creates four files.  
   A) UserLogData.java - compile this and run (standalone or from the main JGuiGen application). This gives you a working application.  
 
   B) UserLogDataBuildLayout.java - You can edit this file to modify the rowlayout manager calls to create a final product. By default this file will not be overwritten when you rerun the Create process. The revised code will be inserted into the java file, but will be commented out. You can find the code relevant to modified or added columns and manually insert them in the appropriate spot.  
 
   C) UserLogDataExtra.java - this is a small demo class that is run when you click on the Extra button the generated application. You can enhance this file to carry out special tasks related to your SQL table. This file will never be overwritten once it exists.  
 
   D) UserlogdataAbstractTestCase.java - This call up a copy of the JPanel, tries to delete one row (with an given ID that is designaged as the Testing ID.) It then runs the last file.  
 
   E) UserlogdataTestCase.java. This applicaiton runs a series of JUnit (jfcUnit) tests against your application. It starts with an empty screen, loads each component with a unique value, saves the row (using the TestingID), recalls the row and compares each component with the data that originally was placed into it. It then clears the screen (prepares it for an Add) and checks that each component is actually empty or has the correct default value.  
 
INTERNATIONALIZATION (I18N) - All of the prompts, message, (and even the comments in the code) are internationalized. This means that they can be translated into different languages. The prompts and what the user actually sees is stored in a table. You can edit these using the menu options. You need to write these data our before the application you can generated can find it. This uses properties files. One text file is created for each language you have translated you application into. One nice thing here. Once one JGuiGen application has been translated most of the work for additional applications will already have been done. The tools tips for the menu options, and warning messages, the error messages, etc. are common to all generated applications.  
 

jguigen_i18n.png


Exit, compile and RUN the generated Code - the main JGuiGen application already has menu options set up to run and view the code you just generated.