On Fri, 20 May 2011 18:50:55 -0300, Vangel V. Ajanovski <[email protected]>
wrote:
On 05/20/2011 02:24 AM, Thiago H. de Paula Figueiredo wrote:
Yes we use tapetstry-hibernate and this is all automated which is
excellent. So if you have entity classes like this.
Person ----> Country
And if you are creating a form based on Person, it is really simple to
create a list box with the SelectModelFactory.
But imagine a situation like this:
/------>ClassB ------> ClassE
ClassA ---------> ClassC----> ClassD
Then when filling A
What do you mean by filling?
you have to select some item from C (which sometimes by nature is not a
strong entity, but a weak one and it depends on B, D, E). Here
SelectModelFactory does not help by itself, because choosing just one
property is not enough. The database is heavily normalized and rather
complex and the user will not be very clear if I only output the id or
title of C
I tried to understand your scenario but I didn't understand it at all. A
heavily normalized complex would be the simplest scenario to implement.
Almost all Selects will have options which are of a single type (otherwise
I'd think the classes are not well designed).
Anyway, I think you should create a simple implementation of OptionModel
and SelectModel and use them instead. Of course, Tapestry could provide
some simple non-internal implementations.
So I do this:
<t:selectObject list="listOfAs" value="a" label=" literal: c.b.e.title
'\s' c.d.title '\s' c.title ">
I think this solution is only good if the list of options is absolutely
static. Otherwise, you're end up doing String concatenations, something
which is way more error-prone than using SelectModel and OptionModel.
I got worried after reading your comments on the various approaches to
this on the Wiki, because 95% of our forms require such programming.
Could you provide some actual code so we can comment and improve on them?
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]