THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
//a list of User objects final List<User> connections = getConnectionsForUser(userId); //renderer - required when not using simple strings AbstractAutoCompleteRenderer autoCompleteRenderer = new AbstractAutoCompleteRenderer() { protected final String getTextValue(final Object object) { User user = (User) object; return user.getDisplayName(); } protected final void renderChoice(final Object object, final Response response, final String criteria) { response.write(getTextValue(object)); } }; // textfield AbstractAutoCompleteTextField<User> toField = new AbstractAutoCompleteTextField<User>("toField", new PropertyModel(message, "to"), autoCompleteRenderer) { protected final List<User> getChoiceList(final String input) { return getConnectionsSubsetForSearch(connections, input); } protected final String getChoiceValue(final User choice) throws Throwable { return choice.IdgetId(); } }; form.add(toField); |
...