use of org.apereo.portal.portletpublishing.xml.SingleChoicePreferenceInput in project uPortal by Jasig.
the class PreferenceInputFactory method createSingleChoicePreference.
/**
* Create a single-valued choice preference input.
*
* @param name
* @param label
* @param displayType
* @param options
* @param defaultValue
* @return
*/
public static Preference createSingleChoicePreference(String name, String label, SingleChoiceDisplay displayType, List<Option> options, String defaultValue) {
SingleChoicePreferenceInput input = new SingleChoicePreferenceInput();
input.setDefault(defaultValue);
input.setDisplay(displayType);
input.getOptions().addAll(options);
Preference pref = new Preference();
pref.setName(name);
pref.setLabel(label);
pref.setPreferenceInput(new JAXBElement<SingleChoicePreferenceInput>(new QName("single-choice-parameter-input"), SingleChoicePreferenceInput.class, input));
return pref;
}
Aggregations