Yes, you can. You'll probably want to override "equals" to perform some check other than a==b. :)
Robert Dan wrote: > i m a bit confused, so sorry if this is a repeat. > in the palette component, cant i initialize the "selected" side with a > List of objects? > in the pageBeginRender, i do a setXXX(List) but nothing comes up when > the page is rendered :( > although i got the model side working...thanks rob! > >> From: Robert Zeigler <[EMAIL PROTECTED]> >> Reply-To: "Tapestry users" <[email protected]> >> To: Tapestry users <[email protected]> >> Subject: Re: Multiple Select >> Date: Thu, 14 Jul 2005 10:31:38 -0500 >> >> It's now downloadable from here: >> >> http://equalitylearning.org/Tassel/app?service=external/ViewComponent&sp=SListPropertySelectionModel >> >> >> Robert >> >> Dan wrote: >> > aaah...yes...just realized that. could you throw in ideas/sample >> code of >> > your implementation of list property selection model? -thx! >> > >> > in the meanwhile, i fig that if any1 wanted to use the multiple select >> > its a very tedious task to get the items(objects) that are selected. >> you >> > will have to implement the isSelected() and getSelected() methods >> inside >> > ur java class instead of relying on the object's selected methods. >> > >> > theres a good example of how this multiple select works in the >> > tiaexamples/Toppings app code in the tapestry in action src download! >> > >> > -Dan >> > >> >> From: Robert Zeigler <[EMAIL PROTECTED]> >> >> Reply-To: "Tapestry users" <[email protected]> >> >> To: Tapestry users <[email protected]> >> >> Subject: Re: Multiple Select >> >> Date: Thu, 14 Jul 2005 09:54:06 -0500 >> >> >> >> Well, the tassel component still uses the IPropertySelectionModel >> >> interface. >> >> >> >> Robert >> >> >> >> Dan wrote: >> >> > I think the Tassel multiple select looks good for my app logic right >> >> > now. However, I m interested in looking at the >> >> > ListPropertySelectionModel u ve written. I might get away with >> tassels >> >> > component this time, but if something comes up thats is better if >> >> > implemented via the propertyselection model, then i wont ve to be >> >> > searching for an howto example :) >> >> > >> >> > thanks! >> >> > >> >> >> From: Robert Zeigler <[EMAIL PROTECTED]> >> >> >> Reply-To: "Tapestry users" <[email protected]> >> >> >> To: Tapestry users <[email protected]> >> >> >> Subject: Re: Multiple Select >> >> >> Date: Thu, 14 Jul 2005 07:59:23 -0500 >> >> >> >> >> >> 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] >> >> >> >> >> > >> >> > _________________________________________________________________ >> >> > FREE pop-up blocking with the new MSN Toolbar – get it now! >> >> > http://toolbar.msn.click-url.com/go/onm00200415ave/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] >> > > _________________________________________________________________ > On the road to retirement? Check out MSN Life Events for advice on how > to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement > > > --------------------------------------------------------------------- > 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]
