RE: Select with @InjectSelectionModel problem (value passed in is null)
Hi, Thanks for your answer. I forgot to add the public void onPrepare() and therefore the list was empty. Thanks. One addition for the tapestry wiki page. I think it is better to replace: String accessActualName = transformation.addField(Modifier.PRIVATE, "org.apache.tapestry5.ioc.services.PropertyAccess", "_access"); into: String accessActualName = transformation.addField(Modifier.PRIVATE, PropertyAccess.class.getName(), "_access"); So we use no hardcoded package names. > Joe, > > There were some errors on the wiki page and I've already corrected it, but > was nothing related with this problem. > I can't reproduce it here, can you show some more of your code so I can test > it here? > > > > I have been debugging and noticed that the failure is in the > > GenericValueEncoder.toValue method > > The idFieldAdapter property is null and therefore it can't find a match. > > > > And why is the idFieldAdapter null? > > Because in the constructor(see below), the list parameter was null after > > submitting the form. > > Do I need to persist my List of objects? I don't want this > > And I think the example on the wiki doesn't work as well. > > > > Does anyone had this error earlier? > > > > > > public GenericValueEncoder(List list, String idField, PropertyAccess > > access) { > >if (idField != null && !idField.equalsIgnoreCase("null")) { > >if (list.size() > 0) { > >this.idFieldAdapter = > > access.getAdapter(list.get(0).getClass()).getPropertyAdapter(idField); > >} > >} > >this.list = list; > > } > > > > > Hello > > > > > > I use the select component with the @InjectSelectionModel annotation as > > described here: > > > http://wiki.apache.org/tapestry/Tapestry5AnotherSelectWithObjects > > > > > > > model="categoriesSelectionModel" encoder="categoriesValueEncoder" > > value="selectedCategory" /> > > > > > > The select is nicely loaded with categories. Next I submit the form and I > > notice that the setSelectedCategory method is called. But it prints > > "setSelectedCategory: null" > > > See below for some the corresponding java code. What am I doing wrong? > > Why is the selectedCategory null, after I have selected a category and > > submitted the form? > > > > > > @InjectSelectionModel(labelField = "name", idField = "id") > > > @Property > > > private List categories = new ArrayList(); > > > > > > @Persist > > > private Category selectedCategory; > > > > > > public void setSelectedCategory(Category selectedCategory) { > > > > > > System.out.println("setSelectedCategory: " + selectedCategory); > > > > > > this.selectedCategory = selectedCategory; > > > > > > } > > > > > > public Category getSelectedRootCategory() { > > > return selectedRootCategory; > > > } > > > > > > > > > > > > _ > > > More than messages–check out the rest of the Windows Live™. > > > http://www.microsoft.com/windows/windowslive/ > > > > _ > > Show them the way! Add maps and directions to your party invites. > > http://www.microsoft.com/windows/windowslive/events.aspx > > > > > -- > Atenciosamente, > > Marcelo Lotif > Programador Java e Tapestry > FIEC - Federação das Indústrias do Estado do Ceará > (85) 3421-5910 _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/photos.aspx
RE: Select with @InjectSelectionModel problem (value passed in is null)
I have been debugging and noticed that the failure is in the GenericValueEncoder.toValue method The idFieldAdapter property is null and therefore it can't find a match. And why is the idFieldAdapter null? Because in the constructor(see below), the list parameter was null after submitting the form. Do I need to persist my List of objects? I don't want this And I think the example on the wiki doesn't work as well. Does anyone had this error earlier? public GenericValueEncoder(List list, String idField, PropertyAccess access) { if (idField != null && !idField.equalsIgnoreCase("null")) { if (list.size() > 0) { this.idFieldAdapter = access.getAdapter(list.get(0).getClass()).getPropertyAdapter(idField); } } this.list = list; } > Hello > > I use the select component with the @InjectSelectionModel annotation as > described here: > http://wiki.apache.org/tapestry/Tapestry5AnotherSelectWithObjects > > model="categoriesSelectionModel" encoder="categoriesValueEncoder" > value="selectedCategory" /> > > The select is nicely loaded with categories. Next I submit the form and I > notice that the setSelectedCategory method is called. But it prints > "setSelectedCategory: null" > See below for some the corresponding java code. What am I doing wrong? Why is > the selectedCategory null, after I have selected a category and submitted the > form? > > @InjectSelectionModel(labelField = "name", idField = "id") > @Property > private List categories = new ArrayList(); > > @Persist > private Category selectedCategory; > > public void setSelectedCategory(Category selectedCategory) { > > System.out.println("setSelectedCategory: " + selectedCategory); > > this.selectedCategory = selectedCategory; > > } > > public Category getSelectedRootCategory() { > return selectedRootCategory; > } > > > > _ > More than messages–check out the rest of the Windows Live™. > http://www.microsoft.com/windows/windowslive/ _ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/events.aspx
Select with @InjectSelectionModel problem (value passed in is null)
Hello I use the select component with the @InjectSelectionModel annotation as described here: http://wiki.apache.org/tapestry/Tapestry5AnotherSelectWithObjects The select is nicely loaded with categories. Next I submit the form and I notice that the setSelectedCategory method is called. But it prints "setSelectedCategory: null" See below for some the corresponding java code. What am I doing wrong? Why is the selectedCategory null, after I have selected a category and submitted the form? @InjectSelectionModel(labelField = "name", idField = "id") @Property private List categories = new ArrayList(); @Persist private Category selectedCategory; public void setSelectedCategory(Category selectedCategory) { System.out.println("setSelectedCategory: " + selectedCategory); this.selectedCategory = selectedCategory; } public Category getSelectedRootCategory() { return selectedRootCategory; } _ More than messages–check out the rest of the Windows Live™. http://www.microsoft.com/windows/windowslive/
t5Components + Return JSONArray to component
I used the T5Components OnEvent. But for some reason I don't get the JSONArray as a response in the javascript code. I can see the javascript is called, but the response is "Undefined". I have no clue what causes the problem. And am struggling with this issue for a couple of days. I upgraded to tapestry 5.0.18. I had this working in an earlier version of tapestry and t5components. @OnEvent(component = "operator", value = "change") public JSONArray onChangeOperatorEvent(String value) { JSONArray jsonArray = new JSONArray(); for (Plaza plaza : getDestinationSelectValues(value)) { JSONObject jsonObject = new JSONObject(); jsonObject.put("value", plaza.getId()); jsonObject.put("label", plaza.getDescription()); jsonArray.put(jsonObject); } return jsonArray; } Finally, the onCompleteOperatorChange javascript function has to parse the return JSON and update the select input options: function onCompleteOperatorChange(response) { selectElement = $("entryPlaza"); responseJSON = response.evalJSON(); while (selectElement .options.length > 0) { selectElement .options[0] = null; } for (index = 0; index < responseJSON .length; index++) { selectElement.options[index] = new Option(responseJSON[index].label, responseJSON [index].value); } Tapestry.ElementEffect.highlight($("entryPlaza")); } But the response is "Undefined" . _ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
RE: [ANN] t5components 0.5.18 is now available for Tapestry 5.0.18
Yes I already tried that. Also in debugging mode I can see that the AbstractEventMixin.onInternalEvent() method returns a List with the JSONObjects. Then the javascript code is called, but the response argument is "undefined" I have no clue what causes this problem. I had this working in a previous tapestry version. J. > Date: Mon, 15 Dec 2008 14:58:47 +0100 > From: hombu...@googlemail.com > To: users@tapestry.apache.org > Subject: Re: [ANN] t5components 0.5.18 is now available for Tapestry 5.0.18 > > your code looks correct, > > try to empty your browser cache > > 2008/12/15 Joe123 --- > > > > > Hi, > > > > I use the @OnEvent mixin to create dependent selects: > > > > I use it like below. But the problem is that the onCompleteOperatorChange > > javascript function > > response object is "undefined" > > Any ideas how this is possible. The javascript function is called, but the > > response is "undefined" > > @OnEvent(component = "operator", value = "change") > >public JSONArray onChangeOperatorEvent(String value) { > >JSONArray jsonArray = new JSONArray(); > > > >for (Plaza plaza : getDestinationSelectValues(value)) { > >JSONObject jsonObject = new JSONObject(); > >jsonObject.put("value", plaza.getId()); > >jsonObject.put("label", plaza.getDescription()); > > > >jsonArray.put(jsonObject); > >} > > > >return jsonArray; > >} > > > > Finally, the onCompleteOperatorChange javascript function has to parse the > > return JSON and update the select input options: > > > > function onCompleteOperatorChange(response) { > >selectElement = $("entryPlaza"); > >responseJSON = response.evalJSON(); > > > >while (selectElement .options.length > 0) { > >selectElement .options[0] = null; > >} > > > >for (index = 0; index < responseJSON .length; index++) { > >selectElement.options[index] = new Option(responseJSON > > [index].label, responseJSON [index].value); > >} > > > >Tapestry.ElementEffect.highlight($("entryPlaza")); > >} > > any help is welcome. > > J > > > > > > > Date: Mon, 15 Dec 2008 13:32:30 +0100 > > > From: hombu...@googlemail.com > > > To: users@tapestry.apache.org > > > Subject: [ANN] t5components 0.5.18 is now available for Tapestry 5.0.18 > > > > > > Hi there, > > > > > > t5components 0.5.18 is now available for Tapestry 5.0.18 > > > with some fixes > > > > > > project page http://tapestry5-components.googlecode.com > > > > > > *Impotant Information* > > > > > > This release of t5components will be the last. > > > This project has been discontinued, all development effort has been > > > moved to chenillekit.org > > > > > > -- > > > with regards > > > Sven Homburg > > > http://www.chenillekit.org > > > http://tapestry5-components.googlecode.com > > > > _ > > News, entertainment and everything you care about at Live.com. Get it now! > > http://www.live.com/getstarted.aspx > > > > > -- > with regards > Sven Homburg > http://www.chenillekit.org > http://tapestry5-components.googlecode.com _ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
RE: [ANN] t5components 0.5.18 is now available for Tapestry 5.0.18
Hi, I use the @OnEvent mixin to create dependent selects: I use it like below. But the problem is that the onCompleteOperatorChange javascript function response object is "undefined" Any ideas how this is possible. The javascript function is called, but the response is "undefined" @OnEvent(component = "operator", value = "change") public JSONArray onChangeOperatorEvent(String value) { JSONArray jsonArray = new JSONArray(); for (Plaza plaza : getDestinationSelectValues(value)) { JSONObject jsonObject = new JSONObject(); jsonObject.put("value", plaza.getId()); jsonObject.put("label", plaza.getDescription()); jsonArray.put(jsonObject); } return jsonArray; } Finally, the onCompleteOperatorChange javascript function has to parse the return JSON and update the select input options: function onCompleteOperatorChange(response) { selectElement = $("entryPlaza"); responseJSON = response.evalJSON(); while (selectElement .options.length > 0) { selectElement .options[0] = null; } for (index = 0; index < responseJSON .length; index++) { selectElement.options[index] = new Option(responseJSON [index].label, responseJSON [index].value); } Tapestry.ElementEffect.highlight($("entryPlaza")); } any help is welcome. J > Date: Mon, 15 Dec 2008 13:32:30 +0100 > From: hombu...@googlemail.com > To: users@tapestry.apache.org > Subject: [ANN] t5components 0.5.18 is now available for Tapestry 5.0.18 > > Hi there, > > t5components 0.5.18 is now available for Tapestry 5.0.18 > with some fixes > > project page http://tapestry5-components.googlecode.com > > *Impotant Information* > > This release of t5components will be the last. > This project has been discontinued, all development effort has been > moved to chenillekit.org > > -- > with regards > Sven Homburg > http://www.chenillekit.org > http://tapestry5-components.googlecode.com _ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx
Usage of ApllicationState Object
Hello I have a question about the usage of an ApplicationState object. Can I use the @ApplicationState only in the com.application.tapestry.components and com.application.tapestry.pages packages? Or is it also valid in for example com.application.tapestry.beans package? Because I have an ConversationManagerImpl class the isConversationsExists() always returns false. When I call conversationManager.startConversation(..) it prints false. package com.application.tapestry.beans public class ConversationManagerImpl implements ConversationManager { @ApplicationState(create=false) private Conversations conversations; private boolean conversationsExists; public boolean isConversationsExists() { return conversationsExists; } public String startConversation(Object target) { if(!conversationsExists) { conversations = new Conversations(); } System.out.println("conversation exists: " + isConversationsExists()); } _ Connect to the next generation of MSN Messenger http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
RE: how to install t5components library
Hi I had already added it to the classpath, but I get the following error: java.lang.NoClassDefFoundError: org/apache/bsf/BSFException > Subject: Re: how to install t5components library > From: martijn.l...@gmail.com > To: users@tapestry.apache.org > Date: Sat, 13 Dec 2008 10:33:19 +0100 > > You just have to add it to the classpath (Web App Libraries in Eclipse). > Tapestry will automagically initialize the library (using a manifest > entry) > > Martijn > > On Sat, 2008-12-13 at 09:23 +, Joe123 --- wrote: > > Hi, > > > > Sorry for this dumb question, but I can't find any documentation about how > > I can install the t5component library. > > > > Is there any info about this? > > > > Any help is welcome. > > > > thnx > > J. > > > > _ > > Connect to the next generation of MSN Messenger > > http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > _ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
how to install t5components library
Hi, Sorry for this dumb question, but I can't find any documentation about how I can install the t5component library. Is there any info about this? Any help is welcome. thnx J. _ Connect to the next generation of MSN Messenger http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
http://issues.apache.org/jira/browse/TAP5-138
Hello I was wondering when Issue TAP5-138 (Add Zone parameter to Select component) is scheduled to be implemented? http://issues.apache.org/jira/browse/TAP5-138 It is the most popular issue, with 31 votes and a lot are looking forward to this feature. Joe _ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us