private String[] tokenSeparators;
private Boolean dropdownAutoWidth;
public CharSequence toJson() {
try {
JSONStringer writer = new JSONStringer();
writer.object();
Json.writeObject(writer, "minimumInputLength", minimumInputLength);
Json.writeObject(writer, "minimumResultsForSearch", minimumResultsForSearch);
Json.writeObject(writer, "maximumSelectionSize", maximumSelectionSize);
Json.writeObject(writer, "placeholder", placeholder);
Json.writeObject(writer, "allowClear", allowClear);
Json.writeObject(writer, "multiple", multiple);
Json.writeObject(writer, "closeOnSelect", closeOnSelect);
Json.writeFunction(writer, "id", id);
Json.writeFunction(writer, "matcher", matcher);
Json.writeFunction(writer, "tokenizer", tokenizer);
Json.writeFunction(writer, "sortResults", sortResults);
Json.writeFunction(writer, "formatSelection", formatSelection);
Json.writeFunction(writer, "formatResult", formatResult);
Json.writeFunction(writer, "formatNoMatches", formatNoMatches);
Json.writeFunction(writer, "formatInputTooShort", formatInputTooShort);
Json.writeFunction(writer, "formatResultCssClass", formatResultCssClass);
Json.writeFunction(writer, "formatSelectionTooBig", formatSelectionTooBig);
Json.writeFunction(writer, "formatLoadMore", formatLoadMore);
Json.writeFunction(writer, "formatSearching", formatSearching);
Json.writeFunction(writer, "escapeMarkup", escapeMarkup);
Json.writeFunction(writer, "createSearchChoice", createSearchChoice);
Json.writeFunction(writer, "initSelection", initSelection);
Json.writeFunction(writer, "query", query);
Json.writeObject(writer, "width", width);
Json.writeObject(writer, "openOnEnter", openOnEnter);
Json.writeFunction(writer, "containerCss", containerCss);
Json.writeObject(writer, "containerCssClass", containerCssClass);
Json.writeFunction(writer, "dropdownCss", dropdownCss);
Json.writeObject(writer, "dropdownCssClass", dropdownCssClass);
Json.writeObject(writer, "separator", separator);
Json.writeObject(writer, "tokenSeparators", tokenSeparators);
Json.writeObject(writer, "dropdownAutoWidth", dropdownAutoWidth);
if (ajax != null) {
writer.key("ajax");
ajax.toJson(writer);
}
Json.writeFunction(writer, "data", data);
Json.writeFunction(writer, "tags", tags);
writer.endObject();
return writer.toString();
} catch (JSONException e) {
throw new RuntimeException("Could not convert Select2 settings object to Json", e);
}
}