Re: nested loop view
t; > > > >Sub-Class: > >[subclass] > > > > > >Location: > >[location] > > > > > >Date: > >[Action > Date] > > > > >Status: > >[item state] > > > > >User ID: > >[user id] > > > > > > > > > > > Sorry for posting my problem in your thread but i am a newbie here and i > can't get to subscribe in the mailing list so I can't post any threads.. > Thanks for your understanding.. waiting for your reply. > > > luther.baker wrote: > > > > Ahh ... but of course! > > > > Thanks both of you. The nested structure did indeed obscure the problem. > > > > Fixed and refactored a bit - and now working as expected. > > > > Thanks for your time! > > > > -Luther > > > > > > > > On Thu, Mar 26, 2009 at 12:01 PM, Jonathan Locke > > wrote: > > > >> > >> > >> uh, well maybe not dangerous, just less clear than it could be. > >> > >> > >> Jonathan Locke wrote: > >> > > >> > > >> > i think you mean to add the projects listview to the categories list > >> view > >> > /item/ > >> > > >> > your structure is a little dangerous here because you have one > ListItem > >> > item > >> > obscuring the other. if the outer one were called outerItem and the > >> inner > >> > one > >> > were called innerItem, i think you meant to say > outerItem.add(projects) > >> > and > >> > innerItem.add(link) > >> > > >> > > >> > luther.baker wrote: > >> >> > >> >> I'm trying to create a page - similar to Jira's BROWSE PROJECTS. > >> >> > >> >> My initial take amounts to a loop in a loop. > >> >> > >> >> The outer loop is CATEGORIES and the inner loop is PROJECTS in said > >> >> category. > >> >> > >> >> | CATEGORY 1 > >> >> | p1 > >> >> | p2 > >> >> | p3 > >> >> > >> >> | CATEGORY 2 > >> >> | p4 > >> >> | p5 > >> >> | p6 > >> >> > >> >> ... > >> >> > >> >> I've attached code below but if I removed the nested loop, I can > >> easily > >> >> loop > >> >> over just CATEGORIES but as soon as I add the nested loop, it fails > >> with > >> >> the > >> >> following > >> >> > >> >> WicketMessage: Error attaching this container for rendering: [Page > >> class > >> >> = > >> >> com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, > >> version > >> >> = > >> >> 0] > >> >> > >> >> Root cause: > >> >> > >> >> java.lang.IllegalArgumentException: A child with id 'projects' > already > >> >> exists: > >> >> [MarkupContainer [Component id = categories]] > >> >> > >> >> > >> >> My intuition tells me that 'wicket:id="projects"' is repeating since > >> it > >> >> is > >> >> contained in an outer loop ... but I'm not sure how else to identify > >> this > >> >> type of structure in a general way. Is there a loop container more > >> suited > >> >> to > >> >> this ... open to suggestions. > >> >> > >> >> Thanks in advance, > >> >> > >> >> -Luther > >> >> > >> >> > >> >> > >> >> *.html snippet > >> >> > >> >> > >> >> > >> >> > >> >> # [project] > >> >>
Re: nested loop view
Sorry for posting my problem in your thread but i am a newbie here and i can't get to subscribe in the mailing list so I can't post any threads.. Thanks for your understanding.. waiting for your reply. luther.baker wrote: > > Ahh ... but of course! > > Thanks both of you. The nested structure did indeed obscure the problem. > > Fixed and refactored a bit - and now working as expected. > > Thanks for your time! > > -Luther > > > > On Thu, Mar 26, 2009 at 12:01 PM, Jonathan Locke > wrote: > >> >> >> uh, well maybe not dangerous, just less clear than it could be. >> >> >> Jonathan Locke wrote: >> > >> > >> > i think you mean to add the projects listview to the categories list >> view >> > /item/ >> > >> > your structure is a little dangerous here because you have one ListItem >> > item >> > obscuring the other. if the outer one were called outerItem and the >> inner >> > one >> > were called innerItem, i think you meant to say outerItem.add(projects) >> > and >> > innerItem.add(link) >> > >> > >> > luther.baker wrote: >> >> >> >> I'm trying to create a page - similar to Jira's BROWSE PROJECTS. >> >> >> >> My initial take amounts to a loop in a loop. >> >> >> >> The outer loop is CATEGORIES and the inner loop is PROJECTS in said >> >> category. >> >> >> >> | CATEGORY 1 >> >> | p1 >> >> | p2 >> >> | p3 >> >> >> >> | CATEGORY 2 >> >> | p4 >> >> | p5 >> >> | p6 >> >> >> >> ... >> >> >> >> I've attached code below but if I removed the nested loop, I can >> easily >> >> loop >> >> over just CATEGORIES but as soon as I add the nested loop, it fails >> with >> >> the >> >> following >> >> >> >> WicketMessage: Error attaching this container for rendering: [Page >> class >> >> = >> >> com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, >> version >> >> = >> >> 0] >> >> >> >> Root cause: >> >> >> >> java.lang.IllegalArgumentException: A child with id 'projects' already >> >> exists: >> >> [MarkupContainer [Component id = categories]] >> >> >> >> >> >> My intuition tells me that 'wicket:id="projects"' is repeating since >> it >> >> is >> >> contained in an outer loop ... but I'm not sure how else to identify >> this >> >> type of structure in a general way. Is there a loop container more >> suited >> >> to >> >> this ... open to suggestions. >> >> >> >> Thanks in advance, >> >> >> >> -Luther >> >> >> >> >> >> >> >> *.html snippet >> >> >> >> >> >> >> >> >> >> # [project] >> >> >> >> >> >> >> >> >> >> >> >> *.java snippet >> >> >> >> public ProjectsPage(ResourceModel bodyTitle) >> >> { >> >> super(bodyTitle); >> >> >> >> ListView categories = new ListView("categories", >> >> this.getCategories()) >> >> { >> >> >> >> @Override >> >> protected void populateItem(ListItem item) >> >> { >> >> Category category = (Category) item.getModelObject(); >> >> >> >> ListView projects = new ListView("projects", >> >> ProjectsPage.this.getProjects(category)) >> >> { >> >> >> >> @Override >> >> protected void populateItem(ListItem item) >> >> { >> >> Project project = (Project) >> >> item.getModelObject(); >> >> Link link = new Link("projectLink", >> >> item.getModel()) >> >> { >> >> >> >> @Override >> >> public void onClick() { ... } >> >> }; >> >> link.add(new Label("projectLabel", >> >> project.getName())); >> >> item.add(link); >> >> } >> >> }; >> >> this.add(projects); >> >> } >> >> }; >> >> this.add(categories); >> >> } >> >> >> >> >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/nested-loop-view-tp22726252p22726482.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > -- View this message in context: http://www.nabble.com/nested-loop-view-tp22726252p23774065.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: nested loop view
User error :) review what element your adding the inner list to... looks like your adding it to the ListView instead of the Item. Change: this.add(projects); to item.add(projects); - Brill Pappin On 26-Mar-09, at 12:50 PM, Luther Baker wrote: I'm trying to create a page - similar to Jira's BROWSE PROJECTS. My initial take amounts to a loop in a loop. The outer loop is CATEGORIES and the inner loop is PROJECTS in said category. | CATEGORY 1 | p1 | p2 | p3 | CATEGORY 2 | p4 | p5 | p6 ... I've attached code below but if I removed the nested loop, I can easily loop over just CATEGORIES but as soon as I add the nested loop, it fails with the following WicketMessage: Error attaching this container for rendering: [Page class = com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version = 0] Root cause: java.lang.IllegalArgumentException: A child with id 'projects' already exists: [MarkupContainer [Component id = categories]] My intuition tells me that 'wicket:id="projects"' is repeating since it is contained in an outer loop ... but I'm not sure how else to identify this type of structure in a general way. Is there a loop container more suited to this ... open to suggestions. Thanks in advance, -Luther *.html snippet [project] *.java snippet public ProjectsPage(ResourceModel bodyTitle) { super(bodyTitle); ListView categories = new ListView("categories", this.getCategories()) { @Override protected void populateItem(ListItem item) { Category category = (Category) item.getModelObject(); ListView projects = new ListView("projects", ProjectsPage.this.getProjects(category)) { @Override protected void populateItem(ListItem item) { Project project = (Project) item.getModelObject(); Link link = new Link("projectLink", item.getModel()) { @Override public void onClick() { ... } }; link.add(new Label("projectLabel", project.getName())); item.add(link); } }; this.add(projects); } }; this.add(categories); } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: nested loop view
Ahh ... but of course! Thanks both of you. The nested structure did indeed obscure the problem. Fixed and refactored a bit - and now working as expected. Thanks for your time! -Luther On Thu, Mar 26, 2009 at 12:01 PM, Jonathan Locke wrote: > > > uh, well maybe not dangerous, just less clear than it could be. > > > Jonathan Locke wrote: > > > > > > i think you mean to add the projects listview to the categories list view > > /item/ > > > > your structure is a little dangerous here because you have one ListItem > > item > > obscuring the other. if the outer one were called outerItem and the inner > > one > > were called innerItem, i think you meant to say outerItem.add(projects) > > and > > innerItem.add(link) > > > > > > luther.baker wrote: > >> > >> I'm trying to create a page - similar to Jira's BROWSE PROJECTS. > >> > >> My initial take amounts to a loop in a loop. > >> > >> The outer loop is CATEGORIES and the inner loop is PROJECTS in said > >> category. > >> > >> | CATEGORY 1 > >> | p1 > >> | p2 > >> | p3 > >> > >> | CATEGORY 2 > >> | p4 > >> | p5 > >> | p6 > >> > >> ... > >> > >> I've attached code below but if I removed the nested loop, I can easily > >> loop > >> over just CATEGORIES but as soon as I add the nested loop, it fails with > >> the > >> following > >> > >> WicketMessage: Error attaching this container for rendering: [Page class > >> = > >> com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version > >> = > >> 0] > >> > >> Root cause: > >> > >> java.lang.IllegalArgumentException: A child with id 'projects' already > >> exists: > >> [MarkupContainer [Component id = categories]] > >> > >> > >> My intuition tells me that 'wicket:id="projects"' is repeating since it > >> is > >> contained in an outer loop ... but I'm not sure how else to identify > this > >> type of structure in a general way. Is there a loop container more > suited > >> to > >> this ... open to suggestions. > >> > >> Thanks in advance, > >> > >> -Luther > >> > >> > >> > >> *.html snippet > >> > >> > >> > >> > >> # [project] > >> > >> > >> > >> > >> > >> *.java snippet > >> > >> public ProjectsPage(ResourceModel bodyTitle) > >> { > >> super(bodyTitle); > >> > >> ListView categories = new ListView("categories", > >> this.getCategories()) > >> { > >> > >> @Override > >> protected void populateItem(ListItem item) > >> { > >> Category category = (Category) item.getModelObject(); > >> > >> ListView projects = new ListView("projects", > >> ProjectsPage.this.getProjects(category)) > >> { > >> > >> @Override > >> protected void populateItem(ListItem item) > >> { > >> Project project = (Project) > >> item.getModelObject(); > >> Link link = new Link("projectLink", > >> item.getModel()) > >> { > >> > >> @Override > >> public void onClick() { ... } > >> }; > >> link.add(new Label("projectLabel", > >> project.getName())); > >> item.add(link); > >> } > >> }; > >> this.add(projects); > >> } > >> }; > >> this.add(categories); > >> } > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/nested-loop-view-tp22726252p22726482.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: nested loop view
uh, well maybe not dangerous, just less clear than it could be. Jonathan Locke wrote: > > > i think you mean to add the projects listview to the categories list view > /item/ > > your structure is a little dangerous here because you have one ListItem > item > obscuring the other. if the outer one were called outerItem and the inner > one > were called innerItem, i think you meant to say outerItem.add(projects) > and > innerItem.add(link) > > > luther.baker wrote: >> >> I'm trying to create a page - similar to Jira's BROWSE PROJECTS. >> >> My initial take amounts to a loop in a loop. >> >> The outer loop is CATEGORIES and the inner loop is PROJECTS in said >> category. >> >> | CATEGORY 1 >> | p1 >> | p2 >> | p3 >> >> | CATEGORY 2 >> | p4 >> | p5 >> | p6 >> >> ... >> >> I've attached code below but if I removed the nested loop, I can easily >> loop >> over just CATEGORIES but as soon as I add the nested loop, it fails with >> the >> following >> >> WicketMessage: Error attaching this container for rendering: [Page class >> = >> com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version >> = >> 0] >> >> Root cause: >> >> java.lang.IllegalArgumentException: A child with id 'projects' already >> exists: >> [MarkupContainer [Component id = categories]] >> >> >> My intuition tells me that 'wicket:id="projects"' is repeating since it >> is >> contained in an outer loop ... but I'm not sure how else to identify this >> type of structure in a general way. Is there a loop container more suited >> to >> this ... open to suggestions. >> >> Thanks in advance, >> >> -Luther >> >> >> >> *.html snippet >> >> >> >> >> # [project] >> >> >> >> >> >> *.java snippet >> >> public ProjectsPage(ResourceModel bodyTitle) >> { >> super(bodyTitle); >> >> ListView categories = new ListView("categories", >> this.getCategories()) >> { >> >> @Override >> protected void populateItem(ListItem item) >> { >> Category category = (Category) item.getModelObject(); >> >> ListView projects = new ListView("projects", >> ProjectsPage.this.getProjects(category)) >> { >> >> @Override >> protected void populateItem(ListItem item) >> { >> Project project = (Project) >> item.getModelObject(); >> Link link = new Link("projectLink", >> item.getModel()) >> { >> >> @Override >> public void onClick() { ... } >> }; >> link.add(new Label("projectLabel", >> project.getName())); >> item.add(link); >> } >> }; >> this.add(projects); >> } >> }; >> this.add(categories); >> } >> >> > > -- View this message in context: http://www.nabble.com/nested-loop-view-tp22726252p22726482.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: nested loop view
i think you mean to add the projects listview to the categories list view /item/ your structure is a little dangerous here because you have one ListItem item obscuring the other. if the outer one were called outerItem and the inner one were called innerItem, i think you meant to say outerItem.add(projects) and innerItem.add(link) luther.baker wrote: > > I'm trying to create a page - similar to Jira's BROWSE PROJECTS. > > My initial take amounts to a loop in a loop. > > The outer loop is CATEGORIES and the inner loop is PROJECTS in said > category. > > | CATEGORY 1 > | p1 > | p2 > | p3 > > | CATEGORY 2 > | p4 > | p5 > | p6 > > ... > > I've attached code below but if I removed the nested loop, I can easily > loop > over just CATEGORIES but as soon as I add the nested loop, it fails with > the > following > > WicketMessage: Error attaching this container for rendering: [Page class = > com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version = > 0] > > Root cause: > > java.lang.IllegalArgumentException: A child with id 'projects' already > exists: > [MarkupContainer [Component id = categories]] > > > My intuition tells me that 'wicket:id="projects"' is repeating since it is > contained in an outer loop ... but I'm not sure how else to identify this > type of structure in a general way. Is there a loop container more suited > to > this ... open to suggestions. > > Thanks in advance, > > -Luther > > > > *.html snippet > > > > > # [project] > > > > > > *.java snippet > > public ProjectsPage(ResourceModel bodyTitle) > { > super(bodyTitle); > > ListView categories = new ListView("categories", > this.getCategories()) > { > > @Override > protected void populateItem(ListItem item) > { > Category category = (Category) item.getModelObject(); > > ListView projects = new ListView("projects", > ProjectsPage.this.getProjects(category)) > { > > @Override > protected void populateItem(ListItem item) > { > Project project = (Project) item.getModelObject(); > Link link = new Link("projectLink", > item.getModel()) > { > > @Override > public void onClick() { ... } > }; > link.add(new Label("projectLabel", > project.getName())); > item.add(link); > } > }; > this.add(projects); > } > }; > this.add(categories); > } > > -- View this message in context: http://www.nabble.com/nested-loop-view-tp22726252p22726455.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: nested loop view
I think you have to add "projects" to the current category item, not to "this" (which would refer to the categories listview itself). So try replacing: this.add(projects); By: item.add(projects); 2009/3/26 Luther Baker : > I'm trying to create a page - similar to Jira's BROWSE PROJECTS. > > My initial take amounts to a loop in a loop. > > The outer loop is CATEGORIES and the inner loop is PROJECTS in said > category. > > | CATEGORY 1 > | p1 > | p2 > | p3 > > | CATEGORY 2 > | p4 > | p5 > | p6 > > ... > > I've attached code below but if I removed the nested loop, I can easily loop > over just CATEGORIES but as soon as I add the nested loop, it fails with the > following > > WicketMessage: Error attaching this container for rendering: [Page class = > com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version = > 0] > > Root cause: > > java.lang.IllegalArgumentException: A child with id 'projects' already > exists: > [MarkupContainer [Component id = categories]] > > > My intuition tells me that 'wicket:id="projects"' is repeating since it is > contained in an outer loop ... but I'm not sure how else to identify this > type of structure in a general way. Is there a loop container more suited to > this ... open to suggestions. > > Thanks in advance, > > -Luther > > > > *.html snippet > > > > > wicket:id="projectLabel">[project] > > > > > > *.java snippet > > public ProjectsPage(ResourceModel bodyTitle) > { > super(bodyTitle); > > ListView categories = new ListView("categories", > this.getCategories()) > { > > �...@override > protected void populateItem(ListItem item) > { > Category category = (Category) item.getModelObject(); > > ListView projects = new ListView("projects", > ProjectsPage.this.getProjects(category)) > { > > �...@override > protected void populateItem(ListItem item) > { > Project project = (Project) item.getModelObject(); > Link link = new Link("projectLink", item.getModel()) > { > > �...@override > public void onClick() { ... } > }; > link.add(new Label("projectLabel", > project.getName())); > item.add(link); > } > }; > this.add(projects); > } > }; > this.add(categories); > } > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
nested loop view
I'm trying to create a page - similar to Jira's BROWSE PROJECTS. My initial take amounts to a loop in a loop. The outer loop is CATEGORIES and the inner loop is PROJECTS in said category. | CATEGORY 1 | p1 | p2 | p3 | CATEGORY 2 | p4 | p5 | p6 ... I've attached code below but if I removed the nested loop, I can easily loop over just CATEGORIES but as soon as I add the nested loop, it fails with the following WicketMessage: Error attaching this container for rendering: [Page class = com.fuzzybearings.milestones.web.page.user.ProjectsPage, id = 3, version = 0] Root cause: java.lang.IllegalArgumentException: A child with id 'projects' already exists: [MarkupContainer [Component id = categories]] My intuition tells me that 'wicket:id="projects"' is repeating since it is contained in an outer loop ... but I'm not sure how else to identify this type of structure in a general way. Is there a loop container more suited to this ... open to suggestions. Thanks in advance, -Luther *.html snippet [project] *.java snippet public ProjectsPage(ResourceModel bodyTitle) { super(bodyTitle); ListView categories = new ListView("categories", this.getCategories()) { @Override protected void populateItem(ListItem item) { Category category = (Category) item.getModelObject(); ListView projects = new ListView("projects", ProjectsPage.this.getProjects(category)) { @Override protected void populateItem(ListItem item) { Project project = (Project) item.getModelObject(); Link link = new Link("projectLink", item.getModel()) { @Override public void onClick() { ... } }; link.add(new Label("projectLabel", project.getName())); item.add(link); } }; this.add(projects); } }; this.add(categories); }