Making the outside loop value available to the inside loop?
Hi Guys, Me again with another question :). I have the following setup an outer loop construct and an Inner loop. I want the outer loop to generate the table header of the each table that is generated. This is coming from the keyset() of a hashmap. The inner loop should contain an arraylist, coming from the values() of the hashmap also note, Im using an OGNL binding. My current predicament is that the key that i am generating in the outer loop needs to be passed to the .get() function of the innerloop and it doesnt seem to be working. How is the outerloop value made available to the inner loop? and passed to the inner get function? Below is the tml that ive implemented thus far. t:form id=IssuesGrid ul t:type=loop t:source=issueKeys t:value=issueKey li table width=75% border=1 th${issueKey}/th tr t:type=loop t:source=${ognl:issuesList.get(issueKey)} t:value=issue td${issue.id}/td td${issue.assignee}/td td t:checkbox t:value=issue.state/ /td /tr /table /li /ul /t:form Thanks in Advance, Carlo -- View this message in context: http://www.nabble.com/Making-the-outside-loop-value-available-to-the-inside-loop--tp24586541p24586541.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: Making the outside loop value available to the inside loop?
Thanks for your response Thiago. This is my java code for that page. public class Contact { @SessionState private jiraDataSource jDO; private HashMap String, ArrayListIssue issuesList; private CollectionArrayListIssue issuesSet; private CollectionString issueKeys; private ArrayListIssue issues; private String issueKey; private Issue issue; void onActivate() { issuesList =jDO.getAllIssuesLists(); } public void setIssuesList(HashMap String, ArrayListIssue issuesList) { this.issuesList = issuesList; } public HashMap String, ArrayListIssue getIssuesList() { return issuesList; } public Collection String getIssueKeys() { issueKeys = issuesList.keySet(); return issueKeys; } public CollectionArrayListIssue getIssuesSet() { issuesSet = issuesList.values(); return issuesSet; } public void setIssues(ArrayListIssue cI) { this.issues = cI; } public ArrayListIssuegetIssues() { return issues; } public void setIssueKey(String iK) { this.issueKey = iK; } public String getIssueKey() { return issueKey; } public Issue getIssue() { return issue; } public void setIssue(Issue i) { this.issue = i; } } So just to explain what I think the logic to what I have coded is, (this may be the issue :)) when i say ognl:issuelist.get(issueKey) it passes the value from setIssueKey() and it should be returning an arraylist and because my arraylist has issue objects, the setIssue() function should get called, correct? Carlo Thiago H. de Paula Figueiredo wrote: Em Tue, 21 Jul 2009 09:13:28 -0300, cajmrn caj...@gmail.com escreveu: How is the outerloop value made available to the inner loop? and passed to the inner get function? Your template looks like it should work as is. You don't need to pass values from one component to the other. Just make sure the outer loop sets some page property that is read by the inner loop. Posting your page code here would help. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- View this message in context: http://www.nabble.com/Making-the-outside-loop-value-available-to-the-inside-loop--tp24586541p24587593.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: Making the outside loop value available to the inside loop?
Hi Thiago, Forgive the vagueness of my questions, its a bit difficult to bring across what im trying to do without overstating the issues plus I've probably got too many projects running concurrently :). the code I had pasted does not display the issue objects in the arraylist that is returned from the .get() function on the hashmap. From a broader perspective id like to display a table for every entry in the hashmap. Ive tried, key word tried, various solutions including binding to a DataGridSource, but was unable to adequately implement that. then, I tried getting a Set from the entrySet of the Hashmap, then, I found a thread here about ognl bindings and it seemed like the best solution. I'll give prop and literal prefixes a try, I can see my information flow all the way up arraylist but from there it just doesnt display in the web page, just the issueKeys are displayed the table headers but the tr elements are not filled. Thanks for your time and patience. Carlo Thiago H. de Paula Figueiredo wrote: Em Tue, 21 Jul 2009 10:24:42 -0300, cajmrn caj...@gmail.com escreveu: Thanks for your response Thiago. You're welcome! Two issues: What exactly is not working? Your description is quite vague. Instead of using OGNL, use Tapestry's prop binding. It will be much easier to debug than when you put logic in your template. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- View this message in context: http://www.nabble.com/Making-the-outside-loop-value-available-to-the-inside-loop--tp24586541p24591387.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: How do you display a HashMapString, ArrayListobject in a .tml table
Hello Igor, Thank you for the reply, What I've implemented so far is I've converted the hashmap keys and values to their respective collection types. but when I pass either one of them to the grid component it displays the number of objects passed but none of the information is passed. below is the code that i have written for the display page. So say for example i wanted to display just the keys i would pass the issueKeys collection to the grid component correct? but it just displays as aforementioned, an empty grid header with a false value in each row. Side note: this gird is being populated based on set of selections made on a grid that was displayed on a previous page. I've debugged the information flow and i can see the the HashMap is passed to this page and I see that the enclosed ArrayList has information as well, its just Im not sure if perhaps the information is getting lost at some point during the display of this grid? Or maybe the accessor object that the component uses? Honestly I'm at a loss as to what is going on... public class Contact { @ApplicationState private jiraDataSource jDO; private HashMap String, ArrayListIssue issuesList; private CollectionArrayListIssue issuesSet; private CollectionString issueKeys; private String issueKey; private Issue issue; void onActivate() { issuesList =jDO.getAllIssuesLists(); } public void setIssuesList(HashMap String, ArrayListIssue issuesList) { this.issuesList = issuesList; } public HashMap String, ArrayListIssue getIssuesList() { return issuesList; } public Collection String getIssueKeys() { issueKeys = issuesList.keySet(); return issueKeys; } public CollectionArrayListIssue getIssuesSet() { issuesSet = issuesList.values(); return issuesSet; } public String getIssueKey() { return issueKey; } public Issue getIssue() { return issue; } public void setIssue(Issue i) { this.issue = i; } } this is the page class its coming from: public class About { @ApplicationState private jiraDataSource jiraDO; private Filter filter; @InjectPage private Contact contact; public List Filter getAllFilters() { return jiraDO.getAllFilters(); } public Filter getFilter() { return filter; } public void setFilter(Filter f) { this.filter = f; } @OnEvent(value=checkbox) void CheckboxClick() { System.out.println(a Checkbox was clicked); } @OnEvent(value=submit) Object tromSubmit() { System.out.println(submission made); HashMap String, ArrayListIssue issuesList = jiraDO.getAllIssuesLists(); contact.setIssuesList(issuesList); return contact; } } Igor Drobiazko wrote: Just convert your Map into a GridDataSource which you pass to the component. Take a look at Tapestry's internal implementation of GridDataSource which is constructed from a collection. http://tapestry.formos.com/nightly/tapestry5/apidocs/src-html/org/apache/tapestry5/internal/grid/CollectionGridDataSource.html#line.29 You can also provide a type coercion from a Map to GridDataSource or to Collection. Tapestry will do the coercion for you. On Wed, Jul 15, 2009 at 4:35 AM, cajmrn caj...@gmail.com wrote: Hello all, I am once again stuck and unsure as to how to implement the following. I have a HashMap that contains a String id for the Key and an ArrayList as the value. What I need to do is to display in a table or grid each arrayList as it corresponds to a Key. How would you go about iterating first through the the id and implement it as a table header for example, then iterate through its corresponding ArrayList? Basically nesting the loops... Sort or like generating a table for each entry in the HashMap. Or if it could be implemented in one table that should be fine as well. Any help would be greatly appreciated. Thanks, Carlo -- View this message in context: http://www.nabble.com/How-do-you-display-a-HashMap%3CString%2C-ArrayList%3Cobject%3E%3E-in-a-.tml-table-tp24490975p24490975.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
How do you display a HashMapString, ArrayListobject in a .tml table
Hello all, I am once again stuck and unsure as to how to implement the following. I have a HashMap that contains a String id for the Key and an ArrayList as the value. What I need to do is to display in a table or grid each arrayList as it corresponds to a Key. How would you go about iterating first through the the id and implement it as a table header for example, then iterate through its corresponding ArrayList? Basically nesting the loops... Sort or like generating a table for each entry in the HashMap. Or if it could be implemented in one table that should be fine as well. Any help would be greatly appreciated. Thanks, Carlo -- View this message in context: http://www.nabble.com/How-do-you-display-a-HashMap%3CString%2C-ArrayList%3Cobject%3E%3E-in-a-.tml-table-tp24490975p24490975.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
Getting/Iterating through the information from the Grid
Hi Guys, Im relatively new to Tapestry and I've tasked with assessing the viability of Tapestry as the primary framework for our project solution. First let me quickly describe the project, I will present the user with a grid of content, at the end of each row will be a check box. when the user selects as many checkboxes as he/she chooses and submits, we are to query an external source for a further list for each of those selected checkboxes. So after much toil, I was able to incorporate the checkboxes into the grid. However, now I need to generate another grid based on what checkboxes were checked. Is there some way to register a list of what checkboxes were checked? or is there a way to iterate through a specific column/row in a grid? really any kind or solution or direction would be greatly appreciated. With many Thanks, C -- View this message in context: http://www.nabble.com/Getting-Iterating-through-the-information-from-the-Grid-tp24355747p24355747.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: Getting/Iterating through the information from the Grid
Hi J, I believe I understand what you are saying. I did use setters and getters for my boolean state and I did see how changing the state from true to false changed what was initially displayed in the grid. I will try to implement your suggestion tonight. If only there was more detailed information on these things. I've been using the Tapestry 5 book from Kolesnikov as a reference and its been helpful to a certain extent but obviously since I've turned to the forums... Thanks, C Julian Wood wrote: Remember that bindings are just getters and setters. So take off the @Property annotation on your binding for your checkbox and replace with corresponding getter/setter. Now in getter/setter you can store/ query a map, usually of Long,Boolean. ie your entity id and selected state. HTH, J On 6-Jul-09, at 6:50 AM, cajmrn wrote: Hi Guys, ... Is there some way to register a list of what checkboxes were checked? or is there a way to iterate through a specific column/row in a grid? really any kind or solution or direction would be greatly appreciated. With many Thanks, C -- View this message in context: http://www.nabble.com/Getting-Iterating-through-the-information-from-the-Grid-tp24355747p24355747.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 -- View this message in context: http://www.nabble.com/Getting-Iterating-through-the-information-from-the-Grid-tp24355747p24365898.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