Wicket auto-complete text fields

It's modern practice in web applications to augment text fields with suggestions while one types. There are plenty of Javascript libraries out there to do that, and plenty of integrations with the Java web framework Wicket out there as well, but somehow none quite did exactly what I wanted, so I've rolled my own Wicket code (based on JQuery).

What I wanted, but what other Wicket / Javascript libraries did not do, were:

Surprisingly all of the above are not particularly easy to achieve simultaneously. But they are now done:

And coupled with my newly created extensive multi-lingual location hierarchy database (hierarchy in the sense of 2nd district -> Vienna -> Austria -> Europe -> World, multi-lingual in the sense I have these displayable strings in various languages), allows me to create a MultipleValueLocationTextField subclass, which can be included in a host HTML page in one line of HTML and one line of Java, and which synchronizes its data with a Location[] in the client code (e.g. straight from/to a domain object), and it looks like this:

(Alas this code only works with Wicket 1.4 and I never upgraded it to work with current versions.)

P.S. I recently created a nerdy privacy-respecting tool called When Will I Run Out Of Money? It's available for free if you want to check it out.

This article is © Adrian Smith.
It was originally published on 30 Aug 2011
More on: Java | Things I've Released | Wicket