You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Scott Hraban (JIRA)" <ji...@apache.org> on 2010/06/22 20:19:57 UTC

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

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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2922:
----------------------------------

    Fix Version/s: 1.4.11
                       (was: 1.4.10)

> 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.11, 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2922:
----------------------------------

    Fix Version/s: 1.4.12

> 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-M2.1
>
>
> 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2922:
----------------------------------

    Fix Version/s: 1.5-M3
                       (was: 1.5-M2)

> 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.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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2922:
----------------------------------

    Fix Version/s: 1.5-M2
                       (was: 1.5-M1)

> 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.11, 1.5-M2
>
>
> 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.


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

Posted by "Dr. Erich W. Schreiner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893970#action_12893970 ] 

Dr. Erich W. Schreiner commented on WICKET-2922:
------------------------------------------------

IMHO, changing the generics parameters on AutoCompleteTextField would break the interface and therefore only be possible for 1.5

Suggestion: create another class AutoCompleteTextFieldWithCustomRenderer<T,R> (extending TextField<T>) that allows to specify an IModel<T> (including a PropertyModel<String> as above) and to use a custom renderer / rendering model. This class would specify an abstract method getChoices(String input) that needs to return an Iterator<R>.

A subsequent and more risky change would be to refactor AutoCompleteTextField to extend this new class. Otherwise, lots of duplication (mostly the overloaded constructors) will arise. Since the refactored AutoCompleteTextField would still need all the constructors (then re-routed to call super()) this will not reduce but bloat the code...

> 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2922:
----------------------------------

    Fix Version/s: 1.5-M2.1
                       (was: 1.4.12)
                       (was: 1.5-M3)

> 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.5-M2.1
>
>
> 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2922:
----------------------------------

    Fix Version/s: 1.4.12
                       (was: 1.4.11)

> 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.12, 1.5-M2
>
>
> 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.