OpenSwing Framework - advanced graphics Swing components - server side integration with Spring

2. Framework architecture

In this part it will be illustrated a summary description of the framework classes, partitioned per software layer: presentation layer, server-side layer, data access layer.

 

2.1 Presentation layer

This layer contains graphical classes and non graphical classes.

Graphical classes of the framework can be divided according to the graphics control type:

  • Grid and grid columns – by means of the graphical designer of the development environment adopted, you can create grid and columns, by dragging them in the designer; you have to adopt an IDE complianced with Java Beans specifications to draw OpenSwing columns inside the graphical IDE designer. Nowadays olny JBuilder is fully compliance with Java Beans specifications (until 2006 product version, it supports “containerDelegate” propert of “BeanDescriptor”, defined by Java Beans specifications); other IDEs that are near JBuilder Swing design capabilities are NetBeans and JDeveloper.
    All OpenSwing graphics controls are based on M-V-C pattern (Model-View-Controller), i.e. the viewer component (view) is decoupled from data model component (model) and from control component (controller). Data model linked to the grid contains a list of value objects (java beans serializable objects); this facilitates the development of applications fully modelled on objects oriented paradigma, both on server-side (business logic) and in client-side.


    For each grid column it is possibile to define several properties: column ordinability, initial sorting versus, column filtering abilitation, column editability, column type (text, interger/decimal numeric, currency, date, date + hour, hour, lookup, button, combo-box, check-box, image), column width, whether the cell value is required in the column, column (in)visibility, column header text, column header horizontal alignment and other properties that depend on the column type.


    Grid support two data loading: a block of rows (grid pagination) or all rows, according to the needs.


    Drag ‘n drop mechanism is embedded in all OpenSwing grids, it can be enabled in a very simple manner and it can be used between two grids.


    OpenSwing grid allows to anchor the first columns to the left margin of the grid, by allowing to scroll only the other columns.

  • Tree and Tree + Grid – OpenSwing provides a tree component that cab be dropped in a panel, through the graphical designer of the IDE; it is possibile to define the tree content by means of its data model, that must be fully retrieved and that is based on an objects modelization, as for grids; OpenSwing provides also a tree listener that simplify the tree events listening, that can be used to attach a tree node selection event to a grid data loading.
  • Graphics controls panel (Form) – a Form is a panel (derives from JPanel Swing class) that is able to control the behaviour of graphics controls inside it (and inside panels, scrollpane, splitpane, folder that are added to it or linked to it); Form can control the behaviour in terms of: editability, mandatory setting, input controls values (data fetching and data storing). A Form always has a data model linked to it; the form data model contains inside it a value object.
  • Buttons with images – OpenSwing provides a set of buttons with image that have a specific function: insert, edit, undo/reload, saving, copy, deleting, data export, grid navigation. When these buttons are directly linked to a grid or to a Form, these buttons control the behaviour of the grid/Form.
    You can customize a generic button with image and link it to the grid/Form, so that this button will share the other buttons's lot.
  • Dialog windows – based on JOptionPanel Swing class, they support internationalization settings.
  • Wizard panels – OpenSwing provides a wizard feature.
  • Splash screen - a splash screen window that be attached to any JFrame component.
  • Tip of the day - a frame or internal frame that contains a cutomizable tip of the day.
  • Progress-bar, panel with progress-bar, dialog with progress-bar
  • Licence Agreement panel - a panel that contains licence terms and radio buttons to approve/refuse the terms
  • MDI and internal frames – OpenSwing framework provides an MDI frame that can hosts internal frames. MDI frame includes several features that can be customized: title, background image,, colors, menubar + pull-down menu, tree menu having icons on nodes and tree dinamic hiding, about window, language selection, user swiching, user login, window menu.
  • Base graphics controls – OpenSwing provides a complete suite of base graphics controls: text field, multi-line text field, numeric field (with integer only support or integer + decimals), currency field, date + calendar field, date + hour field, check-box, radio-button, combo-box, labels, image panels, validation code field (lookup) with code selection from grid/tree window. All these graphics controls have many properties that depends on the control type and controls can be linked to a Form: for each control you can definine an attribute name of the value object of form data mode, so that input control value and value object are always sinchronized each other.
  • Gantt – OpenSwing provides also a Gantt diagram having a data model based on a list of objects; Gantt control can be customized according to specific needs. The diagram is optionally editable by means of drag operations.

Non graphical classes in presentation layer are used to complement graphical controls: they listen gui events, retrieve and store data, control all graphical behaviour. They can be divided in:

  • Client-side log management – it is never a good idea to add System.out instructions throughout the application; OpenSwing provides a utility class to log messages on the client side console in a format like the one provided by Log4J.
  • Data retrieval classes – some OpenSwing components like grid, tree, lookup and Form view data that has to be retrieved from outside. The framework decouples data viewing from data retrieval, by means of interfaces and provides some implementations too. These implementations can be used to bind views to business-logic/data access tiers. You are able to create your own implementation, thanks to interfaces, according to your needs.
  • Comunication classes – Open Swing provides a utility class to connect client side classes to a servlet via HTTP protocol. Of course you are able to create your own comunication classes, according to your requirements (e.g. RMI, SOAP, etc).
  • Utility classes for graphics components – the framework provides some utility classes that you can connect to graphics components, for the definition of application graphics settings, like colors, images, translations (based on XML file or ResourceBundles or ad ohc implementations) and some other client-side settings.
  • Authorizations management – all graphics components optionally can be connected to a central authorization system, based on interfaces and some implementations provided by OpenSwing. This tier allows to define grid editability (at column or cell level), editability of graphics controls, buttons abilitation with a sophisticated policy. Thanks to the interfaces you are able to extend OpwnSwing authorization implementations or replace them with you own, based for example to a database permission schema or on a central permission system, such as an LDAP server.

 

2.2 Server-side Layer

Server-side layer provided by OpenSwing is limited: a java servlet, with several settings that allow customization of the servlet; this servlet can be used as a central controller for the server-side application: it receives all HTTP requests from Swing clients. This controller includes a database connection management system and a user authentication system, both customizable.

This software component may be connected to another server-side framework (such as Struts, Spring) or may be replace entirely.

 

2.3 Data access layer

OpenSwing provides a utility class that allows to map value objects to SQL instructions used to retrieve data from a relational database or to insert/update records. By means of this class ORM (Object-To-Relational Mapping) activity is greatly simplified, and the development process of value object translation is faster.

This software layer can be combined with server-side layer in the case of web three tier client-server applications, or can be directly combined with the presentation layer in the case of two tier client-server applications.

With stand-alone applications that does not require a database (such as those applications that read/write files), this software layer may be omitted: presentation layer is not in relation with a database, it interacts only with the data retrieval layer , that is the only one that knows the data retrieval modality (database, remote procedure calls, etc.)

This software layer may be fully replaced with other frameworks, such as Hibernate. Anyway the work experiences with OpenSwing data access layer show that OpenSwing utility class has simplified and speed up the development process of business logic and data-access tiers. These positive results can be achieved with a very little training, related to data access utility class knlowledge. The same thing is not true for other (more powerful) frameworks, such as Hibernate, that requires much more training and whose understanding is sometimes not completly clear: the danger of poor performances and other risks with Hibernate is real, when the product is not perfectly understood.

 

<< Previous Chapter | Next Chapter >>

Licence | Contacts | ©2007 Mauro Carniel SourceForge.net Logo