[
https://issues.apache.org/jira/browse/WICKET-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Johan Compagner closed WICKET-1328.
-----------------------------------
Resolution: Won't Fix
the AutoCompleetTextField doesnt work like the DropDownChoice with its
ChoiceRenderer maybe we should rewrite (or just write a new one from the start)
But for the AutoCompleetTextField you just have to create a Converter for this,
the problem with a auto compleet is that you dont really have to choose
something out of the list
they are or just can be hints.. So the choicerendere wont really work in this
case.
this is an example:
final AutoCompleteTextField field = new
AutoCompleteTextField("ac", new Model(
Locale.ENGLISH), Locale.class, false)
{
/**
* @see
org.apache.wicket.Component#getConverter(java.lang.Class)
*/
@Override
public IConverter getConverter(Class type)
{
return new IConverter()
{
public String convertToString(Object
value, Locale locale)
{
return value.toString();
}
public Object convertToObject(String
value, Locale locale)
{
return new Locale(value);
}
};
}
@Override
protected Iterator getChoices(String input)
{
if (Strings.isEmpty(input))
{
return
Collections.EMPTY_LIST.iterator();
}
List choices = new ArrayList(10);
Locale[] locales = Locale.getAvailableLocales();
for (int i = 0; i < locales.length; i++)
{
final Locale locale = locales[i];
if
(locale.toString().toUpperCase().startsWith(input.toUpperCase()))
{
choices.add(locale);
if (choices.size() == 10)
{
break;
}
}
}
return choices.iterator();
}
};
> AutoCompleteTextField.getModelObject() needs the means to return an
> underlying collection of POJOs.
> ----------------------------------------------------------------------------------------------------
>
> Key: WICKET-1328
> URL: https://issues.apache.org/jira/browse/WICKET-1328
> Project: Wicket
> Issue Type: New Feature
> Components: wicket-extensions
> Affects Versions: 1.3.0-final
> Environment: Assigning an iterator of POJOs to AutoCompleteTextField
> instead of Strings.
> Reporter: Michael Mehrle
> Priority: Minor
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> When assigning AutoCompleteTextField an iterator of POJOs instead of Strings
> (via the overridden getChoices() method, which returns an Iterator),.
> getModelObject() needs to be able to return POJO instances instead of the
> Strings produced by the custom AutoCompleteTextRenderer.
> This situation arose when I had to feed a list of POJOs into my
> AutoCompleteTextfield - which worked fine after writing a simple subclass of
> AbstractAutoCompleteTextRenderer, which grabbed the POJO's name field for
> screen rendering (the list inside the <div> tag). Problem is that the call to
> getModelObject *seems* to use the text from renderer.getTextValue(), which
> required me to manually match that string to the name fields of the cached
> POJOs. In a preferred scenario getModelObject() would return the object
> references that were fed into getChoices().
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.