Re: [Wicket-user] Form + pull model ListView + FormValidators
ok, i think I got i now. If using pull models with a dynamic ListView within a form, we have to override getListItemModel() and return a slightly more sophisticated model. This makes sense. But could it be possible to consolidate these a bit then. What if ListView would have a new constructor new ListView(String id, IDataProvider dataProvider) ? The DataView could be deprecated. Joni On Thu, 2006-08-10 at 13:28 -0700, Igor Vaynberg wrote: i dont think this is a problem with listview. i think joni misunderstood what setreuseitems() did and that even with pull models it makes sense. in this particular case dataview would suffer the exact same problems as the listview save one - you will not forget to override getlistitemmodel() because it is part of the idataprovider interface. but even with a dataview you would have to set an item reuse strategy which is equivalent to calling setreuseitems(true) on the listview. in dataview, same as the listview, the items would be recreated, etc - thats just the nature of repeaters in wicket. -Igor On 8/10/06, Eelco Hillenius [EMAIL PROTECTED] wrote: I'm gradually getting to a conclusion that ListView sucks, and should be replaced with something more robust. It does suck that about 25% of the problems people have with Wicket seems to come from the ListView. What do you think about the repeater packages? I'm still using ListViews myself mostly; they do the job for me. But Igor created them out of frustration with ListViews (and that was a long time ago). If more people think repeaters are a better solution than ListViews, maybe we should consider putting ListView more in the background (e.g. red rid of them in examples and more specifically Wicket In Action), and getting some repeaters over to the core project for Wicket 2.0. If there was ever a time to 'fix' this, it's now. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
This would be very good too. Joni On Thu, 2006-08-10 at 23:39 +0200, Johan Compagner wrote: it does work really differnet then wat we do now. And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better: IFormValidator { validate(Form) } MyPanel implements IFormValidator { validate() { validate the panel. } } and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account. Much cleaner and not so verbose in code if you ask me.. johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator(IFormValidator v) that maeks the usecase even simpler to implement. -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
And probably more elegant that providing automatic cleaning of old IFormValidators. Joni On Fri, 2006-08-11 at 15:13 +0300, Joni Freeman wrote: This would be very good too. Joni On Thu, 2006-08-10 at 23:39 +0200, Johan Compagner wrote: it does work really differnet then wat we do now. And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better: IFormValidator { validate(Form) } MyPanel implements IFormValidator { validate() { validate the panel. } } and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account. Much cleaner and not so verbose in code if you ask me.. johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator(IFormValidator v) that maeks the usecase even simpler to implement. -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
Please add a RFE if you can.johanOn 8/11/06, Joni Freeman [EMAIL PROTECTED] wrote: This would be very good too.JoniOn Thu, 2006-08-10 at 23:39 +0200, Johan Compagner wrote: it does work really differnet then wat we do now. And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better: IFormValidator { validate(Form) } MyPanel implements IFormValidator { validate() { validate the panel. } } and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account. Much cleaner and not so verbose in code if you ask me.. johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator (IFormValidator v) that maeks the usecase even simpler to implement. -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
ah, so when i propose it it sucks : http://www.nabble.com/form.onsubmit-vs-button.onsubmit-tf1977859.html#a5426708but when you do it its a please add an rfe? :) -IgorOn 8/11/06, Johan Compagner [EMAIL PROTECTED] wrote: Please add a RFE if you can.johanOn 8/11/06, Joni Freeman [EMAIL PROTECTED] wrote: This would be very good too.JoniOn Thu, 2006-08-10 at 23:39 +0200, Johan Compagner wrote: it does work really differnet then wat we do now. And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better: IFormValidator { validate(Form) } MyPanel implements IFormValidator { validate() { validate the panel. } } and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account. Much cleaner and not so verbose in code if you ask me.. johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator (IFormValidator v) that maeks the usecase even simpler to implement. -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
is that the same??We are here just talking about IFormValidators that can be in the hierachy of the Formthat will be looked up when a submit happens.. or am i missing something?johan On 8/11/06, Igor Vaynberg [EMAIL PROTECTED] wrote: ah, so when i propose it it sucks : http://www.nabble.com/form.onsubmit-vs-button.onsubmit-tf1977859.html#a5426708 but when you do it its a please add an rfe? :) -IgorOn 8/11/06, Johan Compagner [EMAIL PROTECTED] wrote: Please add a RFE if you can.johanOn 8/11/06, Joni Freeman [EMAIL PROTECTED] wrote: This would be very good too.JoniOn Thu, 2006-08-10 at 23:39 +0200, Johan Compagner wrote: it does work really differnet then wat we do now. And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better: IFormValidator { validate(Form) } MyPanel implements IFormValidator { validate() { validate the panel. } } and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account. Much cleaner and not so verbose in code if you ask me.. johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator (IFormValidator v) that maeks the usecase even simpler to implement. -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
well, i mentioned so we can additionally have IFormValidationAware { void onValidate(); } that works just like the IFormSubmitAware i proposed which is identical to what we are talking about here :) -IgorOn 8/11/06, Johan Compagner [EMAIL PROTECTED] wrote: is that the same??We are here just talking about IFormValidators that can be in the hierachy of the Formthat will be looked up when a submit happens.. or am i missing something? johan On 8/11/06, Igor Vaynberg [EMAIL PROTECTED] wrote: ah, so when i propose it it sucks : http://www.nabble.com/form.onsubmit-vs-button.onsubmit-tf1977859.html#a5426708 but when you do it its a please add an rfe? :) -IgorOn 8/11/06, Johan Compagner [EMAIL PROTECTED] wrote: Please add a RFE if you can.johanOn 8/11/06, Joni Freeman [EMAIL PROTECTED] wrote: This would be very good too.JoniOn Thu, 2006-08-10 at 23:39 +0200, Johan Compagner wrote: it does work really differnet then wat we do now. And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better: IFormValidator { validate(Form) } MyPanel implements IFormValidator { validate() { validate the panel. } } and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account. Much cleaner and not so verbose in code if you ask me.. johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator (IFormValidator v) that maeks the usecase even simpler to implement. -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
On Thu, 2006-08-10 at 01:05 +0200, Johan Compagner wrote: This code is extremely ugly! Everytime you render the page the form gets a new FormValidator because everytime the listview is populated.. Do setReuseItems(boolean reuseItems) to true on the ListView. setReuseItems does not make sense with pull models cause it stores the items, and does not rebuild the list items. I'm gradually getting to a conclusion that ListView sucks, and should be replaced with something more robust. A core component should not have following problems: - you have to remember to call setReuseItems if it is within a form - you can't call setReuseItems if you use pull models - it fails if some other process changes the database And if you remove them yourself you should be able to also delete the validator from the form because that one is really not valid anymore... but that is a problem because there is no remove(validator) method i think... Manually removing the IFromValidators is not a good option (even if the api would be opened). Why should we manually remove them while the old components are automatically replaced by ListView? Joni On 8/8/06, Joni Freeman [EMAIL PROTECTED] wrote: Consider following form which uses ListView with pull model. public MyForm extends Form { public MyForm(String id, IModel model) { super(id, model); add(new ListView(items) { public IModel getModel() { return new Model( dao.findAll()); } protected void populateItem(final ListItem item) { FormComponent text1 = new TextField(t1); FormComponent text2 = new TextField(t2); item.add(text1); item.add(text2); MyForm.this.add(new MyFormValidator(text1, text2)); } }; } protected void onSubmit() { // hello world! } } Now, the first submit is ok, but if the validation fails during the first submit and the user presses submit again, the whole form fails to Caused by: java.lang.IllegalStateException : No Page found for component [MarkupContainer [Component id = TextField.text, page = No Page, path = 1:semester.length:start:TextField.text]] at wicket.Component.getPage(Component.java:1022) at wicket.Component.hasErrorMessage (Component.java:1226) at wicket.markup.html.form.FormComponent.isValid(FormComponent.java:442) ... Why? Because the Form instance contains FormValidators which reference old instances of FormComponents. These old instances are not in a Form after the first submit because the ListView uses pull model and therefore can't call setReuseItems(true); So, it seems that it is not possible to use pull model ListView in a Form? Joni - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net
Re: [Wicket-user] Form + pull model ListView + FormValidators
I'm gradually getting to a conclusion that ListView sucks, and should bereplaced with something more robust. A core component should not have following problems:- you have to remember to call setReuseItems if it is within a formonly if you use form inputs there. If it is in a list but it only shows some data thenit is no problem. Maybe we could somehow detect this.. Because i agree it is a common mistake..- you can't call setReuseItems if you use pull models Why not?Why do you have to rebuild the component structure everytime. Is it really everytimedifferent? So for example then you generate 5 times 2 of those textfields with completelydifferent data? And then again 3 with 2 of them? If that is the case and it is really dynamic yes the you need to regenerate the stuffBut you can't then make hard references from the populateItem method components (that you create there) to a component that is outside of the listview. (This is what you do) Because everytime you generate the list. You add a new IFormValidator.. That is also a major memory leak.So somehow you need to cleanup your form first before you populate new items.Or maybe we can fix this.. See below. - it fails if some other process changes the database But for database data and so on we have the repeater package. with IDataProvider and so on.And it still doesn't really fail if you use ListView the right way for database stuffAnd that is also generate the right model override 2 methods. populateItem and getListItemModel() And if you remove them yourself you should be able to also delete the validator from the form because that one is really not valid anymore... but that is a problem because there is no remove(validator) method i think...Manually removing the IFromValidators is not a good option (even if the api would be opened). Why should we manually remove them while the oldcomponents are automatically replaced by ListView?So you are saying that we have to see that in the validator? Hmm this is possible let me look at it.What we could do is ask this method for the components:FormComponent[] getDependentFormComponents();then check if these components are still valid and if not don't call validate(Form) The problem is that validator should be removed ... Because as i said before this is a memory leak.And that check can be build and maybe if we notice that the components are not valid anymorewe could remove the validator from the form. But this is a bit to late. Because this only happens if a submit does happen after a render. And this ofcourse doesn't have to be the case.So what we could do is do the check in onDetach() of the form. And let the form check if all its validators are valid and if not throw away. johan - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
I'm gradually getting to a conclusion that ListView sucks, and should be replaced with something more robust. It does suck that about 25% of the problems people have with Wicket seems to come from the ListView. What do you think about the repeater packages? I'm still using ListViews myself mostly; they do the job for me. But Igor created them out of frustration with ListViews (and that was a long time ago). If more people think repeaters are a better solution than ListViews, maybe we should consider putting ListView more in the background (e.g. red rid of them in examples and more specifically Wicket In Action), and getting some repeaters over to the core project for Wicket 2.0. If there was ever a time to 'fix' this, it's now. Eelco - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
i dont think this is a problem with listview. i think joni misunderstood what setreuseitems() did and that even with pull models it makes sense. in this particular case dataview would suffer the exact same problems as the listview save one - you will not forget to override getlistitemmodel() because it is part of the idataprovider interface. but even with a dataview you would have to set an item reuse strategy which is equivalent to calling setreuseitems(true) on the listview. in dataview, same as the listview, the items would be recreated, etc - thats just the nature of repeaters in wicket. -IgorOn 8/10/06, Eelco Hillenius [EMAIL PROTECTED] wrote: I'm gradually getting to a conclusion that ListView sucks, and should be replaced with something more robust.It does suck that about 25% of the problems people have with Wicketseems to come from the ListView. What do you think about the repeater packages? I'm still usingListViews myself mostly; they do the job for me. But Igor created themout of frustration with ListViews (and that was a long time ago). Ifmore people think repeaters are a better solution than ListViews, maybe we should consider putting ListView more in the background (e.g.red rid of them in examples and more specifically Wicket In Action),and getting some repeaters over to the core project for Wicket 2.0. If there was ever a time to 'fix' this, it's now.Eelco-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator(IFormValidator v) that maeks the usecase even simpler to implement. -IgorOn 8/10/06, Johan Compagner [EMAIL PROTECTED] wrote: and besides that the problem still remains if you really throw away a item (in the list of dataview doesn't matter)then the IFormValidator instance is still holdign on the 2 textfields that are invalid now So how to get rid of them? johanOn 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: i dont think this is a problem with listview. i think joni misunderstood what setreuseitems() did and that even with pull models it makes sense. in this particular case dataview would suffer the exact same problems as the listview save one - you will not forget to override getlistitemmodel() because it is part of the idataprovider interface. but even with a dataview you would have to set an item reuse strategy which is equivalent to calling setreuseitems(true) on the listview. in dataview, same as the listview, the items would be recreated, etc - thats just the nature of repeaters in wicket. -IgorOn 8/10/06, Eelco Hillenius [EMAIL PROTECTED] wrote: I'm gradually getting to a conclusion that ListView sucks, and should be replaced with something more robust.It does suck that about 25% of the problems people have with Wicketseems to come from the ListView. What do you think about the repeater packages? I'm still usingListViews myself mostly; they do the job for me. But Igor created themout of frustration with ListViews (and that was a long time ago). If more people think repeaters are a better solution than ListViews, maybe we should consider putting ListView more in the background (e.g.red rid of them in examples and more specifically Wicket In Action),and getting some repeaters over to the core project for Wicket 2.0. If there was ever a time to 'fix' this, it's now.Eelco-Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
it does work really differnet then wat we do now.And with a panel it looks maybe nice. But it is a but more blown up code.Personally i like this then better:IFormValidator{ validate(Form)} MyPanel implements IFormValidator{ validate() { validate the panel. }}and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account.Much cleaner and not so verbose in code if you ask me..johanOn 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote:personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator(IFormValidator v) that maeks the usecase even simpler to implement. -Igor - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
thats pretty much what joni suggested!-IgorOn 8/10/06, Johan Compagner [EMAIL PROTECTED] wrote: it does work really differnet then wat we do now.And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better:IFormValidator{ validate(Form)} MyPanel implements IFormValidator{ validate() { validate the panel. }}and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account.Much cleaner and not so verbose in code if you ask me..johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote:personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator(IFormValidator v) that maeks the usecase even simpler to implement. -Igor -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
except that you don't have that extra interface. The component can just be the IFormValidator..But i don't think that will solve his first example.. Where he just added 2 textfields in a ListItemand wanted to validate those 2. Which component is then the supplier? One of the textfields? johanOn 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: thats pretty much what joni suggested!-IgorOn 8/10/06, Johan Compagner [EMAIL PROTECTED] wrote: it does work really differnet then wat we do now.And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better:IFormValidator{ validate(Form)} MyPanel implements IFormValidator{ validate() { validate the panel. }}and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account.Much cleaner and not so verbose in code if you ask me..johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote:personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator(IFormValidator v) that maeks the usecase even simpler to implement. -Igor -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
not only that, then you must also make sure the components you will be using in your validate() are valid themselves - an easy thing to forget.-IgorOn 8/10/06, Johan Compagner [EMAIL PROTECTED] wrote: except that you don't have that extra interface. The component can just be the IFormValidator..But i don't think that will solve his first example.. Where he just added 2 textfields in a ListItemand wanted to validate those 2. Which component is then the supplier? One of the textfields? johanOn 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote: thats pretty much what joni suggested!-IgorOn 8/10/06, Johan Compagner [EMAIL PROTECTED] wrote: it does work really differnet then wat we do now.And with a panel it looks maybe nice. But it is a but more blown up code. Personally i like this then better:IFormValidator{ validate(Form)} MyPanel implements IFormValidator{ validate() { validate the panel. }}and the Form searches for IFormValidator implementors in its tree (besides the normal onces it already has) and takes those also into account.Much cleaner and not so verbose in code if you ask me..johan On 8/10/06, Igor Vaynberg [EMAIL PROTECTED] wrote:personally i like the visitor joni proposed - it doesnt need to be part of core but it solves the problem elegantly. i recently factored out form.validateFormValidator(IFormValidator v) that maeks the usecase even simpler to implement. -Igor -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
joni_18912 ivaynberg: any opinions on IFormValidator issue? Currently it is very difficult to work with them if the components in a Form changeivaynberg joni_18912 i think what you suggest worksivaynberg but you do realize that you can implement that yourself by subclassing the form? ivaynberg we need to discuss this with chillenious and jcompagner here because usually we all disagree as far as changes to core form processing goes :)joni_18912 ok :)chillenious :) chillenious what's the proposalchillenious ?chillenious that IFormValidator was a nasty buggerjoni_18912 chillenious: http://thread.gmane.org/gmane.comp.java.wicket.user/15627/focus=15643chillenious ah, I read the thread but missed the proposal partjoni_18912 only that i don't see how it is possible to implement it by subclassing the form. only way to get IFormValidators to a form is by pushing them ivaynberg you override validate()ivaynberg and process them yourselfjoni_18912 rightivaynberg after some discussions i am a bit hesitant of adding more stuff to form processing ivaynberg cause it seems everyone expects it to work slightly differentivaynberg so it just makes more of a messchillenious yeah I agreeivaynberg butchillenious better keep it simple if we can ivaynberg what i can do is break out validate(IFormValidator) for you so when you override validate and collect the validators you can just delegate to that callivaynberg so you dont have to rewrite as much ivaynberg sound good?joni_18912 that would be goodivaynberg okchillenious to me that does sound good tooivaynberg let me do that right nowjoni_18912 ty ivaynberg npchillenious better than the lazy loading thing. That's a nice pattern in itself, but it would add more complexity (not to mention another API break)ivaynberg i think a wiki page with the visitor would be nice in case someone else runs into this -IgorOn 8/8/06, Joni Freeman [EMAIL PROTECTED] wrote: On Tue, 2006-08-08 at 08:36 -0700, Igor Vaynberg wrote: this only solves it partially though - added formvalidators are still going to be a problem for removed items - not sure about the best approach right now - we might have to open more api or make validation smarter - lets discuss this some more.I think the problem is that IFormValidators are pushed to a Form.Pushing things do not work well when using pull models. What if Formwould pull FormValidators instead: public Form extends WebMarkupContainer implements IFormSubmitListener{...protected ListIFormValidator formValidators(){ListIFormValidator formValidators = new ArrayListIFormValidator();visitChildren(IFormValidatorProvider.class, new IVisitor(){public Object component(final Component component){IFormValidatorProvider provider = (IFormValidatorProvider) component;validators.addAll(provider.formValidators());return CONTINUE_TRAVERSAL;} });return formValidators; }}public interface IFormValidatorProvider{CollectionIFormValidator formValidators();}This would allow IFormValidators to be encapsulated with components.E.g. public DateRangePicker extends Panel implements IFormValidatorProvider{public DateRangePicker(String id){super(id);start = new DateRange(start);end = new DateRange(end); }public CollectionIFormValidator formValidators(){return Arrays.asList(new DateRangePickerValidator(start, end));}private class DateRangePickerValidator implements IFormValidator {public DateRangeFieldValidator(DatePicker start, DatePickerend){}}}This would also be more flexible than the current way since the decisionabout whether to include a certain IFormValidator can be done at onSubmit() phase.Any comments?Joni-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
This code is extremely ugly!Everytime you render the page the form gets a new FormValidator because everytime the listview is populated..Do setReuseItems(boolean reuseItems) to true on the ListView.And if you remove them yourself you should be able to also delete the validator from the form because that one is really not valid anymore...but that is a problem because there is no remove(validator) method i think...On 8/8/06, Joni Freeman [EMAIL PROTECTED] wrote:Consider following form which uses ListView with pull model. public MyForm extends Form {public MyForm(String id, IModel model) {super(id, model);add(new ListView(items) {public IModel getModel() {return new Model( dao.findAll());}protected void populateItem(final ListItem item) {FormComponent text1 = new TextField(t1);FormComponent text2 = new TextField(t2); item.add(text1);item.add(text2);MyForm.this.add(new MyFormValidator(text1, text2));}};}protected void onSubmit() { // hello world!}}Now, the first submit is ok, but if the validation fails during thefirst submit and the user presses submit again, the whole form fails toCaused by: java.lang.IllegalStateException : No Page found for component[MarkupContainer [Component id = TextField.text, page = No Page, path= 1:semester.length:start:TextField.text]]at wicket.Component.getPage(Component.java:1022)at wicket.Component.hasErrorMessage (Component.java:1226)atwicket.markup.html.form.FormComponent.isValid(FormComponent.java:442)...Why? Because the Form instance contains FormValidators which referenceold instances of FormComponents. These old instances are not in a Form after the first submit because the ListView uses pull model andtherefore can't call setReuseItems(true);So, it seems that it is not possible to use pull model ListView in aForm?Joni -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
and because the listview might remove items for you as well if they have been deleted from the database by someone else :)-IgorOn 8/9/06, Johan Compagner [EMAIL PROTECTED] wrote: This code is extremely ugly!Everytime you render the page the form gets a new FormValidator because everytime the listview is populated..Do setReuseItems(boolean reuseItems) to true on the ListView.And if you remove them yourself you should be able to also delete the validator from the form because that one is really not valid anymore...but that is a problem because there is no remove(validator) method i think...On 8/8/06, Joni Freeman [EMAIL PROTECTED] wrote: Consider following form which uses ListView with pull model. public MyForm extends Form {public MyForm(String id, IModel model) {super(id, model);add(new ListView(items) {public IModel getModel() {return new Model( dao.findAll());}protected void populateItem(final ListItem item) {FormComponent text1 = new TextField(t1);FormComponent text2 = new TextField(t2); item.add(text1);item.add(text2);MyForm.this.add(new MyFormValidator(text1, text2));}};}protected void onSubmit() { // hello world!}}Now, the first submit is ok, but if the validation fails during thefirst submit and the user presses submit again, the whole form fails toCaused by: java.lang.IllegalStateException : No Page found for component[MarkupContainer [Component id = TextField.text, page = No Page, path= 1:semester.length:start:TextField.text]]at wicket.Component.getPage(Component.java:1022)at wicket.Component.hasErrorMessage (Component.java:1226)atwicket.markup.html.form.FormComponent.isValid(FormComponent.java:442)...Why? Because the Form instance contains FormValidators which referenceold instances of FormComponents. These old instances are not in a Form after the first submit because the ListView uses pull model andtherefore can't call setReuseItems(true);So, it seems that it is not possible to use pull model ListView in aForm?Joni -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
you can pull, you just have to override each item's model. in getListItemModel() return a detachable model that can load the item by pk, otherwise you can run into big problems on the callback.ie: on render you return A,B,C,D on callback you return A,B,E,F,Dnow if on this callback user clicked on C you will actually be working on E which is a big booboo. this is why i integrated model() call into the idataprovider - so people dont forget. this only solves it partially though - added formvalidators are still going to be a problem for removed items - not sure about the best approach right now - we might have to open more api or make validation smarter - lets discuss this some more. -IgorOn 8/8/06, Joni Freeman [EMAIL PROTECTED] wrote: Consider following form which uses ListView with pull model.public MyForm extends Form {public MyForm(String id, IModel model) {super(id, model);add(new ListView(items) { public IModel getModel() {return new Model(dao.findAll());}protected void populateItem(final ListItem item) {FormComponent text1 = new TextField(t1); FormComponent text2 = new TextField(t2);item.add(text1);item.add(text2);MyForm.this.add(new MyFormValidator(text1, text2));} };}protected void onSubmit() {// hello world!}}Now, the first submit is ok, but if the validation fails during thefirst submit and the user presses submit again, the whole form fails to Caused by: java.lang.IllegalStateException: No Page found for component[MarkupContainer [Component id = TextField.text, page = No Page, path= 1:semester.length:start:TextField.text]]at wicket.Component.getPage (Component.java:1022)at wicket.Component.hasErrorMessage(Component.java:1226)atwicket.markup.html.form.FormComponent.isValid(FormComponent.java:442)...Why? Because the Form instance contains FormValidators which reference old instances of FormComponents. These old instances are not in a Formafter the first submit because the ListView uses pull model andtherefore can't call setReuseItems(true);So, it seems that it is not possible to use pull model ListView in a Form?Joni-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Form + pull model ListView + FormValidators
On Tue, 2006-08-08 at 08:36 -0700, Igor Vaynberg wrote: this only solves it partially though - added formvalidators are still going to be a problem for removed items - not sure about the best approach right now - we might have to open more api or make validation smarter - lets discuss this some more. I think the problem is that IFormValidators are pushed to a Form. Pushing things do not work well when using pull models. What if Form would pull FormValidators instead: public Form extends WebMarkupContainer implements IFormSubmitListener { ... protected ListIFormValidator formValidators() { ListIFormValidator formValidators = new ArrayListIFormValidator(); visitChildren(IFormValidatorProvider.class, new IVisitor() { public Object component(final Component component) { IFormValidatorProvider provider = (IFormValidatorProvider) component; validators.addAll(provider.formValidators()); return CONTINUE_TRAVERSAL; } }); return formValidators; } } public interface IFormValidatorProvider { CollectionIFormValidator formValidators(); } This would allow IFormValidators to be encapsulated with components. E.g. public DateRangePicker extends Panel implements IFormValidatorProvider { public DateRangePicker(String id) { super(id); start = new DateRange(start); end = new DateRange(end); } public CollectionIFormValidator formValidators() { return Arrays.asList(new DateRangePickerValidator(start, end)); } private class DateRangePickerValidator implements IFormValidator { public DateRangeFieldValidator(DatePicker start, DatePicker end) { } } } This would also be more flexible than the current way since the decision about whether to include a certain IFormValidator can be done at onSubmit() phase. Any comments? Joni - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user