Search in sources :

Example 1 with SingleChoicePreferenceInput

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;
}
Also used : Preference(org.apereo.portal.portletpublishing.xml.Preference) SingleChoicePreferenceInput(org.apereo.portal.portletpublishing.xml.SingleChoicePreferenceInput) QName(javax.xml.namespace.QName)

Aggregations

QName (javax.xml.namespace.QName)1 Preference (org.apereo.portal.portletpublishing.xml.Preference)1 SingleChoicePreferenceInput (org.apereo.portal.portletpublishing.xml.SingleChoicePreferenceInput)1