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

only if you use form inputs there. If it is in a list but it only shows some data then
it 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 everytime
different? So for example then you generate 5 times 2 of those textfields with completely
different 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 stuff
But 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 stuff
And 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 "old"
components 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 anymore
we 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.


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
Wicket-user mailing list

Reply via email to