public static class HomePage.CountriesProvider extends TextChoiceProvider<Country>
Country
based choice provider for Select2 components. Demonstrates integration
between Select2 components and a domain object (in this case an enum).Constructor and Description |
---|
HomePage.CountriesProvider() |
Modifier and Type | Method and Description |
---|---|
protected String |
getDisplayText(Country choice) |
protected Object |
getId(Country choice) |
void |
query(String term,
int page,
Response<Country> response)
Queries application for choices that match the search
term and adds them to the
response |
Collection<Country> |
toChoices(Collection<String> ids)
Converts a list of choice ids back into application's choice objects.
|
detach, toJson
protected String getDisplayText(Country choice)
getDisplayText
in class TextChoiceProvider<Country>
protected Object getId(Country choice)
getId
in class TextChoiceProvider<Country>
public void query(String term, int page, Response<Country> response)
ChoiceProvider
term
and adds them to the
response
term
- search termpage
- requested search term results pageresponse
- aggregate for matching choices as well as other response optionspublic Collection<Country> toChoices(Collection<String> ids)
ChoiceProvider
ids
collection will contain
exactly one id, and a collection containing exactly one choice should be returned.ids
- collection containing choice idsCopyright © 2015. All rights reserved.