GUI Application Framework Architecture

Introduction

Today in the software industry, great success has been archived in the graphical user interfaces (GUI) development. However, the main efforts for instrumental tools for developers are concentrated in a field of visual control libraries and visual GUI designers.

Such tools have a great influence in increasing software development productivity. However, developers still frequently have to solve similar tasks like: to share work between several programmers, to develop flexible module applications or use ready code. Most of the existing development tools are very low level to help in such problems.

The developed GUI Application Framework (GAF) is an attempt to solve these problems. The framework is based on using component models (such as Java Beans or ActiveX) and does not limit developers with tools and approaches in software design. It can be described in terms of Design Patterns. For better understanding of the main concepts, a comparison between TeX and LaTeX systems is presented below.

TeX is a powerful published system created by Donald Knuth. It's perfect but too complex for everyday usage. To simplify the work the LaTeX system was created as a set of ready to use templates to the TeX. With it’s help users can make more than 90% of all the tasks. But if the user meets something nonstandard he/she has a chance to go down to the TeX and change any part of the LaTeX template or even create a new one. The interesting feature of the LaTeX templates is that they are created by the best specialists and have a very professional design. Changes of LaTeX templates is not a simple task, thus beginners frequent do not wish to spoil a thought-out standard view of a document.

Designing the GAF we tried to solve the following tasks:

System Achitecture

The main implementation ideas of the GAF are:

The above UML diagram describes the main GAF components and a place for user application classes. Components with similar functionality are grouped together in the diagram.

Usage Example

Let’s look as the simple GAF example. It is a Java implementation of HelloWorld application.

The main application form inherited from AbstractMainForm:

import com.mmsi.intellimine.gaf.*;
import com.mmsi.intellimine.gaf.util.*;

public class HelloApp extends AbstractMainForm {
  /**
   * The user define module to load into application
   */
  private String[] modules = { "com.mmsi.intellimine.gaf.test.HelloModule" };

  /**
   * Constructs this main form.
   */
  public HelloApp() {
    // Creates this main form using ready to use template
    FeaturedMenuBar mainMenu = new FeaturedMenuBar(this);

    // Adds to main menu bar menu File with item Exit
    mainMenu.add(mainMenu.createShortFileMenu());

    // Adds main menu to main form
    putComponent(MAIN_MENU, mainMenu);

    // Adds status bar to main form
    putComponent(STATUSBAR, new SimpleStatusBar(this));

    // Adds module loading manager and says to load our module
    putService(MODULE_MANAGER, new ModuleManager(this, modules));

    // Sets main window title
    setTitle("Hello Application");

    // Makes standard initalization of this main form
    init();
  }

  /**
   * Runs this main form as standalone application
   */
  public static void main(String[] args) {
    HelloApp mainForm = new HelloApp();
  }

}
User defined module with elementary functionality:
import java.awt.*;
import javax.swing.*;
import com.mmsi.intellimine.gaf.*;
import com.mmsi.intellimine.gaf.module.*;

public class HelloModule extends JPanel implements Module {
  /**
   * Constructs this module
   */
  public HelloModule(AbstractMainForm mainForm, Object container) {
  }

  /**
   * Draws "Hello, World!" message on the contents.
   */
  public void paint(Graphics g) {
    g.drawString("Hello, World!", 10, 30);
  }

  /**
   * Gets the component which will be buildin into main form
   */
  public Component getClientPane() {
    return this;
  }

  /**
   * Gets a name of this module
   */
  public String getName() {
    return "My Module";
  }

  /**
   * Gets a user name of group similar modules.
   * @result a user-friendly name of module group.
   */
  public String getGroupName() {
    return "Test";
  }

  /**
   * Gets an icon of this module.
   */
  public Icon getIcon(boolean smallIcon) {
    return null;
  }

}
After compilation and running we can get an application with the next view:

The complete java implementation with examples and documentation is available on the site http://www.sourceforge.net/projects/comedia

Conclusion

The practice the GUI Application Framework usage showed the productivity of each GUI programmer can be increased up to 1.5-2 times by programming with ready to use templates and modules.

Moreover a group development and testing of large systems are simplified by full isolation of different programmers work. Managers and customers obtain an opportunity to participate in a system development and control the quality and functionality of the system from the start as well.

Frequently different customers require some minor changes in the software. Modular software helps to solve the problem with specific customer’s code, avoid parallel versions of software and significantly decrease tech support costs.