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.
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(); } }; |
