AutoCompleteTextField should allow the generics specification for the
getChoices iterator and the type of the model
-------------------------------------------------------------------------------------------------------------------
Key: WICKET-2922
URL: https://issues.apache.org/jira/browse/WICKET-2922
Project: Wicket
Issue Type: Improvement
Components: wicket-extensions
Affects Versions: 1.4.8
Reporter: Scott Hraban
Priority: Minor
Fix For: 1.4.10, 1.5-M1
When using AutoCompleteTextField, and returning POJOs from the getChoices
override, and then rendering the POJO to text value through a
IAutoCompleteRenderer, unless you also provide a Converter to the component, it
is not possible to provide fully types parameters to the constructor.
I.E.:
new AutoCompleteTextField<MyPojo>("compoonentId", new
PropertyModel<String>(this, "myPojoName"), new MyPojoRenderer<MyPojo>())
{
@Override
protected Iterator<MyPojo> getChoices(final String input) {
return getMyPojoChoices();
)
}
This will not compile, as the PropertyModel MUST be of type MyPojo, but unless
you provide a Converter to convert the text choice back to the POJO instance,
the model _cannot_ actually be of any type other than String.
I would like to see AutoCompleteTextField to be changed so that you can type it
like:
AutoCompleteTextField<MyPojo, MyPojo>
AutoCompleteTextField<MyPojo, String>
Depending on whether you are handling the conversion via a
getConverter(Class<?>) override, or outside the AutoCompleteTextField.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.