[This one's a winner -- Trevor Smith, Editor, OS/2 e-Zine!]
JFactory: a Java IDE for OS/2- by Dirk Hamstra

Ever since researchers at PARC pioneered the concept of an integrated development environment (IDE) with Smalltalk, developers have been hooked on tools that combine all necessary programming aids. To be successful in today's market, an IDE must support visual tools, version control, syntax checking, etc. Tools and programming languages are tightly coupled. Acceptance and success of a computer language depends to a large extent on the available tool set. Sun Microsystems Java is no different in this respect.

Despite opinions, reviews and announcements, the amount of Java applications is still limited. To get an idea of the possibilities with Java, both applets and applications, check out http://www.gamelan.com/.

The number of Java application may grow significantly with the arrival of new percolators/tools supporting native Java development though. Major tool builders like Borland (product based on Delphi), IBM (VisualAge for Java) and Microsoft (J++) are readying releases of Java IDE's. While the heavy hitters are putting the finishing touch on their products, smaller companies are selling complete Java IDEs now. Examples include products like Mojo (Penumbra Software), JFactory (Rogue Wave), and Java WorkShop (SunSoft).

Key to the power of Java programming is its "write once run anywhere" model. Although Java is a cross platform language, most IDEs are integrated with a single platform. Currently JFactory from Rogue Wave is the only available Java IDE for OS/2.

For this review, JFactory beta code was downloaded from the Rogue Wave web site. Combine JFactory with the Java Developer's Kit (JDK) 1.0.2 and you have a complete development system at hand. Approximately 25MB is needed to install both software packages on your system.

JFactory is a buzzword-compliant development environment supporting WYSIWYG, drag-and-drop, and point-and-click. Rogue Wave's zApp line of programming tools is the base for the Java development environment.

JFactory can be characterized as a cross-platform screen painter, prototype builder, and code generator for Java. The main goal of JFactory is to free the developer from the implementation details of the GUI, and to have the developer concentrate on the design and functionality of the GUI. Both applets and stand-alone Java applications can be generated.

Starting A Project

JFactory uses the term 'project' to represent an application. A project is defined as a list of objects that make up an application. When you start a new project a dialog prompts you for the name, directory, and template project to use. JFactory ships with templates like Applet, Application, and Menu Application. New templates can be added, and existing ones can be tailored to your specifications.

The type property in the project provides control over the type of code (applet or application) that will be generated. Note, however, that there are security differences between types. For example, an application can write to a local disk but applets cannot!

Once a project is created, the Project Manager, Object Manager, and Tool Palette windows are opened. Project Manager lets you add, view, and modify every control in the project hierarchically. Objects and containers within a project are shown graphically in the form of a project tree. The top level of the tree represents either an application or an object. General containers, containers that hold objects, or other containers are shown on the next level. Using pop-up menus, you can manipulate the currently selected object. The Object Manager provides easy and direct access to all objects in your design. The current setting of the object's properties and events are displayed using tabbed sheets.

GUI Design

Designing the GUI is easy with JFactory. The "Window and Dialog" design tool provides all functions for object alignment, spacing, and positioning, as well as drag-and-drop capability for adding components and images. A Menu Designer simplifies the creation of menu bars, pop-up menus, and individual menu items. Menus, windows and dialogs, and even whole applications can be reused after they have been added to the Object Library. This library serves as your repository of objects and code.

JFactory translates your design into standard Abstract Window Toolkit (AWT) source code. As an example, a code snippet of AWT for a standard window with regular widgets is shown below.

public
class crdtchk extends Applet {

        private static Applet applet;
        TextField pEdit2, pEdit3, pEdit4;
        TextArea pEdit1;
        Label pStatic1, pStatic2, pStatic3, pStatic5;
        Button pButton1;
        Checkbox pRadioButton1, pRadioButton2;
        CheckboxGroup pRadioButton1Group;
        // zpb_begin MainUserVars 

        // zpb_end 

        public
        void init() {
                applet = this;

                // zpb_begin AppletInit 
                // zpb_end 

                setBackground(Color.lightGray);
                LogFontLayout lfLayout = new LogFontLayout(this);
                setLayout(lfLayout);

                pStatic1 = new Label("Account Number");
                add("7 6 83 10", pStatic1);
                pStatic2 = new Label("Name:");
                add("7 28 85 10", pStatic2);
                pStatic3 = new Label("Agent:");
                add("7 50 86 10", pStatic3);
                pRadioButton1Group = new CheckboxGroup();
                pRadioButton1 = new Checkbox("1-30", pRadioButton1Group, false);
                add("104 118 33 10", pRadioButton1);
                pRadioButton2 = new Checkbox("61-90", pRadioButton1Group, false);
                add("170 118 36 10", pRadioButton2);
                pRadioButton3 = new Checkbox("90+", pRadioButton1Group, false);
                add("104 133 37 10", pRadioButton4);
                pButton1 = new Button("Submit");
                add("89 226 79 12", pButton1);

                // zpb_begin MainConstructor_2 
                // zpb_end 
        }

Coding

Code generated by JFactory includes "protect blocks". The behavior of the application, your code, is put in these blocks. Rogue Wave included a handy feature that ensures that user-defined code is not deleted across subsequent code generations. There are two sets of protect blocks: one to allow user-defined code to be entered before the window is displayed and another block that gets executed after a window is opened. A default generated block looks like this:
   public boolean handleEvent(Event e) {

                // zpb_begin MainHandleEvent 
                // zpb_end 

                return super.handleEvent(e);
The editor that comes with JFactory is okay, but Brief is better. By providing the opportunity to plug any editor into the IDE, Rogue Wave allows developers to use their favorite program to edit Java source code.

Compiling

Compiling your code is the last step in developing your Java application. JFactory uses the compiler that is shipped with the Java development kit. Note that JFactory currently lacks a "Just In Time" (JIT) compiler.

Before you can start the compilation process you must import the packages and classes used in the project. Generally you'll use libraries like java.awt, java.util.*, and java.applet.Applet when you're developing an applet.

Pressing the "Generate & Make"-button on the JFactory toolbar will generate and compile the source code. When you're developing an applet, this one-button operation will automatically generate an HTML file that can be used as input to the applet-viewer or any other Java-enabled browser.

Conclusion

JFactory makes it possible to rapidly create a GUI using drag-and-drop and point-and-click interfaces. JFactory provides a complete, well-integrated IDE and facilitates reuse through the Object Library.
 * JFactory for OS/2
by Rogue Wave
MSRP: US$195
Dirk Hamstra is an OS/2 user since 1987. He's managing partner of DOOSYS IT Consultants, an international OO consulting organization.

[Index]  [ Previous] - [Feedback] - [Next ]

[Our Sponsor: J3 Computer Technologies - Your OS/2 software store.]


This page is maintained by Falcon Networking. We welcome your suggestions.

Copyright © 1996 - Falcon Networking