Search in sources :

Example 31 with MultipleSelectionElement

use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.

the class LicenseAdminConfigController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (enabledEl == source) {
        doEnableHandlers();
    } else if (addLicenseTypeButton == source) {
        doAddLicenseType(ureq);
    } else if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            LicenseTypeRow licenseTypeRow = dataModel.getObject(se.getIndex());
            if (CMD_UP.equals(cmd)) {
                doUp(se.getIndex());
            } else if (CMD_DOWN.equals(cmd)) {
                doDown(se.getIndex());
            } else if (CMD_TRANSLATE.equals(cmd)) {
                doOpenTranslator(ureq, licenseTypeRow.getLicenseType());
            } else if (CMD_EDIT.equals(cmd)) {
                doEditLicenseType(ureq, licenseTypeRow.getLicenseType());
            }
        }
    } else if (source instanceof MultipleSelectionElement) {
        MultipleSelectionElement multipleSelectionElement = (MultipleSelectionElement) source;
        doActivateLicenseType(multipleSelectionElement);
    } else if (source instanceof SingleSelection) {
        SingleSelection singleSelection = (SingleSelection) source;
        String name = singleSelection.getName();
        if (name.startsWith(DEFAULT_LICENSE_TYPE_PREFIX)) {
            doSetDefaultLicenceType(source, singleSelection);
        } else if (name.startsWith(LICENSOR_CREATOR_TYPE_PREFIX)) {
            doSetLicensorCreator(source, singleSelection);
        }
    } else if (source instanceof FormLink) {
        Object userObject = source.getUserObject();
        if (userObject instanceof LicenseHandler) {
            LicenseHandler handler = (LicenseHandler) userObject;
            doEditLicensorConstant(ureq, handler);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) LicenseHandler(org.olat.core.commons.services.license.LicenseHandler) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 32 with MultipleSelectionElement

use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.

the class FormUIFactory method addCheckboxesVertical.

/**
 * Create a multiple selection element with check-boxes that is rendered in vertical columns
 * @param name
 * @param i18nLabel
 * @param formLayout
 * @param keys
 * @param values
 * @param cssClasses
 * @param columns
 * @return
 */
public MultipleSelectionElement addCheckboxesVertical(String name, String i18nLabel, FormItemContainer formLayout, String[] keys, String[] values, String[] cssClasses, String[] iconLeftCSS, int columns) {
    MultipleSelectionElement mse = new MultipleSelectionElementImpl(name, Layout.vertical, columns);
    mse.setKeysAndValues(keys, values, cssClasses, iconLeftCSS);
    setLabelIfNotNull(i18nLabel, mse);
    formLayout.add(mse);
    return mse;
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) MultipleSelectionElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.MultipleSelectionElementImpl)

Example 33 with MultipleSelectionElement

use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.

the class FormUIFactory method addCheckboxesDropdown.

public MultipleSelectionElement addCheckboxesDropdown(String name, String i18nLabel, FormItemContainer formLayout, String[] keys, String[] values, String[] cssClasses, String[] iconLeftCSS) {
    MultipleSelectionElement mse = new MultipleSelectionElementImpl(name, Layout.dropdown);
    mse.setKeysAndValues(keys, values, cssClasses, iconLeftCSS);
    setLabelIfNotNull(i18nLabel, mse);
    formLayout.add(mse);
    return mse;
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) MultipleSelectionElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.MultipleSelectionElementImpl)

Example 34 with MultipleSelectionElement

use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.

the class MultiSelectionTriggerdDependencyRule method doesTrigger.

/**
 * @see org.olat.core.gui.components.form.flexible.rules.FormItemDependencyRuleImpl#doesTrigger()
 */
@Override
protected boolean doesTrigger() {
    MultipleSelectionElement mse = (MultipleSelectionElement) triggerElement;
    Collection<String> selectedKeys = mse.getSelectedKeys();
    boolean retval = false;
    if (triggerVal == null) {
        // meaning no selection in a multi selection element
        retval = selectedKeys.isEmpty();
    } else {
        // check that value is in selection
        retval = selectedKeys.contains(triggerVal);
    }
    return retval;
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)

Example 35 with MultipleSelectionElement

use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project OpenOLAT by OpenOLAT.

the class CoreFunctionsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // server informations
    FormLayoutContainer serverCont = FormLayoutContainer.createDefaultFormLayout("functions", getTranslator());
    formLayout.add(serverCont);
    formLayout.add("functions", serverCont);
    MultipleSelectionElement clusterEl = uifactory.addCheckboxesHorizontal("webdav", "core.webdav", serverCont, new String[] { "xx" }, new String[] { "" });
    clusterEl.setEnabled(false);
    clusterEl.select("xx", CoreSpringFactory.getImpl(WebDAVModule.class).isEnabled());
    MultipleSelectionElement jsMathEl = uifactory.addCheckboxesHorizontal("jsmath", "core.jsMath", serverCont, new String[] { "xx" }, new String[] { "" });
    jsMathEl.setEnabled(false);
    jsMathEl.select("xx", Boolean.TRUE);
    MultipleSelectionElement restEl = uifactory.addCheckboxesHorizontal("restapi", "core.restapi", serverCont, new String[] { "xx" }, new String[] { "" });
    restEl.setEnabled(false);
    RestModule restModule = CoreSpringFactory.getImpl(RestModule.class);
    restEl.select("xx", restModule.isEnabled());
}
Also used : RestModule(org.olat.restapi.RestModule) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Aggregations

MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)136 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)22 ArrayList (java.util.ArrayList)20 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)16 MultipleSelectionElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.MultipleSelectionElementImpl)16 HashMap (java.util.HashMap)12 HashSet (java.util.HashSet)12 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)12 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)10 FormItem (org.olat.core.gui.components.form.flexible.FormItem)8 Identity (org.olat.core.id.Identity)8 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)8 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)6 ICourse (org.olat.course.ICourse)6 Checkbox (org.olat.course.nodes.cl.model.Checkbox)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)5 VFSItem (org.olat.core.util.vfs.VFSItem)5 Section (org.olat.modules.portfolio.Section)5 File (java.io.File)4 UserShortDescription (org.olat.admin.user.UserShortDescription)4