Hi there,
I'm not a GUI expert so please bear with me.
I'm designing and partially implementing this enterprise application
(not a huge project, but an important one). We designed by hand the
most complicated and domain-specific GUIs. We are now facing the task
of designing the most trivial ones i.e., forms for populating base
tables (customer details and the like).
Producing such forms by hand is a very very boring (hence depressing
and error-prone) process so I was wondering if some of you GUI experts
know of some tool that can (probably partially) automate the process.
This doesn't seem a daunting task, as the whole thing is taking place
in Java with Hibernate, so: 1. introspection is available 2. there
already are (hibernate-generated) classes mirroring the database
structure. I have no time (and no GUI skills) to do it myself but again
this doesn't look impossible.
What I dream of is a tool that:
1. reads the db structure and/or the hibernate-generated Java classes
2. infers the names, sizes and data types of fields/columns
3. comes up with a tentative (but usable) layout for a form, perhaps
arranging the fields in a grid or something.
Technologies: Java, Hibernate, SWT (rich clients, no web).
What do you guys usually use? I find it hard to believe that people
sistematically do this by hand!
Thanks in advance
andy
David Lee Lambert - 08 Sep 2006 22:42 GMT
On Thu, 07 Sep 2006 02:54:58 -0700, abcd_68 wrote:
> Hi there,
>
[quoted text clipped - 16 lines]
>
> What I dream of is a tool that: [...]
> What do you guys usually use? I find it hard to believe that people
> [systematically] do this by hand!
I have not done this. However, what you need is not so much a new tool
as a generic "form" component. If I decide I need such a thing, I'll
probably proceed as follows:
1. The component is a subclass of JPanel. It has some way of setting a
"target" object; argument to constructor or a "setTarget(..)" method.
Alternately, it could be passed an object together with a list of the
names of properties that should be exposed.
2. An n by 2 GridLayout is a nice default way to make a variable number
of fields line up.
3. You need a little adapter class that takes the name of one property
and accepts ActionEvent s. It should set R/W properties of the target
object upon receiving such an event. If there is more than one component
showing the state of the property, it should synchronize them all too.
4. Now just iterate through the properties returned by, for instance,
java.beans.GetBeanInfo(...). For each one, add a JLabel to the left
column and suitable editor-components to the right. The simplest choice
would be to use the property-name as the text of the label, but one could
add spaces and make subsequent words lowercase.
There might be some way to read Hibernate ".hbm.xml" files to figure out
which properties are relevant; the approach I've outlined also ignores
relations among different tables.

Signature
PGP key posted on website ... http://www.lmert.com/people/davidl/