Does your new Wicket app scream for needing a Google Suggest type component? AutoCompleteTextField in the wicket-extensions package is what you need to fill that void!
Simply add this field to your form, give it a model, and override the getChoices method with your own implementation thas passes back an iterator of results.
1
2
3
4
5
6
7
8
9
10
11
12
13
final AutoCompleteTextField field = new AutoCompleteTextField("searchField", mySearchModel) {
@Override
protected Iterator<string> getChoices(String input) {
if (Strings.isEmpty(input)) {
List<string> emptyList = Collections.emptyList();
return emptyList.iterator();
}
List<string> keyMatches = new ArrayList<string>(10);
return myService.searchMatches(keyMatches).iterator();
}
};