Here's the snippet that caused the most work (I've added some comments, hopefully they make the code less dense):
listItem.add(new ListView("innerTable1", allwrongwords) {
//Here we populate the list with wrong words
protected void populateItem(ListItem listItem) {
listItem.add(new MultiLineLabel("one_wrong_word", ((Words)allwrongwords.get(listItem.getIndex())).getWord()));
int onewordsuggestioncount = ((Words)allwrongwords.get(listItem.getIndex())).getSuggestionCount();
//Here we populate the list with the number of suggestions
listItem.add(new MultiLineLabel("no_of_suggestions", String.valueOf(onewordsuggestioncount)));
final List allsuggestions = ((Words)allwrongwords.get(listItem.getIndex())).getSuggestions();
listItem.add(new ListView("innerTable2", allsuggestions) {
//Now we populate the list with the suggestions for the given wrong word:
protected void populateItem(ListItem listItem) {
listItem.add(new MultiLineLabel("one_suggestion", ((String)allsuggestions.get(listItem.getIndex()))));
}
});
}
});
On the HTML side, this is how the above snippet is rendered:
<span wicket:id = "innerTable1">
<ul><li><b><font color="red"><span wicket:id="one_wrong_word">One wrong word goes here</span></font></b>
(<span wicket:id="no_of_suggestions">Number of suggestions goes here</span> suggestions)<br>
<span wicket:id = "innerTable2">
<span wicket:id="one_suggestion">One suggestion goes here</span>
</span></li></ul>
</span>
And here's the result (the above snippets relate specifically to the lower part of the screenshot below, where you see the two wrongly spelled words displayed):
This is definitely the most intense bit of work I've done in Wicket and it really was pretty cool. I didn't realize that Wicket's ListViews make for loops superfluous. Never liked them much anyway.