GUI Serializer

GUI (Graphical User Interface) builder are tools which allow application developers to visual compose graphical user interfaces. Ordinary this tools generate Java source code for the GUI components what prescribes some parts of the GUIs architecture.

One solution to achieve more flexibility here is to serialize the GUI components after construction and to deserialize it afterwards for usage in the application. In the periodic Java Spektrum 2/99 [JSPK] Niels Fricke, Carola Lilienthal, Martin Lippert, Stefan Roock and Henning Wolf presented this solution in the article "Unabhängigkeit von GUI-Buildern". This work is part of the JWAM Framework [JWAM].

To collect some experiences with this process I extracted and modified parts of the JWAM framework source code and built an sample application. You can download all source code and documentation as a zipped file.

Users Guide

To do it your own you need a Java IDE (Integrated Development Environment) with a GUI Builder for JDK 1.2.

To save a GUI component in a file carry out the following steps:

  1. Start your IDE and add the Java Bean GUISerializerButton to your GUI Builder.
  2. With the GUI Builder create und customize a form or dialog for your application. Notice that the value of the name property is needed later to retrieve a reference to this component.
  3. Add the GUI Serializer Button to the root component you want to serialize.
  4. Activate the Customize property of the GUI Serializer Button. Depending from the used IDE your this allows you to save serialize the enclosing component into a file. In the case this works you may skip the next step.
  5. Add a small main method to the generated Java source code which makes your window visible at runtime. Compile and start the program. Press the Serialize button to serialize the enclosing component into a file.

To display the stored GUI component from your application carry out the following steps:

  1. In your application insert a call of method GuiSerializer.read() to deserialize the GUI component.
  2. To access subcomponents instantiate class GUIRegistry and call method find() to retrieve a component by it's name.

That's all!

Known Issues

Copyright

The JWAM framework is open source under the GNU General Public License [GPL]. The same applies to my supplementaries.

References

[JAVA] Java technologie from Sun Microsystems.

[JDK] Java Development Kit.

[BEANS] Java Beans.

[JWAM] The JWAM-Framework.

[JSPK] Java Spektrum 2/99.

[SYM] Symantec Visual Cafe.

[GPL] GNU General Public License.


Last update: 1999/07/10; Author: Bernhard Fischer.

1