THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The Wicket project uses the IModel
interface to bind components to your data. For instance showing a list of people's names in Wicket 1.3 looks like
...
List<Person> people = ...;
add(new ListView("people", people) {
protected void populateItem(Item item) {
Person p = (Person)item.getModelObject();
...
}
});
Notice the ugly cast needed to get the person from the item
? In Wicket 1.4 this has been modified to use generics so components know their types:
...
List<Person> people = new ArrayList<Person>();
add(new ListView<Person>("people", people) {
@Override
protected void populateItem(ListItem<Person> item) {
Person p = item.getModelObject();
}
});
This enables the Java compiler to generate errors like the following screenshot shows: