You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Daniele Dellafiore <il...@gmail.com> on 2011/03/06 11:01:04 UTC

Data-driven gui: generation from XML

Hi.

I am taking on a second project where is a good choice to "generate"
the gui from data definition, specifically from a xml schema.
The first project was a survey: multiple questions divided into
categories with a text description, multiple answers, free answers
(text or numbers, with range validation), radio buttons or drop down
and so on...
My XML contains the structure, following a schema (not a proper xml
one), the data (questions, answers, ids...) and some extra information
(validation, kind of gui element to use...). Part of the data would
eventually be persisted.

In this new project I have a lot of medical data to present in a
simple crud: you can imagine multiple tabs with 8-10 field each, any
field with a label and a specific validation: numeric range, fixed
allowed values and so on. Having a with the definition would be really
easy, also because I can easily discuss it with my customer or even
make it complete the XML for me. Also, would be easier to create new
apps on new schema with a simple crud already available almost gratis.

The validation part really resamble the JSR for bean validation
(303?). I took a look and the XML looks complicated to me:

        <field name="licensePlate">
            <constraint annotation="javax.validation.constraints.NotNull"/>
        </field>

really?

What I have in mind is:

   <page>
      <tab name="antropometrici">
         <field name="doce" description="codice" />
         <field name="sex" values="F,M" />
         <field name="weight" range="40,150" measure="Kg" />
         <field name="height" range="100,210" measure="cm" />
      </tab>
   </page>


What do you think? Not about specific xml implementation, about the
general idea. Do you have suggestion on the topic?

As a note, there's already a discrepancy in that xml: in the real app
I'd like to use tag that speaks the data language, so like : "study"
and "section" instead of page and tab, and eventually remap them
later.
This way I have a single point where all the data schema and it's
validation is provided. The DB schema will be the same and the gui can
be generated in a consistent manner from the same XML, maybe just
adding some more translation.

Thanks.

-- 
Daniele Dellafiore
http://danieledellafiore.net

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org