You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2010/09/11 19:34:33 UTC

[jira] Resolved: (WICKET-2922) AutoCompleteTextField should allow the generics specification for the getChoices iterator and the type of the model

     [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2922.
-----------------------------------

      Assignee: Igor Vaynberg
    Resolution: Won't Fix

autocomplete is not meant to pick out an object from a list, only to submit a string. what does your converter do if the user enters a value that cannot be converted back to one of your objects?

for such usecases see the objectautocomplete component in wicketstuff

> 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
>            Assignee: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.4.12, 1.5-M3
>
>
> 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.