Re: Tapestry 5.2.5 Select component's multiple property
Hi Taha, I am new to tapestry and am trying to build multi select box and i believe your codes will help me. Could you please also share the codes for MultipleValueEncoder class. Thanks. Regards Raj -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p5715740.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Hi http://svn.codehaus.org/chenillekit/trunk/chenillekit-tapestry/src/main/java/org/chenillekit/tapestry/core/encoders/MultipleValueEncoder.java regards Taha On Aug 23, 2012, at 9:06 AM, rmrajkumar77 wrote: Hi Taha, I am new to tapestry and am trying to build multi select box and i believe your codes will help me. Could you please also share the codes for MultipleValueEncoder class. Thanks. Regards Raj -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p5715740.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
At first I used myList for the first field with multiple select and it worked. When I wanted to have two fields with multiple select I took myList out of the picture by commenting it out and used two new lists myList1 and myList2. However, in the methods getEncoder() and getModel() I originally used myList in the inner for loops that go through myList respectively like this, --- for(MyObject myObject: myList) if(myObject.getId().equals(Integer.parseInt(value))){ objects.add(myObject); } -- for(final MyObject myObject: myList){ options.add(new OptionModelImpl(myObject.getName(), myObject)); } Now that I want to use myList1 and myList2 I don't know how to deal with the methods getEncoder and getModel in terms of what to replace myList with!! I'm not getting error messages with the code above, it's just when I select multiple values from the two fields and submit the form, I expect the two lists interestCodes and ficeCodes to have values but what I'm getting is empty lists. interestCodes and ficeCodes are used in the tml file like this: t:MultipleSelect value='interestCodes' model='myList1' encoder='encoder'/ t:MultipleSelect value='ficeCodes' model='myList2' encoder='encoder'/ They are defined in the java file as: @Property private ListMyObject interestCodes; @Property private ListMyObject ficeCodes; Any insights would be highly appreciated! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p5713981.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Here's the java code: package edu.asu.wit.eadvisor.ds.t5.pages.t5.admin; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Comparator; import javax.servlet.http.HttpServletRequest; import org.apache.tapestry.annotations.Component; import org.apache.tapestry5.OptionGroupModel; import org.apache.tapestry5.OptionModel; import org.apache.tapestry5.PersistenceConstants; import org.apache.tapestry5.SelectModel; import org.apache.tapestry5.annotations.InjectPage; import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.internal.OptionModelImpl; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.util.AbstractSelectModel; import edu.asu.wit.eadvisor.ds.hib.dao.TransferAgreementsDao; import edu.asu.wit.eadvisor.ds.hib.eadvisor.TransferCaCollege; import edu.asu.wit.eadvisor.ds.hib.eadvisor.TransferCaCollegeMajor; import edu.asu.wit.eadvisor.ds.hib.eadvisor.TransferCaInterestArea; import edu.asu.wit.eadvisor.ds.t5.components.MultipleValueEncoder; public class TransferAddAreaToCollege { @Property //@Persist(PersistenceConstants.FLASH) private ListMyObject interestCodes; @Property private ListMyObject ficeCodes; @Property private String notes; @Property private MapString, String collegesList; @Property private MapString, String areasList; @Property private ListMyObject myList; @Property private ListMyObject myList1; @Property private ListMyObject myList2; @Property @Persist(flash) private String message; @Inject private TransferAgreementsDao dao; @Inject private HttpServletRequest request; @InjectPage private TransferAddAreaToCollege page; public Object onActivate(){ if(!request.getRequestURL().toString().contains(admin)) return page; else{ if(interestCodes == null){ interestCodes = new ArrayListMyObject(); } if(ficeCodes == null){ ficeCodes = new ArrayListMyObject(); } ListTransferCaCollege colleges = dao.getCollegeList(); MapString, String m1 = new HashMapString, String(); for (int i=0; icolleges.size(); i++) { m1.put(colleges.get(i).getFiceCode(), colleges.get(i).getCollegeName()); } Maplt;String,String sortedM1 = sortByComparator(m1); collegesList = sortedM1; ListTransferCaInterestArea areas = dao.getInterestAreaList(); MapString, String m2 = new HashMapString, String(); for (int i=0; iareas.size(); i++) { m2.put(areas.get(i).getInterestCode().toString(), areas.get(i).getAsuArea()); } Maplt;String,String sortedM2 = sortByComparator(m2); areasList = sortedM2; //myList = new ArrayListMyObject(); //notice this what i used first and it worked with the model in the tml file set to model=myList myList1 = new ArrayListMyObject(); // this is added when I wanted to have to fields with multiple select myList2 = new ArrayListMyObject(); // this is added when I wanted to have to fields with multiple select Object[] keys1 = areasList.keySet().toArray(); Object[] keys2 = collegesList.keySet().toArray(); for (int i=0; i keys1.length; i++){ //System.out.println(--- + i + : +areasList.get(i) ); MyObject obj = new MyObject(new Integer((String)keys1[i]), areasList.get((String)keys1[i])); myList1.add(obj); } for (int i=0; i keys2.length; i++){ //System.out.println(--- + i + : +areasList.get(i) ); MyObject obj = new MyObject(new Integer((String)keys2[i]), collegesList.get((String)keys2[i])); myList2.add(obj); } return null; } }
Re: Tapestry 5.2.5 Select component's multiple property
You have not mentioned what error you are getting ? Also, what is myList ? It is never initialized regards Taha On May 19, 2012, at 12:49 PM, Ab wrote: myList
Re: Tapestry 5.2.5 Select component's multiple property
Hey Taha, I was using the code you posted to allow multiple selects and it worked perfectly with ONE t:MultipleSelect component. However, I'm working on a web page with two fields that are MultipleSelect. How do I accomplish that. In both getRender and getModel you're using myList. In my case I have to lists, myList1 and myList2 which is problematic. Any suggestions? Thanks Ab -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p5711791.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Hi I can't see how it is problematic. Can you share the code ? regards Taha On May 18, 2012, at 2:30 PM, Ab wrote: Hey Taha, I was using the code you posted to allow multiple selects and it worked perfectly with ONE t:MultipleSelect component. However, I'm working on a web page with two fields that are MultipleSelect. How do I accomplish that. In both getRender and getModel you're using myList. In my case I have to lists, myList1 and myList2 which is problematic. Any suggestions? Thanks Ab -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p5711791.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Anyone has any idea how to troubleshoot this multiselect component? Any tips on how to preselect the item in the list will be nice. Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4329062.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
One thing I noticed is, in my form I used the following - form t:type=beaneditform object=user t:parameter name=id ${user.id} /t:parameter t:parameter name=userRole label t:type=Label for=userRole/ t:ck.MultipleSelect t:id=userRole value='selectedList' model='model' encoder='encoder'/ * select more than once for multiple roles /t:parameter /form Is the above causing the incorrect behavior that I am seeing (not remembering selected values)? TIA -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4329635.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
What is the value of selectedList when you render the component? Isn't this supposed to contain the values that are selected? On Wed, Apr 20, 2011 at 5:11 PM, TG tapestry...@hotmail.com wrote: One thing I noticed is, in my form I used the following - form t:type=beaneditform object=user t:parameter name=id ${user.id} /t:parameter t:parameter name=userRole label t:type=Label for=userRole/ t:ck.MultipleSelect t:id=userRole value='selectedList' model='model' encoder='encoder'/ * select more than once for multiple roles /t:parameter /form Is the above causing the incorrect behavior that I am seeing (not remembering selected values)? TIA -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4329635.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
You can populate the selectedList in onPrepareForRender(){ //Populate with values } regards Taha On Thu, Apr 21, 2011 at 5:49 AM, Josh Canfield joshcanfi...@gmail.comwrote: What is the value of selectedList when you render the component? Isn't this supposed to contain the values that are selected? On Wed, Apr 20, 2011 at 5:11 PM, TG tapestry...@hotmail.com wrote: One thing I noticed is, in my form I used the following - form t:type=beaneditform object=user t:parameter name=id ${user.id} /t:parameter t:parameter name=userRole label t:type=Label for=userRole/ t:ck.MultipleSelect t:id=userRole value='selectedList' model='model' encoder='encoder'/ * select more than once for multiple roles /t:parameter /form Is the above causing the incorrect behavior that I am seeing (not remembering selected values)? TIA -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4329635.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Can I replace MyObject with the Enum type e.g. UserRole? Will it work? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4313085.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
For the sake of anyone else that might find this useful, this is how I addressed it - UserRole[] roles = UserRole.values(); for(int i = 0; i roles.length; ++i){ myList.add(roles[i]); } and it works. Let me know if there is any better way to do this. Thanks again to all who helped me especially Taha for the sample codes. Case closed. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4313808.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Hi Yes you can. In case of an enum, you can get the list using Enum.values(), you can use EnumSelectModel as your model and the implement MultipleValueEncoder for enum. regards Taha tawus.wordpress.com On Tue, Apr 19, 2011 at 5:28 PM, TG tapestry...@hotmail.com wrote: Can I replace MyObject with the Enum type e.g. UserRole? Will it work? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4313085.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --
Re: Tapestry 5.2.5 Select component's multiple property
I just realized that I have one more question, hope you do not mind. If let's say the user's select A, B and D, when the multipleselect component is rendered, how do I pre-select A, B and D correspondingly? What do I need to do (without changing the HTML myself for instance, which defeats the purpose of using the component)? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4314064.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
On Tue, 19 Apr 2011 15:33:53 -0300, TG tapestry...@hotmail.com wrote: If let's say the user's select A, B and D, when the multipleselect component is rendered, how do I pre-select A, B and D correspondingly? If it doesn't do this automatically, like any Tapestry component provided out of the box, it should. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
It does not. I selected two items, go back to it, it remember. But if I saved it into the database, leave the page (goto some other functionalities for instance), come back again to the page with the multiple select, they are obviously not selected. Question is, how do I make/set the two items to be selected again? Sorry if it does not makes sense, English is not my first language. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4314436.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
ANymore kind soul out there that can help? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4311399.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Your sample codes works, thanks for that! :) Now, how do I make use of this, as my codes use Enum type? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4312003.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Is this http://wiki.apache.org/tapestry/Tapestry5MultipleSelectOnObjects the right codes to follow? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4309784.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Hi Taha, Could you send me all the codes? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4307637.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Hey Josh, Thanks for your reply. But when I use MultipleSelect, I got this error - An unexpected application exception has occurred. org.apache.tapestry5.ioc.internal.OperationException Unable to resolve 'MultipleSelect' to a component class name. availableValues Component types: ActionLink AddRowLink AjaxFormLoop Any BeanDisplay BeanEditForm BeanEditor Checkbox ChromeFrame DateField Delegate Error Errors EventLink ExceptionDisplay Form FormFragment FormInjector Grid GridCell GridColumns GridPager GridRows Hidden If Label Layout LinkSubmit Loop Output OutputRaw PageLink Palette PasswordField ProgressiveDisplay PropertyDisplay PropertyEditor Radio RadioGroup RemoveRowLink RenderObject Select Submit SubmitNotifier TextArea TextField TextOutput Trigger Unless Zone ... How do I install/get MultipleSelect component? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4305716.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
http://www.chenillekit.org/mvnrepo.html It's a third party component so you need to download it. On Apr 15, 2011 7:41 AM, TG tapestry...@hotmail.com wrote: Hey Josh, Thanks for your reply. But when I use MultipleSelect, I got this error - An unexpected application exception has occurred. org.apache.tapestry5.ioc.internal.OperationException Unable to resolve 'MultipleSelect' to a component class name. availableValues Component types: ActionLink AddRowLink AjaxFormLoop Any BeanDisplay BeanEditForm BeanEditor Checkbox ChromeFrame DateField Delegate Error Errors EventLink ExceptionDisplay Form FormFragment FormInjector Grid GridCell GridColumns GridPager GridRows Hidden If Label Layout LinkSubmit Loop Output OutputRaw PageLink Palette PasswordField ProgressiveDisplay PropertyDisplay PropertyEditor Radio RadioGroup RemoveRowLink RenderObject Select Submit SubmitNotifier TextArea TextField TextOutput Trigger Unless Zone ... How do I install/get MultipleSelect component? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4305716.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
You want ChenilleKit 1.3.2, 1.1.0 is for older version of Tapestry. On 04/15/2011 12:26 PM, TG wrote: I do not use maven2. But I downloaded chenillekit-tapestry-1.1.0.jar manually, installed, run again and I got a new error during bootup - Caused by: java.lang.ClassNotFoundException: org.apache.tapestry5.internal.services.RequestPathOptimizer Seems like RequestPathOptimizer is not part of Tapestry 5.2.5 anymore? What version of Tapestry do you use? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4305974.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Ok that helps. Installed 1.3.2 but how do I use it in the .tml file? What is the namespace I need to import? I asked as I still have the same not found error i.e. Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Unable to resolve 'MultipleSelect' to a component class name. [at classpath:tapp/.../...(truncated for simplicity).../pages/UserSave.tml, line 18] at org.apache.tapestry5.internal.pageload.PageLoaderImpl.startComponent(PageLoaderImpl.java:743) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:627) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:426) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.consumeToEndElementAndPopBodyElement(PageLoaderImpl.java:611) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.parameter(PageLoaderImpl.java:559) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:443) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:648) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:426) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.element(PageLoaderImpl.java:687) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:421) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:648) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:426) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.programAssembler(PageLoaderImpl.java:264) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.access$900(PageLoaderImpl.java:65) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:236) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:220) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) ... 84 more Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Unable to resolve 'MultipleSelect' to a component class name. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306041.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
I believe you would do t:ck.MultipleSelect ... / It's just like any custom component you might make that has a package beyond *.components, you write out the extra packages in front of the component class name to qualify it. I checked my code and I guess I also do it a different way: input t:type=MultipleSelect t:id=mselect value=pageList model=pageListModel encoder=pageListModel/ @Property @Persist private GenericMultipleSelectModelMenuLink pageListModel; @Component private MultipleSelect mselect; @Property @Persist private ListMenuLink pageList; On 04/15/2011 12:52 PM, TG wrote: Ok that helps. Installed 1.3.2 but how do I use it in the .tml file? What is the namespace I need to import? I asked as I still have the same not found error i.e. Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Unable to resolve 'MultipleSelect' to a component class name. [at classpath:tapp/.../...(truncated for simplicity).../pages/UserSave.tml, line 18] at org.apache.tapestry5.internal.pageload.PageLoaderImpl.startComponent(PageLoaderImpl.java:743) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:627) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:426) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.consumeToEndElementAndPopBodyElement(PageLoaderImpl.java:611) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.parameter(PageLoaderImpl.java:559) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:443) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:648) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:426) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.element(PageLoaderImpl.java:687) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:421) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.component(PageLoaderImpl.java:648) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.processTemplateToken(PageLoaderImpl.java:426) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.programAssembler(PageLoaderImpl.java:264) at org.apache.tapestry5.internal.pageload.PageLoaderImpl.access$900(PageLoaderImpl.java:65) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:236) at org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:220) at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65) ... 84 more Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Unable to resolve 'MultipleSelect' to a component class name. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306041.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
You are talking to a person who is new to tapestry :) So I need exact example. So my question is what should the namespace be like following? html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; ??? I code like this and it does not work - t:parameter name=userRole label t:type=Label for=userRole/ input t:type=ck.MultipleSelect t:id=userRole t:value=user.userRoles t:multiple=true/ * select more than once for multiple roles /t:parameter Thanks for all Tapestry's guru's reply so far. I am impressed with the support I got from this forum. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306266.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Hi you can specify a third party component either like t:libraryPrefix.somecomponent / or suitableTagName t:type='libraryPrefix/someComponent'/ suitableTagName will be select for select component, input for input components etc As MultipleSelect is a select component, you might right it like select t:type='ck/MultipleSelect' ... / or t:ck.MultipleSelect .../ regards Taha On Fri, Apr 15, 2011 at 11:49 PM, TG tapestry...@hotmail.com wrote: You are talking to a person who is new to tapestry :) So I need exact example. So my question is what should the namespace be like following? html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; ??? I code like this and it does not work - t:parameter name=userRole label t:type=Label for=userRole/ input t:type=ck.MultipleSelect t:id=userRole t:value=user.userRoles t:multiple=true/ * select more than once for multiple roles /t:parameter Thanks for all Tapestry's guru's reply so far. I am impressed with the support I got from this forum. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306266.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
I change . to / in t:type i.e. t:parameter name=userRole label t:type=Label for=userRole/ input t:type=ck/MultipleSelect t:id=userRole t:value=user.userRoles t:model=userRolesModel t:multiple=true/ * select more than once for multiple roles /t:parameter and I got another error - Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Could not find a coercion from type org.apache.tapestry5.internal.services.TypeCoercedValueEncoderFactory$1 to type org.chenillekit.tapestry.core.encoders.MultipleValueEncoder. I have to add the model, otherwise I will encounter the following error - Parameter(s) 'model' are required for org.chenillekit.tapestry.core.components.MultipleSelect, but have not been bound. Any idea? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306851.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Add parameter t:encoder='encoder' t:model='encoder' and in you class file this method @Inject private PropertyAccess propertyAccess; public GenericMultipleSelectModel getEncoder(){ return new GenericMultipleSelectModel(selectables, YourObject.class, labelPropertyName, valuePropertyName, propertyAccess); } regards Taha On Sat, Apr 16, 2011 at 7:11 AM, TG tapestry...@hotmail.com wrote: I change . to / in t:type i.e. t:parameter name=userRole label t:type=Label for=userRole/ input t:type=ck/MultipleSelect t:id=userRole t:value=user.userRoles t:model=userRolesModel t:multiple=true/ * select more than once for multiple roles /t:parameter and I got another error - Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Could not find a coercion from type org.apache.tapestry5.internal.services.TypeCoercedValueEncoderFactory$1 to type org.chenillekit.tapestry.core.encoders.MultipleValueEncoder. I have to add the model, otherwise I will encounter the following error - Parameter(s) 'model' are required for org.chenillekit.tapestry.core.components.MultipleSelect, but have not been bound. Any idea? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306851.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
I changed as suggested but can't move beyond compilation errors - GenericMultipleSelectModel is not in 1.3.2 anymore and what exactly are selectables, YourObject.class, labelPropertyName, valuePropertyName? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306859.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
In 1.3.2 you will need to implement the interface public interface MultipleValueEncoderV { String toClient(V value); ListV toValue(String[] clientValue); } for the encoder regards Taha On Sat, Apr 16, 2011 at 7:29 AM, TG tapestry...@hotmail.com wrote: I changed as suggested but can't move beyond compilation errors - GenericMultipleSelectModel is not in 1.3.2 anymore and what exactly are selectables, YourObject.class, labelPropertyName, valuePropertyName? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4306859.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Tapestry 5.2.5 Select component's multiple property
I have the following codes in my form - ... (truncated for simplicity) ... * select more than once for multiple roles UserRole is Enum type - public enum UserRole { ROLE_USER, ROLE_MANAGER, ROLE_ADMIN, ... (truncated for simplicity) ... t:multiple=true works but just for the display and UI layer, when I saved it, it does not remember more than one selection. What should I do? I looked high and low, scrapping big old Google, found nothing. I read somewhere that I need to - 1. Need to create a class (option model) that implements OptionModel; to use as t:model 2. Need to create a class (select model) that extends AbstractSelectModel; to use as t:value 3. Need to create a class (encoder) that implements ValueEncoder; to use as t:encoder But there is no sample codes to explain what I need to write in each methods. Could any kind soul/Tapestry guru in here help me? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4304338.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry 5.2.5 Select component's multiple property
Hmm... Tapestry's core select component doesn't have a multiple parameter. http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/Select.html Perhaps you are referring to http://www.chenillekit.org/chenillekit-tapestry/ref/org/chenillekit/tapestry/core/components/MultipleSelect.html ? In which case your value parameter should be a List to contain the submitted values... Josh On Thu, Apr 14, 2011 at 4:12 PM, TG tapestry...@hotmail.com wrote: I have the following codes in my form - ... (truncated for simplicity) ... * select more than once for multiple roles UserRole is Enum type - public enum UserRole { ROLE_USER, ROLE_MANAGER, ROLE_ADMIN, ... (truncated for simplicity) ... t:multiple=true works but just for the display and UI layer, when I saved it, it does not remember more than one selection. What should I do? I looked high and low, scrapping big old Google, found nothing. I read somewhere that I need to - 1. Need to create a class (option model) that implements OptionModel; to use as t:model 2. Need to create a class (select model) that extends AbstractSelectModel; to use as t:value 3. Need to create a class (encoder) that implements ValueEncoder; to use as t:encoder But there is no sample codes to explain what I need to write in each methods. Could any kind soul/Tapestry guru in here help me? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-5-2-5-Select-component-s-multiple-property-tp4304338p4304338.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org