T
- type of choice objectpublic abstract class TextChoiceProvider<T> extends Object implements ChoiceProvider<T>
Constructor and Description |
---|
TextChoiceProvider() |
Modifier and Type | Method and Description |
---|---|
void |
detach() |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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 interface ChoiceProvider<T>
choice
- choice to convertwriter
- Json writer that should be used to covnert the choiceorg.apache.wicket.ajax.json.JSONException
public void detach()
detach
in interface org.apache.wicket.model.IDetachable
Copyright © 2015. All rights reserved.