You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Wicket 1.4 M1 - New and Noteworthy

The first milestone has arrived. Here are some of the more noteworthy things available in milestone build M1 (May 2, 2008) which is now available for download. See the build notes for details about bugs fixed and other changes.

Java 5 required

Previous releases of Wicket required at a minimum Java 1.4. We have now decided (after consulting our user base) that from now on, Wicket will run only on Java 5 or newer. This will grant us the opportunity to utilize the new features that Java 5 brings, of which generics are the most prevalent use.

In the very least you should update your Java compiler settings:

 
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.5</source>
        <target>1.5</target>
    </configuration>
</plugin>

First cut at a generified Model

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:

  • No labels