I have the following model class (simplified)
class A{
private String name;
private List<B> items;
}
class B{
private long from;
private long to;
}
Moreover I have Form that gets the class A bound by a CompoundPropertyModel. If I want to display a TextField that is bound to the name field, I just add
new TextField("name");
and that’s all. But how do I correctly bind this list of items? For class B I also have FormComponent that overrides the convertInput, because I want to do some calculations before assigning the values to the fields from, to.
I have tried (Property)ListView, but both seem not to work (or I use them in a wrong way).
Thank you and kind regards,
M.
Using
is equivalent to
The ListView’s Model will be backed by the
itemsproperty of the CPM’s model object.Remember to override
populateItem, in which theListItem‘s model object will be each one of the elements in theList.You can perform your calculations on the
itemsproperty of the backing model object. If you don’t want to modify the model object’s property, you shouldn’t be using CPM to bind theitemsproperty, and implement aModelthat provides the modifiedList(might be useful if you want these calculations to be updated at every page rendering, as in ajax refreshing.This Wicket wiki page shows the usage of
ListView: ListView and other repeaters