4 DESIGN AND
IMPLEMENTATION
From the very beginning, our solution has been
designed as a generic one. It means that most of the
functionality could be utilized with any Java classes.
Moreover, our approach may be implemented for
other languages supporting reflection, i.e. MS C#.
One of the problems which had to be solved, was
exchanging data between class items (attributes and
methods) and widgets. After some research we
decided to use the following approach:
For every annotated attribute, there must be a
read method named as the attribute with get
prefix, i.e.
getLastName(). Annotated
attributes could be of any basic type, Data,
String or enumeration.
If the marked attribute is writeable (not read-
only), then there must be a similar method but
with a “set” prefix, i.e.
setLastName(...)
with an appropriate parameter.
The above rules could be modified by
explicitly defined methods.
A widget used to visualize/modify the item
has to have methods:
setText(...) and
getText() with parameter and return types
of String. The methods are used to set and
read widget’s state (based on the states of the
connected item). Most of existing widgets (i.e.
JTextField) work that way. However, if a
widget does not have the methods a simple
wrapping must occur. This is the case of
boolean type and JCheckBox. We have
provided a new class
CheckBoxBoolean
which simply overrides the mentioned
methods.
A special case are enumerations. We have
created a generic widget (
ComboBoxEnum)
which automatically works with all
enumerations defined by a programmer.
The similar situation occurs for generating GUI
for methods (
GUIGenerateMethod annotation).
5 CONCLUSIONS
We have presented the result of our research
regarding automatic generation of Graphical User
Interfaces for business applications. The generated
GUI is based on annotations of data items processed
by a developed application. A programmer chooses
which attributes or even methods should be reflected
as widgets and writes only a couple of source code
lines. Then, our library automatically generates
windows for creating, editing or presenting data.
Our contribution could be evaluated from two
points of view. Firstly, our approach could work
with popular technologies (i.e. it works with Java
and Swing) and would not require any dedicated
systems or sophisticated interface description
language. Secondly, the working prototype has been
developed for the Java language and Swing GUI
library. It is possible to develop similar libraries for
other programming languages supporting reflection.
Our future work will focus on formal usability
and performance tests. However, informal
benchmarks show that the performance is good
enough for small and medium size systems.
In our future work we would like to focus on
improving our approach, because, in our opinion, the
declarative (model-based generation) way of
creating GUIs has a big potential which could save a
lot of programmers’ time.
REFERENCES
Basnyat S., Bastide R., Palanque P.: Extending the
Boundaries of Model-Based Development to Account
for Errors. MDDAUI '05. 2005.
da Silva P.: User interface declarative models and
development environments: a survey. Proceedings of
DSVIS 2000, 2000,pp. 207–226.
Gajos K., Weld D.: SUPPLE: Automatically Generating
User Interfaces, in Proceedings of IUI'04, Funchal,
Portugal,2004, pp.83-100.
Guojie J. L.: Professional Java Native Interfaces with
SWT/JFace. ISBN: 978-0470094594. Wrox. 2005.
Jigloo SWT/Swing GUI Builder:
http://www.cloudgarden.com/jigloo/.
Molina P., Meliá S., Pastor O.: JUST-UI: A User Interface
Specification Mode, in Proceedings of CADUI 2002,
Valenciennes, France, 2002, pp.63-74.
Mori G., Paterno F., Santoro C.: Design and Development
of Multidevice User Interfaces through Multiple
Logical Descriptions, IEEE ToSE, 30(8), 2004, pp.1-
14.
Sells Ch., Weinhardt M.: Windows Forms 2.0
Programming. ISBN: 978-0-321-26796-2. AWPddison
Wesley Professional. 2006.
Walrath K., Campione M., Huml A., Zakhour S.: The JFC
Swing Tutorial (2nd Edition). ISBN 0201914670.
Prentice Hall. 2004.
ICSOFT 2008 - International Conference on Software and Data Technologies
76