You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dan � <po...@hotmail.com> on 2005/07/13 23:40:14 UTC
Multiple Select
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!
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by neo anderson <ja...@yahoo.co.uk>.
sorry. forget to ask another question.
I have another menu (jscookmenu) component also plugged in the html page.
After rendering the multiple selection. the menu page can not displayed any
more. What might cause such problem?
The components for menu and multiselection in html look like below:
<form jwcid="@Form" listener="listener:formSubmit">
<table>
<tr>
<td valign="top">
#
</td>
<td valign="top">
<table>
<tr>
<td>
<select jwcid="colorChooser@Select" multiple="ognl:true"
validators="validators:required">
<option jwcid="@Option"
selected="ognl:selection[currentColorIndex]" label="ognl:currentColor"/>
</select>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
neo anderson wrote:
>
> i follow the following page -
> http://tapestry.apache.org/tapestry4.1/components/form/select.html.
> And now I can render the multi-elect item on the page with its index set
> to 0, 1, 2, 3 ...
>
> However I want the index value to be string. For example, I have a color
> list {"yellow", "green", "red"}, which will be displayed in the html but
> with its option value set to, say, {"notice", "open", "stop"}.
>
> or in html code as below:
>
> <select name="colorList" multiple>
> <option value="notice">yellow</option>
> <option value="open">green</option>
> <option value="stop">red</option>
> </select>
>
> I have tried to implement getCurrentColorIndex in the java code, but it
> fails with "Unable to update OGNL expression ".
>
> What should I do?
>
> Thanks in advice.
>
>
> 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">
>>
>> <option jwcid="@Option" selected="ognl:color.selected"
>> label="ognl:color.name"/>
>>
>> </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: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Multiple-Select-tf144431.html#a13976706
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Multiple Select
Posted by neo anderson <ja...@yahoo.co.uk>.
i follow the following page -
http://tapestry.apache.org/tapestry4.1/components/form/select.html.
And now I can render the multi-elect item on the page with its index set to
0, 1, 2, 3 ...
However I want the index value to be string. For example, I have a color
list {"yellow", "green", "red"}, which will be displayed in the html but
with its option value set to, say, {"notice", "open", "stop"}.
or in html code as below:
<select name="colorList" multiple>
<option value="notice">yellow</option>
<option value="open">green</option>
<option value="stop">red</option>
</select>
I have tried to implement getCurrentColorIndex in the java code, but it
fails with "Unable to update OGNL expression ".
What should I do?
Thanks in advice.
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">
>
> <option jwcid="@Option" selected="ognl:color.selected"
> label="ognl:color.name"/>
>
> </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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Multiple-Select-tf144431.html#a13976675
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
thanks rob! that worked just fine with my list collection.
1 more ques...if i had to implement a similar class for Sets, how would one
handle the getOption and getLabel? I mean, since sets dont seem to gaurantee
an order...would it be tricky to implement the fore-mentioned two methods?
-Dan
>From: Robert Zeigler <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>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 <ro...@scazdl.org>
> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> 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 <ro...@scazdl.org>
> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> 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 <ro...@scazdl.org>
> >> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> >> 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="unenrolled@Block">
> >> >> >> Unenrolled
> >> >> >> </span>
> >> >> >> <span jwcid="enrolled@Block">
> >> >> >> 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!
> >> >> >> >
> >> >> >> >
>_________________________________________________________________
> >> >> >> > Dont just search. Find. Check out the new MSN Search!
> >> >> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >>
>---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail:
> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> > For additional commands, e-mail:
> >> >> tapestry-user-help@jakarta.apache.org
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail:
> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> For additional commands, e-mail:
> >> tapestry-user-help@jakarta.apache.org
> >> >> >>
> >> >> >
> >> >> > _________________________________________________________________
> >> >> > Dont just search. Find. Check out the new MSN Search!
> >> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >> >
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail:
>tapestry-user-unsubscribe@jakarta.apache.org
> >> >> > For additional commands, e-mail:
> >> tapestry-user-help@jakarta.apache.org
> >> >>
> >> >>
> >> >>
>---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >> >>
> >> >
> >> > _________________________________________________________________
> >> > 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: tapestry-user-unsubscribe@jakarta.apache.org
> >> > For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >
> > _________________________________________________________________
> > Dont just search. Find. Check out the new MSN Search!
> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
aaah...thats a gotcha! i had a listner on a submit in the form that checked
for size...movie the checking to listner of the form and voila! ... yes the
rewind..i keep forgettin it ..grrr .. thx again rob
>From: Robert Zeigler <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>Subject: Re: Multiple Select
>Date: Thu, 14 Jul 2005 16:43:51 -0500
>
>yeah, so, if you move the stuff around like they should be moved around
>and then submit the form, then /after/ the palette component has been
>rendered in the "rewind" stage of the submission, your collection should
>be updated; where are you checking the collection size?
>
>Robert
>
>Dan wrote:
> > oops i think i spoke too soon...
> > so when u click on the select/deselect btns in the palette wouldnt those
> > update the collection that is being referred by the selected property?
> > (visit.user.spokenLanguages from the eg below)
> > i do a get on this collection and i dont see any changes to its size?
> > i swear my code is ditto to what rob has in his example :)
> >
> >> From: "Dan " <po...@hotmail.com>
> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> To: tapestry-user@jakarta.apache.org
> >> Subject: Re: Multiple Select
> >> Date: Thu, 14 Jul 2005 18:47:30 +0000
> >>
> >> Ahh...i understand my mistake. thanks so much rob. ur help is
>invaluable!
> >> i had my code setup exactly the same...but heres wat i wasnt paying
> >> attn to:
> >> i was trying to add "instances" to the selected list which were "not"
> >> part of the model...and thus they would never appear!
> >> rocking! its works dude! ;)
> >>
> >>
> >>> From: Robert Zeigler <ro...@scazdl.org>
> >>> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >>> To: Tapestry users <ta...@jakarta.apache.org>
> >>> Subject: Re: Multiple Select
> >>> Date: Thu, 14 Jul 2005 13:05:38 -0500
> >>>
> >>> Dan wrote:
> >>> > hmm..i dont recognize the link though, between overriding equals and
> >>> > initializing the selected List ?
> >>> > maybe i m not on the same page as u :( i assume u r referring to
> >>> > overriding equals of the objects(model) inside the list? if thats
>the
> >>> > case, i already ve done that. could you please elaborate more?
> >>>
> >>> So, you've got your palette component...
> >>> parameter: selected, and model...
> >>> model contains the list of all possible selected values, right?
> >>> So... using the ListPropertySelectionModel, I'll put together a quick
> >>> example... something like:
> >>>
> >>> public class User {
> >>> public List getSpokenLanguages() {
> >>> ...
> >>> }
> >>> public void addToSpokenLanguages(Language l) {
> >>> getSpokenLanguages().add(l);
> >>> }
> >>> ...
> >>> }
> >>>
> >>> public class Language implements NamedListItem {
> >>> private String name;
> >>>
> >>> public String getItemName() {
> >>> return name;
> >>> }
> >>>
> >>> public Language(String name) {
> >>> this.name=name;
> >>> }
> >>> }
> >>>
> >>> template:
> >>>
> >>> ...
> >>> <select jwcid="@contrib:Palette"
> >>> selected="ognl:visit.user.spokenLanguages"
>model="ognl:languageModel"/>
> >>>
> >>> page.java:
> >>> ...
> >>> IPropertySelectionModel languageModel=null;
> >>> public IPropertySelectionModel getLanguageModel() {
> >>> if (languageModel == null) {
> >>> List languages = new ArrayList();
> >>> languages.add(new Language("English"));
> >>> languages.add(new Language("French"));
> >>> languages.add(new Language("Japanese"));
> >>> }
> >>> return languageModel;
> >>> }
> >>>
> >>>
> >>> So... then the question is... suppose that you need to have some
> >>> languages preselected...
> >>> The first key is to have those languages in the list returned by
> >>> "getSpokenLanguages". Now, suppose that you know that every user
> >>> of your particular system at least speaks english, so, in your init
> >>> code for the user, you do something like:
> >>>
> >>> this.addToSpokenLanguages(new Language("English"));
> >>>
> >>> Now when you hit the palette page, "English" will NOT be in the
>selected
> >>> page still. Because the "English" instance in the "SpokenLanguages"
> >>> list is different than the instance in the model. So, the second
> >>> key is to make sure that equals returns true when it should.
> >>> (Or else, the second key is to ensure that the instances actually are
> >>> the same. :)
> >>>
> >>> So, going back to the language class...
> >>>
> >>> public class Language ... {
> >>> ...
> >>> public boolean equals(Object o) {
> >>> return o!=null && o instanceof Language &&
> >>> ((Language)o).getItemName().equals(this.name);
> >>> }
> >>> }
> >>>
> >>> With that addition, and with the bit of init code above (add english
>to
> >>> the spoken language list), then when you hit the page with the palette
> >>> component, "English" will be selected.
> >>>
> >>> Robert
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>>
> >>
> >> _________________________________________________________________
> >> Express yourself instantly with MSN Messenger! Download today - it's
> >> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today - it's
> > FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Robert Zeigler <ro...@scazdl.org>.
yeah, so, if you move the stuff around like they should be moved around
and then submit the form, then /after/ the palette component has been
rendered in the "rewind" stage of the submission, your collection should
be updated; where are you checking the collection size?
Robert
Dan wrote:
> oops i think i spoke too soon...
> so when u click on the select/deselect btns in the palette wouldnt those
> update the collection that is being referred by the selected property?
> (visit.user.spokenLanguages from the eg below)
> i do a get on this collection and i dont see any changes to its size?
> i swear my code is ditto to what rob has in his example :)
>
>> From: "Dan " <po...@hotmail.com>
>> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> To: tapestry-user@jakarta.apache.org
>> Subject: Re: Multiple Select
>> Date: Thu, 14 Jul 2005 18:47:30 +0000
>>
>> Ahh...i understand my mistake. thanks so much rob. ur help is invaluable!
>> i had my code setup exactly the same...but heres wat i wasnt paying
>> attn to:
>> i was trying to add "instances" to the selected list which were "not"
>> part of the model...and thus they would never appear!
>> rocking! its works dude! ;)
>>
>>
>>> From: Robert Zeigler <ro...@scazdl.org>
>>> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>>> To: Tapestry users <ta...@jakarta.apache.org>
>>> Subject: Re: Multiple Select
>>> Date: Thu, 14 Jul 2005 13:05:38 -0500
>>>
>>> Dan wrote:
>>> > hmm..i dont recognize the link though, between overriding equals and
>>> > initializing the selected List ?
>>> > maybe i m not on the same page as u :( i assume u r referring to
>>> > overriding equals of the objects(model) inside the list? if thats the
>>> > case, i already ve done that. could you please elaborate more?
>>>
>>> So, you've got your palette component...
>>> parameter: selected, and model...
>>> model contains the list of all possible selected values, right?
>>> So... using the ListPropertySelectionModel, I'll put together a quick
>>> example... something like:
>>>
>>> public class User {
>>> public List getSpokenLanguages() {
>>> ...
>>> }
>>> public void addToSpokenLanguages(Language l) {
>>> getSpokenLanguages().add(l);
>>> }
>>> ...
>>> }
>>>
>>> public class Language implements NamedListItem {
>>> private String name;
>>>
>>> public String getItemName() {
>>> return name;
>>> }
>>>
>>> public Language(String name) {
>>> this.name=name;
>>> }
>>> }
>>>
>>> template:
>>>
>>> ...
>>> <select jwcid="@contrib:Palette"
>>> selected="ognl:visit.user.spokenLanguages" model="ognl:languageModel"/>
>>>
>>> page.java:
>>> ...
>>> IPropertySelectionModel languageModel=null;
>>> public IPropertySelectionModel getLanguageModel() {
>>> if (languageModel == null) {
>>> List languages = new ArrayList();
>>> languages.add(new Language("English"));
>>> languages.add(new Language("French"));
>>> languages.add(new Language("Japanese"));
>>> }
>>> return languageModel;
>>> }
>>>
>>>
>>> So... then the question is... suppose that you need to have some
>>> languages preselected...
>>> The first key is to have those languages in the list returned by
>>> "getSpokenLanguages". Now, suppose that you know that every user
>>> of your particular system at least speaks english, so, in your init
>>> code for the user, you do something like:
>>>
>>> this.addToSpokenLanguages(new Language("English"));
>>>
>>> Now when you hit the palette page, "English" will NOT be in the selected
>>> page still. Because the "English" instance in the "SpokenLanguages"
>>> list is different than the instance in the model. So, the second
>>> key is to make sure that equals returns true when it should.
>>> (Or else, the second key is to ensure that the instances actually are
>>> the same. :)
>>>
>>> So, going back to the language class...
>>>
>>> public class Language ... {
>>> ...
>>> public boolean equals(Object o) {
>>> return o!=null && o instanceof Language &&
>>> ((Language)o).getItemName().equals(this.name);
>>> }
>>> }
>>>
>>> With that addition, and with the bit of init code above (add english to
>>> the spoken language list), then when you hit the page with the palette
>>> component, "English" will be selected.
>>>
>>> Robert
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>
>> _________________________________________________________________
>> Express yourself instantly with MSN Messenger! Download today - it's
>> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's
> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
oops i think i spoke too soon...
so when u click on the select/deselect btns in the palette wouldnt those
update the collection that is being referred by the selected property?
(visit.user.spokenLanguages from the eg below)
i do a get on this collection and i dont see any changes to its size?
i swear my code is ditto to what rob has in his example :)
>From: "Dan " <po...@hotmail.com>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: tapestry-user@jakarta.apache.org
>Subject: Re: Multiple Select
>Date: Thu, 14 Jul 2005 18:47:30 +0000
>
>Ahh...i understand my mistake. thanks so much rob. ur help is invaluable!
>i had my code setup exactly the same...but heres wat i wasnt paying attn
>to:
>i was trying to add "instances" to the selected list which were "not" part
>of the model...and thus they would never appear!
>rocking! its works dude! ;)
>
>
>>From: Robert Zeigler <ro...@scazdl.org>
>>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>>To: Tapestry users <ta...@jakarta.apache.org>
>>Subject: Re: Multiple Select
>>Date: Thu, 14 Jul 2005 13:05:38 -0500
>>
>>Dan wrote:
>> > hmm..i dont recognize the link though, between overriding equals and
>> > initializing the selected List ?
>> > maybe i m not on the same page as u :( i assume u r referring to
>> > overriding equals of the objects(model) inside the list? if thats the
>> > case, i already ve done that. could you please elaborate more?
>>
>>So, you've got your palette component...
>>parameter: selected, and model...
>>model contains the list of all possible selected values, right?
>>So... using the ListPropertySelectionModel, I'll put together a quick
>>example... something like:
>>
>>public class User {
>> public List getSpokenLanguages() {
>> ...
>> }
>> public void addToSpokenLanguages(Language l) {
>> getSpokenLanguages().add(l);
>> }
>> ...
>>}
>>
>>public class Language implements NamedListItem {
>> private String name;
>>
>> public String getItemName() {
>> return name;
>> }
>>
>> public Language(String name) {
>> this.name=name;
>> }
>>}
>>
>>template:
>>
>>...
>><select jwcid="@contrib:Palette"
>>selected="ognl:visit.user.spokenLanguages" model="ognl:languageModel"/>
>>
>>page.java:
>>...
>>IPropertySelectionModel languageModel=null;
>>public IPropertySelectionModel getLanguageModel() {
>> if (languageModel == null) {
>> List languages = new ArrayList();
>> languages.add(new Language("English"));
>> languages.add(new Language("French"));
>> languages.add(new Language("Japanese"));
>> }
>> return languageModel;
>>}
>>
>>
>>So... then the question is... suppose that you need to have some
>>languages preselected...
>>The first key is to have those languages in the list returned by
>>"getSpokenLanguages". Now, suppose that you know that every user
>>of your particular system at least speaks english, so, in your init
>>code for the user, you do something like:
>>
>>this.addToSpokenLanguages(new Language("English"));
>>
>>Now when you hit the palette page, "English" will NOT be in the selected
>>page still. Because the "English" instance in the "SpokenLanguages"
>>list is different than the instance in the model. So, the second
>>key is to make sure that equals returns true when it should.
>>(Or else, the second key is to ensure that the instances actually are
>>the same. :)
>>
>>So, going back to the language class...
>>
>>public class Language ... {
>>...
>> public boolean equals(Object o) {
>> return o!=null && o instanceof Language &&
>>((Language)o).getItemName().equals(this.name);
>> }
>>}
>>
>>With that addition, and with the bit of init code above (add english to
>>the spoken language list), then when you hit the page with the palette
>>component, "English" will be selected.
>>
>>Robert
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>_________________________________________________________________
>Express yourself instantly with MSN Messenger! Download today - it's FREE!
>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
Ahh...i understand my mistake. thanks so much rob. ur help is invaluable!
i had my code setup exactly the same...but heres wat i wasnt paying attn to:
i was trying to add "instances" to the selected list which were "not" part
of the model...and thus they would never appear!
rocking! its works dude! ;)
>From: Robert Zeigler <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>Subject: Re: Multiple Select
>Date: Thu, 14 Jul 2005 13:05:38 -0500
>
>Dan wrote:
> > hmm..i dont recognize the link though, between overriding equals and
> > initializing the selected List ?
> > maybe i m not on the same page as u :( i assume u r referring to
> > overriding equals of the objects(model) inside the list? if thats the
> > case, i already ve done that. could you please elaborate more?
>
>So, you've got your palette component...
>parameter: selected, and model...
>model contains the list of all possible selected values, right?
>So... using the ListPropertySelectionModel, I'll put together a quick
>example... something like:
>
>public class User {
> public List getSpokenLanguages() {
> ...
> }
> public void addToSpokenLanguages(Language l) {
> getSpokenLanguages().add(l);
> }
> ...
>}
>
>public class Language implements NamedListItem {
> private String name;
>
> public String getItemName() {
> return name;
> }
>
> public Language(String name) {
> this.name=name;
> }
>}
>
>template:
>
>...
><select jwcid="@contrib:Palette"
>selected="ognl:visit.user.spokenLanguages" model="ognl:languageModel"/>
>
>page.java:
>...
>IPropertySelectionModel languageModel=null;
>public IPropertySelectionModel getLanguageModel() {
> if (languageModel == null) {
> List languages = new ArrayList();
> languages.add(new Language("English"));
> languages.add(new Language("French"));
> languages.add(new Language("Japanese"));
> }
> return languageModel;
>}
>
>
>So... then the question is... suppose that you need to have some
>languages preselected...
>The first key is to have those languages in the list returned by
>"getSpokenLanguages". Now, suppose that you know that every user
>of your particular system at least speaks english, so, in your init
>code for the user, you do something like:
>
>this.addToSpokenLanguages(new Language("English"));
>
>Now when you hit the palette page, "English" will NOT be in the selected
>page still. Because the "English" instance in the "SpokenLanguages"
>list is different than the instance in the model. So, the second
>key is to make sure that equals returns true when it should.
>(Or else, the second key is to ensure that the instances actually are
>the same. :)
>
>So, going back to the language class...
>
>public class Language ... {
>...
> public boolean equals(Object o) {
> return o!=null && o instanceof Language &&
>((Language)o).getItemName().equals(this.name);
> }
>}
>
>With that addition, and with the bit of init code above (add english to
>the spoken language list), then when you hit the page with the palette
>component, "English" will be selected.
>
>Robert
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Robert Zeigler <ro...@scazdl.org>.
Dan wrote:
> hmm..i dont recognize the link though, between overriding equals and
> initializing the selected List ?
> maybe i m not on the same page as u :( i assume u r referring to
> overriding equals of the objects(model) inside the list? if thats the
> case, i already ve done that. could you please elaborate more?
So, you've got your palette component...
parameter: selected, and model...
model contains the list of all possible selected values, right?
So... using the ListPropertySelectionModel, I'll put together a quick
example... something like:
public class User {
public List getSpokenLanguages() {
...
}
public void addToSpokenLanguages(Language l) {
getSpokenLanguages().add(l);
}
...
}
public class Language implements NamedListItem {
private String name;
public String getItemName() {
return name;
}
public Language(String name) {
this.name=name;
}
}
template:
...
<select jwcid="@contrib:Palette"
selected="ognl:visit.user.spokenLanguages" model="ognl:languageModel"/>
page.java:
...
IPropertySelectionModel languageModel=null;
public IPropertySelectionModel getLanguageModel() {
if (languageModel == null) {
List languages = new ArrayList();
languages.add(new Language("English"));
languages.add(new Language("French"));
languages.add(new Language("Japanese"));
}
return languageModel;
}
So... then the question is... suppose that you need to have some
languages preselected...
The first key is to have those languages in the list returned by
"getSpokenLanguages". Now, suppose that you know that every user
of your particular system at least speaks english, so, in your init
code for the user, you do something like:
this.addToSpokenLanguages(new Language("English"));
Now when you hit the palette page, "English" will NOT be in the selected
page still. Because the "English" instance in the "SpokenLanguages"
list is different than the instance in the model. So, the second
key is to make sure that equals returns true when it should.
(Or else, the second key is to ensure that the instances actually are
the same. :)
So, going back to the language class...
public class Language ... {
...
public boolean equals(Object o) {
return o!=null && o instanceof Language &&
((Language)o).getItemName().equals(this.name);
}
}
With that addition, and with the bit of init code above (add english to
the spoken language list), then when you hit the page with the palette
component, "English" will be selected.
Robert
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
hmm..i dont recognize the link though, between overriding equals and
initializing the selected List ?
maybe i m not on the same page as u :( i assume u r referring to overriding
equals of the objects(model) inside the list? if thats the case, i already
ve done that. could you please elaborate more?
>From: Robert Zeigler <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>Subject: Re: Multiple Select
>Date: Thu, 14 Jul 2005 12:35:01 -0500
>
>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 <ro...@scazdl.org>
> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> 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 <ro...@scazdl.org>
> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> 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 <ro...@scazdl.org>
> >> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> >> 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 <ro...@scazdl.org>
> >> >> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> >> >> 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="unenrolled@Block">
> >> >> >> >> Unenrolled
> >> >> >> >> </span>
> >> >> >> >> <span jwcid="enrolled@Block">
> >> >> >> >> 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!
> >> >> >> >> >
> >> >> >> >> >
> >> _________________________________________________________________
> >> >> >> >> > Dont just search. Find. Check out the new MSN Search!
> >> >> >> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> >> > To unsubscribe, e-mail:
> >> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> >> > For additional commands, e-mail:
> >> >> >> tapestry-user-help@jakarta.apache.org
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >>
>---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail:
> >> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> >> For additional commands, e-mail:
> >> >> tapestry-user-help@jakarta.apache.org
> >> >> >> >>
> >> >> >> >
> >> >> >> >
>_________________________________________________________________
> >> >> >> > Dont just search. Find. Check out the new MSN Search!
> >> >> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >>
>---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail:
> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> > For additional commands, e-mail:
> >> >> tapestry-user-help@jakarta.apache.org
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail:
> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> For additional commands, e-mail:
> >> tapestry-user-help@jakarta.apache.org
> >> >> >>
> >> >> >
> >> >> > _________________________________________________________________
> >> >> > 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:
>tapestry-user-unsubscribe@jakarta.apache.org
> >> >> > For additional commands, e-mail:
> >> tapestry-user-help@jakarta.apache.org
> >> >>
> >> >>
> >> >>
>---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >> >>
> >> >
> >> > _________________________________________________________________
> >> > Dont just search. Find. Check out the new MSN Search!
> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> > For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >
> > _________________________________________________________________
> > 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: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Robert Zeigler <ro...@scazdl.org>.
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 <ro...@scazdl.org>
>> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> To: Tapestry users <ta...@jakarta.apache.org>
>> 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 <ro...@scazdl.org>
>> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> >> To: Tapestry users <ta...@jakarta.apache.org>
>> >> 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 <ro...@scazdl.org>
>> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> >> >> To: Tapestry users <ta...@jakarta.apache.org>
>> >> >> 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 <ro...@scazdl.org>
>> >> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> >> >> >> To: Tapestry users <ta...@jakarta.apache.org>
>> >> >> >> 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="unenrolled@Block">
>> >> >> >> Unenrolled
>> >> >> >> </span>
>> >> >> >> <span jwcid="enrolled@Block">
>> >> >> >> 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:
>> >> tapestry-user-unsubscribe@jakarta.apache.org
>> >> >> >> > For additional commands, e-mail:
>> >> >> tapestry-user-help@jakarta.apache.org
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail:
>> >> tapestry-user-unsubscribe@jakarta.apache.org
>> >> >> >> For additional commands, e-mail:
>> >> tapestry-user-help@jakarta.apache.org
>> >> >> >>
>> >> >> >
>> >> >> > _________________________________________________________________
>> >> >> > 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:
>> tapestry-user-unsubscribe@jakarta.apache.org
>> >> >> > For additional commands, e-mail:
>> >> tapestry-user-help@jakarta.apache.org
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail:
>> tapestry-user-unsubscribe@jakarta.apache.org
>> >> >> For additional commands, e-mail:
>> tapestry-user-help@jakarta.apache.org
>> >> >>
>> >> >
>> >> > _________________________________________________________________
>> >> > 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: tapestry-user-unsubscribe@jakarta.apache.org
>> >> > For additional commands, e-mail:
>> tapestry-user-help@jakarta.apache.org
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>> >>
>> >
>> > _________________________________________________________________
>> > 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: tapestry-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
> _________________________________________________________________
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
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 <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>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 <ro...@scazdl.org>
> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> 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 <ro...@scazdl.org>
> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> 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 <ro...@scazdl.org>
> >> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> >> 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="unenrolled@Block">
> >> >> >> Unenrolled
> >> >> >> </span>
> >> >> >> <span jwcid="enrolled@Block">
> >> >> >> 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!
> >> >> >> >
> >> >> >> >
>_________________________________________________________________
> >> >> >> > Dont just search. Find. Check out the new MSN Search!
> >> >> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >>
>---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail:
> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> > For additional commands, e-mail:
> >> >> tapestry-user-help@jakarta.apache.org
> >> >> >>
> >> >> >>
> >> >> >>
> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail:
> >> tapestry-user-unsubscribe@jakarta.apache.org
> >> >> >> For additional commands, e-mail:
> >> tapestry-user-help@jakarta.apache.org
> >> >> >>
> >> >> >
> >> >> > _________________________________________________________________
> >> >> > Dont just search. Find. Check out the new MSN Search!
> >> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >> >
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail:
>tapestry-user-unsubscribe@jakarta.apache.org
> >> >> > For additional commands, e-mail:
> >> tapestry-user-help@jakarta.apache.org
> >> >>
> >> >>
> >> >>
>---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >> >>
> >> >
> >> > _________________________________________________________________
> >> > 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: tapestry-user-unsubscribe@jakarta.apache.org
> >> > For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >
> > _________________________________________________________________
> > Dont just search. Find. Check out the new MSN Search!
> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Robert Zeigler <ro...@scazdl.org>.
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 <ro...@scazdl.org>
>> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> To: Tapestry users <ta...@jakarta.apache.org>
>> 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 <ro...@scazdl.org>
>> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> >> To: Tapestry users <ta...@jakarta.apache.org>
>> >> 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 <ro...@scazdl.org>
>> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> >> >> To: Tapestry users <ta...@jakarta.apache.org>
>> >> >> 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="unenrolled@Block">
>> >> >> Unenrolled
>> >> >> </span>
>> >> >> <span jwcid="enrolled@Block">
>> >> >> 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:
>> tapestry-user-unsubscribe@jakarta.apache.org
>> >> >> > For additional commands, e-mail:
>> >> tapestry-user-help@jakarta.apache.org
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail:
>> tapestry-user-unsubscribe@jakarta.apache.org
>> >> >> For additional commands, e-mail:
>> tapestry-user-help@jakarta.apache.org
>> >> >>
>> >> >
>> >> > _________________________________________________________________
>> >> > 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: tapestry-user-unsubscribe@jakarta.apache.org
>> >> > For additional commands, e-mail:
>> tapestry-user-help@jakarta.apache.org
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>> >>
>> >
>> > _________________________________________________________________
>> > 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: tapestry-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
> _________________________________________________________________
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
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 <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>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 <ro...@scazdl.org>
> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> 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 <ro...@scazdl.org>
> >> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> >> 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="unenrolled@Block">
> >> >> Unenrolled
> >> >> </span>
> >> >> <span jwcid="enrolled@Block">
> >> >> 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!
> >> >> >
> >> >> > _________________________________________________________________
> >> >> > Dont just search. Find. Check out the new MSN Search!
> >> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >> >
> >> >> >
> >> >> >
> >> ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail:
>tapestry-user-unsubscribe@jakarta.apache.org
> >> >> > For additional commands, e-mail:
> >> tapestry-user-help@jakarta.apache.org
> >> >>
> >> >>
> >> >>
>---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> >> For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >> >>
> >> >
> >> > _________________________________________________________________
> >> > Dont just search. Find. Check out the new MSN Search!
> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> > For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >
> > _________________________________________________________________
> > 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: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Robert Zeigler <ro...@scazdl.org>.
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 <ro...@scazdl.org>
>> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> To: Tapestry users <ta...@jakarta.apache.org>
>> 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 <ro...@scazdl.org>
>> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> >> To: Tapestry users <ta...@jakarta.apache.org>
>> >> 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="unenrolled@Block">
>> >> Unenrolled
>> >> </span>
>> >> <span jwcid="enrolled@Block">
>> >> 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: tapestry-user-unsubscribe@jakarta.apache.org
>> >> > For additional commands, e-mail:
>> tapestry-user-help@jakarta.apache.org
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>> >>
>> >
>> > _________________________________________________________________
>> > 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: tapestry-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
> _________________________________________________________________
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
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 <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>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 <ro...@scazdl.org>
> >> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
> >> To: Tapestry users <ta...@jakarta.apache.org>
> >> 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="unenrolled@Block">
> >> Unenrolled
> >> </span>
> >> <span jwcid="enrolled@Block">
> >> 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!
> >> >
> >> > _________________________________________________________________
> >> > Dont just search. Find. Check out the new MSN Search!
> >> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> > For additional commands, e-mail:
>tapestry-user-help@jakarta.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >
> > _________________________________________________________________
> > Dont just search. Find. Check out the new MSN Search!
> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
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: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Robert Zeigler <ro...@scazdl.org>.
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 <ro...@scazdl.org>
>> Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>> To: Tapestry users <ta...@jakarta.apache.org>
>> 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="unenrolled@Block">
>> Unenrolled
>> </span>
>> <span jwcid="enrolled@Block">
>> 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: tapestry-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
> _________________________________________________________________
> 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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Dan � <po...@hotmail.com>.
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 <ro...@scazdl.org>
>Reply-To: "Tapestry users" <ta...@jakarta.apache.org>
>To: Tapestry users <ta...@jakarta.apache.org>
>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="unenrolled@Block">
> Unenrolled
></span>
><span jwcid="enrolled@Block">
> 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!
> >
> > _________________________________________________________________
> > Dont just search. Find. Check out the new MSN Search!
> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
_________________________________________________________________
Dont just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Multiple Select
Posted by Robert Zeigler <ro...@scazdl.org>.
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="unenrolled@Block">
Unenrolled
</span>
<span jwcid="enrolled@Block">
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: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org