Search in sources :

Example 1 with MultiChoicePreferenceInput

use of org.apereo.portal.portletpublishing.xml.MultiChoicePreferenceInput in project uPortal by Jasig.

the class PreferenceInputFactory method createMultiChoicePreference.

/**
 * Create a multi-valued choice input preference.
 *
 * @param name
 * @param label
 * @param displayType
 * @param options
 * @param defaultValues
 * @return
 */
public static Preference createMultiChoicePreference(String name, String label, MultiChoiceDisplay displayType, List<Option> options, List<String> defaultValues) {
    MultiChoicePreferenceInput input = new MultiChoicePreferenceInput();
    input.getDefaults().addAll(defaultValues);
    input.setDisplay(displayType);
    input.getOptions().addAll(options);
    Preference pref = new Preference();
    pref.setName(name);
    pref.setLabel(label);
    pref.setPreferenceInput(new JAXBElement<MultiChoicePreferenceInput>(new QName("multi-choice-parameter-input"), MultiChoicePreferenceInput.class, input));
    return pref;
}
Also used : MultiChoicePreferenceInput(org.apereo.portal.portletpublishing.xml.MultiChoicePreferenceInput) Preference(org.apereo.portal.portletpublishing.xml.Preference) QName(javax.xml.namespace.QName)

Aggregations

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