T
- type of choice objectpublic abstract class TextChoiceProvider<T> extends ChoiceProvider<T>
Constructor and Description |
---|
TextChoiceProvider() |
Modifier and Type | Method and Description |
---|---|
protected abstract String |
getDisplayText(T choice) |
protected abstract Object |
getId(T choice) |
void |
toJson(T choice,
org.apache.wicket.ajax.json.JSONWriter writer)
Converts the specified choice to Json.
|
detach, query, toChoices
public final void toJson(T choice, org.apache.wicket.ajax.json.JSONWriter writer) throws org.apache.wicket.ajax.json.JSONException
ChoiceProvider
At the very least each choice should contain an id
attribute. If no custom rendering function is
specified, the text
attribute should also be provided
Example: If mapping a User {Long id, String name} using default rendering the code should look like this:
toJson(User choice, JSONWriter writer) { writer.key("id").value(choice.getId()).key("text").value(choice.getName()); }
toJson
in class ChoiceProvider<T>
choice
- choice to convertwriter
- Json writer that should be used to covnert the choiceorg.apache.wicket.ajax.json.JSONException
Copyright © 2015. All rights reserved.