Re: Forms and Listview questions..?
Hmm yeah, but I might have to give it a second glance. Still I feel it's kind of odd that the listItem gets the pageModel and not its own model as model when using it as compoundmodel. -Nino Gwyn Evans wrote: Just to check that, as you're looking at more complex displays, you've had a look at the wicket-extension facilities, e.g. those below org.apache.wicket.extensions.markup.html.repeater.data, for instance? Examples at http://www.wicketstuff.org/wicket13/repeater/ /Gwyn On 21/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: Gwyn Evans wrote: On 20/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: Gwyn Evans wrote: On 20/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: Bump for replies..? Does my mail make sense? Do I need to specify anything further? Nino Saturnino Martinez Vazquez Wael wrote: Hi I've been "playing" with both forms and listviews. And I wanted to extend a form creating my own form that has captcha validation as standard, I cant just seem to find where to place the markup when extending Form? Well, off-hand, I'd expect that the easiest way would be to do it using markup inheritance - http://wicket.apache.org/examplemarkupinheritance.html. Hm the link you gave talks about inheritance for a page. However this would mean that I had to put the into the form in order to add stuff to the form right? What about inheritance for a panel, that way I could use it as a form. However I got some strange errors when trying todo this. Heres some pseduo panel.html panel.java private final Form form panel(String id) { super(id); form=new Form("form"); add(form); form.add(new textfield..) add(new captcha...); } public addToForm(Component child){ form.add(child); } Then the extending panels can add more stuff to the form.. Is this supposed to work? If I understand it correctly, I'd have thought so, yes, although if just getting started, I'd be tempted to get things going on a basic page, then start refactoring. Ok, i'll try to redo the panel, and if I run into troubles i'll provide a quickstart... I then tried doing it with a panel but also ran into sometroubles. Also I've been noticing that if you use a compound model with a listview forexample my page has a compound model called article I add the listview new listview("comments"). I would expect my item in the populate implementation to get fed a comment compoundmodel, but it does only get the compound model for the page, I then have to call item.getModelObject and set the compundmodel manually. Is this something that has been overseen, or am I missing the bigger picture? I think so... Compare this... HTML: Dummy comment Java: (compressed for vertical size!) class Article { private List comments = Arrays.asList(new String[]{"Comment One", "Comment Two", "Comment Three"}); public List getComments() { return comments; } } and public MyPage(final PageParameters parameters) { setModel(new CompoundPropertyModel(new Article())); ListView listView = new ListView("comments") { protected void populateItem(ListItem item) { item.add(new Label("comment", (String)item.getModelObject())); } }; } add(listView); gives the following output: * Comment One * Comment Two * Comment Three /Gwyn This is what I meant extending your example a but, it feels odd to make an extra compoundpropertymodel: class Article { private List comments=new arraylist... public List getComments() { return comments; } } class Comment{ private String text... private String author trival getters and setters... } public MyPage(final PageParameters parameters) { setModel(new CompoundPropertyModel(new Article())); ListView listView = new ListView("comments") { protected void populateItem(ListItem item) { setModel(new *CompundPropertyModel*(item.getModelObject() )) item.add(new Label("comment")); item.add(new Label("author")); } }; } add(listView); I see. You can do it like that, but personally, for just a cople of labels I'd just implement populateItem() as follows: Sure, this was meant to be a simple example.. If you add some complexity to it it's much simpler to use the compound propertymodel, and theres not need for all that code calling all the different acessors since this is what a compoundmodel does.. Im not sure if something else can be gained if you make it detachable? protected void populateItem(ListItem item) { final Comment comment = (Comment)item.getModelObject(); item.add(new Label("text", comment.getText())); item.add(new Label("author", comment.getAuthor())); } By the way, my HTML was
Re: Forms and Listview questions..?
Just to check that, as you're looking at more complex displays, you've had a look at the wicket-extension facilities, e.g. those below org.apache.wicket.extensions.markup.html.repeater.data, for instance? Examples at http://www.wicketstuff.org/wicket13/repeater/ /Gwyn On 21/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: > > > Gwyn Evans wrote: > > On 20/11/2007, Nino Saturnino Martinez Vazquez Wael > > <[EMAIL PROTECTED]> wrote: > > > >> Gwyn Evans wrote: > >> > >>> On 20/11/2007, Nino Saturnino Martinez Vazquez Wael > >>> <[EMAIL PROTECTED]> wrote: > >>> > >>> > Bump for replies..? Does my mail make sense? Do I need to specify > anything further? > > Nino Saturnino Martinez Vazquez Wael wrote: > > > > Hi > > > > I've been "playing" with both forms and listviews. And I wanted to > > extend a form creating my own form that has captcha validation as > > standard, I cant just seem to find where to place the markup when > > extending Form? > > > > > >>> Well, off-hand, I'd expect that the easiest way would be to do it > >>> using markup inheritance - > >>> http://wicket.apache.org/examplemarkupinheritance.html. > >>> > >>> > >>> > >> Hm the link you gave talks about inheritance for a page. However this > >> would mean that I had to put the into the form in order > >> to add stuff to the form right? What about inheritance for a panel, that > >> way I could use it as a form. However I got some strange errors when > >> trying todo this. Heres some pseduo > >> > >> > >> panel.html > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> panel.java > >> > >> private final Form form > >> > >> panel(String id) > >> { > >> super(id); > >> form=new Form("form"); > >> add(form); > >> > >> form.add(new textfield..) > >> add(new captcha...); > >> } > >> > >> public addToForm(Component child){ > >> form.add(child); > >> } > >> > >> Then the extending panels can add more stuff to the form.. Is this > >> supposed to work? > >> > > > > If I understand it correctly, I'd have thought so, yes, although if > > just getting started, I'd be tempted to get things going on a basic > > page, then start refactoring. > > > Ok, i'll try to redo the panel, and if I run into troubles i'll provide > a quickstart... > > > > I then tried doing it with a panel but also ran into > > sometroubles. > > > > > >>> > > Also I've been noticing that if you use a compound model with a > > listview forexample my page has a compound model called article I add > > the listview new listview("comments"). I would expect my item in the > > populate implementation to get fed a comment compoundmodel, but it > > does only get the compound model for the page, I then have to call > > item.getModelObject and set the compundmodel manually. Is this > > something that has been overseen, or am I missing the bigger picture? > > > > > >>> I think so... Compare this... > >>> > >>> HTML: > >>> > >>> Dummy comment > >>> > >>> > >>> Java: (compressed for vertical size!) > >>> > >>> class Article { > >>> private List comments = Arrays.asList(new String[]{"Comment One", > >>> "Comment Two", "Comment Three"}); > >>> public List getComments() { return comments; } > >>> } > >>> > >>> and > >>> > >>> public MyPage(final PageParameters parameters) { > >>> setModel(new CompoundPropertyModel(new Article())); > >>> ListView listView = new ListView("comments") { > >>> protected void populateItem(ListItem item) { > >>> item.add(new Label("comment", (String)item.getModelObject())); > >>> } > >>> }; > >>> } > >>> add(listView); > >>> > >>> gives the following output: > >>> > >>> * Comment One > >>> * Comment Two > >>> * Comment Three > >>> > >>> > >>> /Gwyn > >>> > >>> > >> This is what I meant extending your example a but, it feels odd to make > >> an extra compoundpropertymodel: > >> > >> class Article { > >> private List comments=new arraylist... > >> public List getComments() { return comments; } > >> } > >> class Comment{ > >> private String text... > >> private String author > >> trival getters and setters... > >> } > >> > >> public MyPage(final PageParameters parameters) { > >> setModel(new CompoundPropertyModel(new Article())); > >> ListView listView = new ListView("comments") { > >> protected void populateItem(ListItem item) { > >> setModel(new *CompundPropertyModel*(item.getModelObject() > >> )) > >> item.add(new Label("comment")); > >> item.add(new Label("author")); > >> > >> } > >> }; > >> } > >> add(listView); > >> > > > > I see. You can do it like that, but personally, for just a cople of > > labels I'd just implement populateItem() as follows: > > > > > Sure, this was meant to be a simple example.. If you add some complexity > to
Re: Forms and Listview questions..?
Gwyn Evans wrote: On 20/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: Gwyn Evans wrote: On 20/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: Bump for replies..? Does my mail make sense? Do I need to specify anything further? Nino Saturnino Martinez Vazquez Wael wrote: Hi I've been "playing" with both forms and listviews. And I wanted to extend a form creating my own form that has captcha validation as standard, I cant just seem to find where to place the markup when extending Form? Well, off-hand, I'd expect that the easiest way would be to do it using markup inheritance - http://wicket.apache.org/examplemarkupinheritance.html. Hm the link you gave talks about inheritance for a page. However this would mean that I had to put the into the form in order to add stuff to the form right? What about inheritance for a panel, that way I could use it as a form. However I got some strange errors when trying todo this. Heres some pseduo panel.html panel.java private final Form form panel(String id) { super(id); form=new Form("form"); add(form); form.add(new textfield..) add(new captcha...); } public addToForm(Component child){ form.add(child); } Then the extending panels can add more stuff to the form.. Is this supposed to work? If I understand it correctly, I'd have thought so, yes, although if just getting started, I'd be tempted to get things going on a basic page, then start refactoring. Ok, i'll try to redo the panel, and if I run into troubles i'll provide a quickstart... I then tried doing it with a panel but also ran into sometroubles. Also I've been noticing that if you use a compound model with a listview forexample my page has a compound model called article I add the listview new listview("comments"). I would expect my item in the populate implementation to get fed a comment compoundmodel, but it does only get the compound model for the page, I then have to call item.getModelObject and set the compundmodel manually. Is this something that has been overseen, or am I missing the bigger picture? I think so... Compare this... HTML: Dummy comment Java: (compressed for vertical size!) class Article { private List comments = Arrays.asList(new String[]{"Comment One", "Comment Two", "Comment Three"}); public List getComments() { return comments; } } and public MyPage(final PageParameters parameters) { setModel(new CompoundPropertyModel(new Article())); ListView listView = new ListView("comments") { protected void populateItem(ListItem item) { item.add(new Label("comment", (String)item.getModelObject())); } }; } add(listView); gives the following output: * Comment One * Comment Two * Comment Three /Gwyn This is what I meant extending your example a but, it feels odd to make an extra compoundpropertymodel: class Article { private List comments=new arraylist... public List getComments() { return comments; } } class Comment{ private String text... private String author trival getters and setters... } public MyPage(final PageParameters parameters) { setModel(new CompoundPropertyModel(new Article())); ListView listView = new ListView("comments") { protected void populateItem(ListItem item) { setModel(new *CompundPropertyModel*(item.getModelObject() )) item.add(new Label("comment")); item.add(new Label("author")); } }; } add(listView); I see. You can do it like that, but personally, for just a cople of labels I'd just implement populateItem() as follows: Sure, this was meant to be a simple example.. If you add some complexity to it it's much simpler to use the compound propertymodel, and theres not need for all that code calling all the different acessors since this is what a compoundmodel does.. Im not sure if something else can be gained if you make it detachable? protected void populateItem(ListItem item) { final Comment comment = (Comment)item.getModelObject(); item.add(new Label("text", comment.getText())); item.add(new Label("author", comment.getAuthor())); } By the way, my HTML was incorrect before. If should be more like this... No problem, so was mine.. : /Gwyn -- Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forms and Listview questions..?
On 20/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: > > > Gwyn Evans wrote: > > On 20/11/2007, Nino Saturnino Martinez Vazquez Wael > > <[EMAIL PROTECTED]> wrote: > > > >> Bump for replies..? Does my mail make sense? Do I need to specify > >> anything further? > >> > >> Nino Saturnino Martinez Vazquez Wael wrote: > >> > >>> Hi > >>> > >>> I've been "playing" with both forms and listviews. And I wanted to > >>> extend a form creating my own form that has captcha validation as > >>> standard, I cant just seem to find where to place the markup when > >>> extending Form? > >>> > > > > Well, off-hand, I'd expect that the easiest way would be to do it > > using markup inheritance - > > http://wicket.apache.org/examplemarkupinheritance.html. > > > > > Hm the link you gave talks about inheritance for a page. However this > would mean that I had to put the into the form in order > to add stuff to the form right? What about inheritance for a panel, that > way I could use it as a form. However I got some strange errors when > trying todo this. Heres some pseduo > > > panel.html > > > > > > > > > > > > > panel.java > > private final Form form > > panel(String id) > { > super(id); > form=new Form("form"); > add(form); > > form.add(new textfield..) > add(new captcha...); > } > > public addToForm(Component child){ > form.add(child); > } > > Then the extending panels can add more stuff to the form.. Is this > supposed to work? If I understand it correctly, I'd have thought so, yes, although if just getting started, I'd be tempted to get things going on a basic page, then start refactoring. > >>> I then tried doing it with a panel but also ran into > >>> sometroubles. > >>> > > > > > >>> Also I've been noticing that if you use a compound model with a > >>> listview forexample my page has a compound model called article I add > >>> the listview new listview("comments"). I would expect my item in the > >>> populate implementation to get fed a comment compoundmodel, but it > >>> does only get the compound model for the page, I then have to call > >>> item.getModelObject and set the compundmodel manually. Is this > >>> something that has been overseen, or am I missing the bigger picture? > >>> > > > > I think so... Compare this... > > > > HTML: > > > > Dummy comment > > > > > > Java: (compressed for vertical size!) > > > > class Article { > > private List comments = Arrays.asList(new String[]{"Comment One", > > "Comment Two", "Comment Three"}); > > public List getComments() { return comments; } > > } > > > > and > > > > public MyPage(final PageParameters parameters) { > > setModel(new CompoundPropertyModel(new Article())); > > ListView listView = new ListView("comments") { > > protected void populateItem(ListItem item) { > > item.add(new Label("comment", (String)item.getModelObject())); > > } > > }; > > } > > add(listView); > > > > gives the following output: > > > > * Comment One > > * Comment Two > > * Comment Three > > > > > > /Gwyn > > > This is what I meant extending your example a but, it feels odd to make > an extra compoundpropertymodel: > > class Article { > private List comments=new arraylist... > public List getComments() { return comments; } > } > class Comment{ > private String text... > private String author > trival getters and setters... > } > > public MyPage(final PageParameters parameters) { > setModel(new CompoundPropertyModel(new Article())); > ListView listView = new ListView("comments") { > protected void populateItem(ListItem item) { > setModel(new *CompundPropertyModel*(item.getModelObject() > )) > item.add(new Label("comment")); > item.add(new Label("author")); > > } > }; > } > add(listView); I see. You can do it like that, but personally, for just a cople of labels I'd just implement populateItem() as follows: protected void populateItem(ListItem item) { final Comment comment = (Comment)item.getModelObject(); item.add(new Label("text", comment.getText())); item.add(new Label("author", comment.getAuthor())); } By the way, my HTML was incorrect before. If should be more like this... : /Gwyn -- Download Wicket 1.3.0-rc1 now! - http://wicketframework.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forms and Listview questions..?
Gwyn Evans wrote: On 20/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: Bump for replies..? Does my mail make sense? Do I need to specify anything further? Nino Saturnino Martinez Vazquez Wael wrote: Hi I've been "playing" with both forms and listviews. And I wanted to extend a form creating my own form that has captcha validation as standard, I cant just seem to find where to place the markup when extending Form? Well, off-hand, I'd expect that the easiest way would be to do it using markup inheritance - http://wicket.apache.org/examplemarkupinheritance.html. Hm the link you gave talks about inheritance for a page. However this would mean that I had to put the into the form in order to add stuff to the form right? What about inheritance for a panel, that way I could use it as a form. However I got some strange errors when trying todo this. Heres some pseduo panel.html panel.java private final Form form panel(String id) { super(id); form=new Form("form"); add(form); form.add(new textfield..) add(new captcha...); } public addToForm(Component child){ form.add(child); } Then the extending panels can add more stuff to the form.. Is this supposed to work? I then tried doing it with a panel but also ran into sometroubles. Also I've been noticing that if you use a compound model with a listview forexample my page has a compound model called article I add the listview new listview("comments"). I would expect my item in the populate implementation to get fed a comment compoundmodel, but it does only get the compound model for the page, I then have to call item.getModelObject and set the compundmodel manually. Is this something that has been overseen, or am I missing the bigger picture? I think so... Compare this... HTML: Dummy comment Java: (compressed for vertical size!) class Article { private List comments = Arrays.asList(new String[]{"Comment One", "Comment Two", "Comment Three"}); public List getComments() { return comments; } } and public MyPage(final PageParameters parameters) { setModel(new CompoundPropertyModel(new Article())); ListView listView = new ListView("comments") { protected void populateItem(ListItem item) { item.add(new Label("comment", (String)item.getModelObject())); } }; } add(listView); gives the following output: * Comment One * Comment Two * Comment Three /Gwyn This is what I meant extending your example a but, it feels odd to make an extra compoundpropertymodel: class Article { private List comments=new arraylist... public List getComments() { return comments; } } class Comment{ private String text... private String author trival getters and setters... } public MyPage(final PageParameters parameters) { setModel(new CompoundPropertyModel(new Article())); ListView listView = new ListView("comments") { protected void populateItem(ListItem item) { setModel(new *CompundPropertyModel*(item.getModelObject() )) item.add(new Label("comment")); item.add(new Label("author")); } }; } add(listView); -- Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forms and Listview questions..?
On 20/11/2007, Nino Saturnino Martinez Vazquez Wael <[EMAIL PROTECTED]> wrote: > Bump for replies..? Does my mail make sense? Do I need to specify > anything further? > > Nino Saturnino Martinez Vazquez Wael wrote: > > Hi > > > > I've been "playing" with both forms and listviews. And I wanted to > > extend a form creating my own form that has captcha validation as > > standard, I cant just seem to find where to place the markup when > > extending Form? Well, off-hand, I'd expect that the easiest way would be to do it using markup inheritance - http://wicket.apache.org/examplemarkupinheritance.html. > > I then tried doing it with a panel but also ran into > > sometroubles. > > > > Also I've been noticing that if you use a compound model with a > > listview forexample my page has a compound model called article I add > > the listview new listview("comments"). I would expect my item in the > > populate implementation to get fed a comment compoundmodel, but it > > does only get the compound model for the page, I then have to call > > item.getModelObject and set the compundmodel manually. Is this > > something that has been overseen, or am I missing the bigger picture? I think so... Compare this... HTML: Dummy comment Java: (compressed for vertical size!) class Article { private List comments = Arrays.asList(new String[]{"Comment One", "Comment Two", "Comment Three"}); public List getComments() { return comments; } } and public MyPage(final PageParameters parameters) { setModel(new CompoundPropertyModel(new Article())); ListView listView = new ListView("comments") { protected void populateItem(ListItem item) { item.add(new Label("comment", (String)item.getModelObject())); } }; } add(listView); gives the following output: * Comment One * Comment Two * Comment Three /Gwyn -- Download Wicket 1.3.0-rc1 now! - http://wicketframework.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forms and Listview questions..?
Bump for replies..? Does my mail make sense? Do I need to specify anything further? Nino Saturnino Martinez Vazquez Wael wrote: Hi I've been "playing" with both forms and listviews. And I wanted to extend a form creating my own form that has captcha validation as standard, I cant just seem to find where to place the markup when extending Form? I then tried doing it with a panel but also ran into sometroubles. Also I've been noticing that if you use a compound model with a listview forexample my page has a compound model called article I add the listview new listview("comments"). I would expect my item in the populate implementation to get fed a comment compoundmodel, but it does only get the compound model for the page, I then have to call item.getModelObject and set the compundmodel manually. Is this something that has been overseen, or am I missing the bigger picture? regards -- Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Forms and Listview questions..?
Hi I've been "playing" with both forms and listviews. And I wanted to extend a form creating my own form that has captcha validation as standard, I cant just seem to find where to place the markup when extending Form? I then tried doing it with a panel but also ran into sometroubles. Also I've been noticing that if you use a compound model with a listview forexample my page has a compound model called article I add the listview new listview("comments"). I would expect my item in the populate implementation to get fed a comment compoundmodel, but it does only get the compound model for the page, I then have to call item.getModelObject and set the compundmodel manually. Is this something that has been overseen, or am I missing the bigger picture? regards -- Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]