Re: ListView for only one element. Something wrong.
Hi,Thanks for your answer. (i reed it a time ago, but i never said thanks) NM On Fri, Oct 9, 2009 at 6:51 AM, Sven Meier s...@meiers.net wrote: Hi Nicolas, use more models: -- class MyPage: private IModelList businessObjects; private MyPanel myPanel; myPanel = new MyPanel(businessObjects); this.add(myPanel); - class MyPanel(final IModelList businessObjects): this.add(new SomeComponent(new AbstractReadOnlyModel() { public Object getObject() { return businessObjects.getObject().get(0); } })); this.add(new ListView(new AbstractReadOnlyModel() { public Object getObject() { return businessObjects.getObject().subList(1, businessObjects.getObject().size()); } }) { ... }); -- HTH Sven Nicolas Melendez schrieb: Hi: Sven, thanks for replying! I've added some code below. -- class MyPage: private List businessObjectList; private MyPanel myPanel; list is populated somehow myPanel = new MyPanel(businessObjectList); this.add(myPanel); ... on some behavior - target.addComponent(myPanel); - class MyPanel(businessObjectList): this.add(SomeComponent(first element of businessObjectList)); this.add(new ListView(businessObjectList wihout first element){ ... }); -- I'm aware that as the panel receives a modelObject and not a model, then when it's refreshed it will show the previous list. So, I was thinking about myPanel receiving a PropertyModel(this, businessObjectList), but the thing is: how can it retrieve the first business object (which needs to be shown differently) in a dynamic way so when the panel is refreshed, it will take it from the new list (I could use another repeater that will loop only once, but I was hoping there's a nicer way). Thanks again, NM On Thu, Oct 8, 2009 at 7:50 PM, Sven Meier s...@meiers.net wrote: Hi Nicolas, you can just use a WebMarkupContainer and recreate its children on each request in #onBeforeRender(). But the question is: why do you need to refresh your components at all? It seems you don't use models correctly. Show us some code. Sven Nicolas Melendez wrote: Hi, i want to use a ListView to use the onpopulate method so when the panel refresh i can see the new data.But the listView has always one element and i think it was made for lots of elements. Something is wrong in the way i am thinking. Any suggestion? NM - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
ListView for only one element. Something wrong.
Hi, i want to use a ListView to use the onpopulate method so when the panel refresh i can see the new data.But the listView has always one element and i think it was made for lots of elements. Something is wrong in the way i am thinking. Any suggestion? NM
Re: ListView for only one element. Something wrong.
Hi Nicolas, you can just use a WebMarkupContainer and recreate its children on each request in #onBeforeRender(). But the question is: why do you need to refresh your components at all? It seems you don't use models correctly. Show us some code. Sven Nicolas Melendez wrote: Hi, i want to use a ListView to use the onpopulate method so when the panel refresh i can see the new data.But the listView has always one element and i think it was made for lots of elements. Something is wrong in the way i am thinking. Any suggestion? NM - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView for only one element. Something wrong.
Hi: Sven, thanks for replying! I've added some code below. -- class MyPage: private List businessObjectList; private MyPanel myPanel; list is populated somehow myPanel = new MyPanel(businessObjectList); this.add(myPanel); ... on some behavior - target.addComponent(myPanel); - class MyPanel(businessObjectList): this.add(SomeComponent(first element of businessObjectList)); this.add(new ListView(businessObjectList wihout first element){ ... }); -- I'm aware that as the panel receives a modelObject and not a model, then when it's refreshed it will show the previous list. So, I was thinking about myPanel receiving a PropertyModel(this, businessObjectList), but the thing is: how can it retrieve the first business object (which needs to be shown differently) in a dynamic way so when the panel is refreshed, it will take it from the new list (I could use another repeater that will loop only once, but I was hoping there's a nicer way). Thanks again, NM On Thu, Oct 8, 2009 at 7:50 PM, Sven Meier s...@meiers.net wrote: Hi Nicolas, you can just use a WebMarkupContainer and recreate its children on each request in #onBeforeRender(). But the question is: why do you need to refresh your components at all? It seems you don't use models correctly. Show us some code. Sven Nicolas Melendez wrote: Hi, i want to use a ListView to use the onpopulate method so when the panel refresh i can see the new data.But the listView has always one element and i think it was made for lots of elements. Something is wrong in the way i am thinking. Any suggestion? NM - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: ListView for only one element. Something wrong.
Hi Nicolas, use more models: -- class MyPage: private IModelList businessObjects; private MyPanel myPanel; myPanel = new MyPanel(businessObjects); this.add(myPanel); - class MyPanel(final IModelList businessObjects): this.add(new SomeComponent(new AbstractReadOnlyModel() { public Object getObject() { return businessObjects.getObject().get(0); } })); this.add(new ListView(new AbstractReadOnlyModel() { public Object getObject() { return businessObjects.getObject().subList(1, businessObjects.getObject().size()); } }) { ... }); -- HTH Sven Nicolas Melendez schrieb: Hi: Sven, thanks for replying! I've added some code below. -- class MyPage: private List businessObjectList; private MyPanel myPanel; list is populated somehow myPanel = new MyPanel(businessObjectList); this.add(myPanel); ... on some behavior - target.addComponent(myPanel); - class MyPanel(businessObjectList): this.add(SomeComponent(first element of businessObjectList)); this.add(new ListView(businessObjectList wihout first element){ ... }); -- I'm aware that as the panel receives a modelObject and not a model, then when it's refreshed it will show the previous list. So, I was thinking about myPanel receiving a PropertyModel(this, businessObjectList), but the thing is: how can it retrieve the first business object (which needs to be shown differently) in a dynamic way so when the panel is refreshed, it will take it from the new list (I could use another repeater that will loop only once, but I was hoping there's a nicer way). Thanks again, NM On Thu, Oct 8, 2009 at 7:50 PM, Sven Meier s...@meiers.net wrote: Hi Nicolas, you can just use a WebMarkupContainer and recreate its children on each request in #onBeforeRender(). But the question is: why do you need to refresh your components at all? It seems you don't use models correctly. Show us some code. Sven Nicolas Melendez wrote: Hi, i want to use a ListView to use the onpopulate method so when the panel refresh i can see the new data.But the listView has always one element and i think it was made for lots of elements. Something is wrong in the way i am thinking. Any suggestion? NM - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org