To be honest, I don't use the select component. :) I use
PropertySelection, SelectMultiple, contrib:MultiplePropertySelection, or
Palette, depending on my need.
Then I don't have to worry about the details. :)
I'd suggest taking the time to understand the PropertySelection model,
because it will save you a lot of time and coding in the future.
I wrote a "ListPropertySelectionModel", if you're interested.
The items in the list have to implement a "NamedListItem" (single
"getItemName method), but once they do, you can just do
return new ListPropertySelectionModel(mylist);
Somebody else on here wrote something similar, using reflection instead
of interfaces, so you can just specify the model as a bean. The model
had a "label" property, or some such, that was used to determine, by
reflection, the method to be called to grab the object label.

Robert

Dan   wrote:
> Rob,
> 
> Thanks for the quick reply and the palette sample.
> I think i m avoiding using palette cuz i cant fig out an easy way to
> convert my java.util.List of composite objects (or watever u call
> em...the ones with objects inside objects) to a IPropertySelectionModel.
> I'll take a look at tassel. good ref! thx
> i m curious though to learn more about the select component with
> multiple=true. So if the select component displayed a collection of
> objects, what would be a way (in the form listener) to get hold of the
> selected objects?
> as i mentioned b4, i iterate through all the colln objects for
> isSelected() to be true, but looks like setSelected() is not turning the
> flag to true...or maybe i m missing something?
> 
> thanks again!
> 
> 
> 
> 
>> From: Robert Zeigler <[EMAIL PROTECTED]>
>> Reply-To: "Tapestry users" <[email protected]>
>> To: Tapestry users <[email protected]>
>> Subject: Re: Multiple Select
>> Date: Wed, 13 Jul 2005 16:58:32 -0500
>>
>> Try the select multiple component in tassel?
>> Otherwise, the contrib:palette works well, too.
>> Using it is really about the same as using PropertySelection.
>> The only difference is that you're passing a (modifiable) list instead
>> of a single object in.
>>
>> Here's an example...
>>
>> <select jwcid="@contrib:Palette" model="ognl:coursesModel"
>>      selected="ognl:selectedCourses"
>>      availableTitleBlock="ognl:components.unenrolled"
>>      selectedTitleBlock="ognl:components.enrolled"/>
>>
>> <span jwcid="[EMAIL PROTECTED]">
>>         Unenrolled
>> </span>
>> <span jwcid="[EMAIL PROTECTED]">
>>         Enrolled
>> </span>
>>
>> Robert
>>
>> Dan   wrote:
>> > Hi,
>> >
>> > I am newbie to tapestry. I am having problems getting the selected
>> > values from a MULTIPLE select.
>> >
>> >> From googling the net and reading the docs, the method i approached to
>> >> get
>> >
>> > the selected value from a SINGLE select list(dropwdown) is by iterating
>> > over the collection being rendered and check if isSelected() is true.
>> >
>> > example:
>> >
>> > Page spec:
>> >
>> > <select jwcid="@Select">
>> >  <span jwcid="@Foreach" source="ognl:colorList" value="ognl:color">
>> >    <option jwcid="@Option" selected="ognl:color.selected"
>> > label="ognl:color.name"/>
>> >  </span>
>> > </select>
>> >
>> > Java code:
>> >
>> > public Color getCurrentColor(){
>> >  List l = getColorList();
>> >  Color p;
>> >  for (int i=0;i<l.size();i++){
>> >    p = (Color)l.get(i);
>> >    if (p.isSelected())
>> >     return p;
>> >  }
>> >  return null;
>> > }
>> >
>> > I try to do similar thing with mulitple select, ie return a List of
>> > objects whose  isSelected() == true. But this doesnt seem to work.
>> >
>> > Could someone please guide as to how do they retrieve the selected
>> > objects from the multiple select?
>> >
>> > Also are there any contrib:palette examples out there? The book
>> > doesnt...neither did googling help.
>> >
>> > Thanks a bunch!
>> >
>> > _________________________________________________________________
>> > Don’t just search. Find. Check out the new MSN Search!
>> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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]
>>
> 
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search!
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> 
> 
> ---------------------------------------------------------------------
> 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