Have you tried
http://www.tapestrycomponents.org/Tassel/app?service=direct/1/Search/viewComponent&sp=SrobertzListPropertySelectionModel
? It does require implementing the "NamedListItem" interface, but that's
only got a single method "getItemName". Also, if you search the list
archives, somebody posted an implementation of a model that uses ognl to
allow you to do something along the lines of:
new Model(<list of beans>,"some ognl expression for the label")
Which is nice, since you can do something like:
new Model(myList,"'item #' + itemNumber");
And so on. If you don't like any of the existing implementations of
generic wrappers, it certainly doesn't take long to write your own. :)
You could then add it to tassel so other people can benefit, as well. ;)

Robert

On Tue, 2005-11-29 at 20:05 -0800, Todd Orr wrote:
> Thanks for your quick reply. You have a point. There is a great deal of
> flexibility in the Tapestry approach. It does seem to sacrifice some
> simplicity, though. I believe in the utility of Tapestry because it makes my
> development tasks easier, in general. So, I believe it would help to have a
> framework component as described. I do think that the binding to a value is
> insufficient for a generalized list approach. I would most appreciate an API
> that allowed me to bind one property to the option's display and one to its
> value attributes. I think I could knock this one out. Does anyone have any
> more input on this?
> 
> On 11/29/05, Patrick Casey <[EMAIL PROTECTED]> wrote:
> >
> >
> >         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]
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to