You're not doing it incorrectly, but you're basing your critique on
a false assumption, to whit that the property select component will always
be backed by an instance of java.util.List containing valid beans. By
implementing IPropertySelection, you add a layer of abstraction which means
that the property selection no longer knows or cares what your backing data
store looks like.
Want to back it with a HashMap? No problem, just implement
IPropertySelection.
What about a JDBC result set? No problem.
Now it might well behoove Howard or one of his minions to produce a
"SimplePropertySelection" which takes as its input a list of beans, but any
such simplification would have to be in addition to, rather than a
replacement for, the existing interface bases selection model.
For what it's work, I just wrote one wrapper class that wraps a list
and use that for all my property selections, so in practice it took maybe 5
minutes more than it would have otherwise.
--- Pat
> -----Original Message-----
> From: Todd Orr [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 29, 2005 7:00 PM
> To: Tapestry users
> Subject: Select Component
>
> Why does the Select component appear to be so complicated? I have an
> ArrayList of objects. Each object has id and label properties (among
> others). In order for me to display and use these objects I have to
> implement IProperySelector. Once one is chosen, I have to loop through the
> array until I find the object that was selected. It seems to me that I
> should only have to specify the identifier property and the label
> property.
> Tapestry should automatically be able to select the correct object from my
> List according to the identifier property. This is how .Net operates. I
> believe .Net uses reflection to determine which object to pull out of my
> list. In Tapestry, I either have to implement IPropertySelector for each
> type of List, or implement an interface on the list items. There seems to
> be
> too much overhead for such a simple and widely performed task as resolving
> a
> selection in a drop-down form element.
>
> Am I doing this incorrectly?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]