Search in sources :

Example 1 with SingleSelection

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

the class LicenseAdminConfigController method reloadDefaultLicenseTypeEl.

private void reloadDefaultLicenseTypeEl(LicenseHandler handler) {
    SingleSelection defaultLicenseTypeEl = defaultLicenseTypeEls.get(handler.getType());
    if (defaultLicenseTypeEl != null) {
        List<LicenseType> activatedLicenseTypes = licenseService.loadActiveLicenseTypes(handler);
        Collections.sort(activatedLicenseTypes);
        String[] licenseTypeKeys = getLicenseTypeKeys(activatedLicenseTypes);
        String[] licenseTypeValues = getLicenseTypeValues(activatedLicenseTypes);
        defaultLicenseTypeEl.setKeysAndValues(licenseTypeKeys, licenseTypeValues, null);
        String defaultLicenseTypeKey = licenseModule.getDefaultLicenseTypeKey(handler);
        if (Arrays.asList(licenseTypeKeys).contains(defaultLicenseTypeKey)) {
            defaultLicenseTypeEl.select(defaultLicenseTypeKey, true);
        }
    }
}
Also used : SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) LicenseType(org.olat.core.commons.services.license.LicenseType)

Example 2 with SingleSelection

use of org.olat.core.gui.components.form.flexible.elements.SingleSelection 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 3 with SingleSelection

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

the class FormUIFactory method addDropdownSingleselect.

/**
 * Add a drop down menu (also called pulldown menu).
 * @param id The unique identifier of the selection box (can be null, will be auto generated)
 * @param name
 * @param labelKey i18n key for the label, may be <code>null</code> indicating no label.
 * @param formLayout
 * @param theKeys
 * @param theValues
 * @param theCssClasses
 * @return
 */
public SingleSelection addDropdownSingleselect(final String id, final String name, final String i18nLabel, FormItemContainer formLayout, final String[] theKeys, final String[] theValues, final String[] theCssClasses) {
    SingleSelection ss = new SelectboxSelectionImpl(id, name, formLayout.getTranslator().getLocale());
    ss.setKeysAndValues(theKeys, theValues, theCssClasses);
    setLabelIfNotNull(i18nLabel, ss);
    formLayout.add(ss);
    return ss;
}
Also used : SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) SelectboxSelectionImpl(org.olat.core.gui.components.form.flexible.impl.elements.SelectboxSelectionImpl)

Example 4 with SingleSelection

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

the class SitesConfigurationController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == tableEl) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            if ("up".equals(se.getCommand())) {
                SiteDefRow row = model.getObject(se.getIndex());
                moveUp(row);
                doUpdateOrders();
                tableEl.getComponent().setDirty(true);
            } else if ("down".equals(se.getCommand())) {
                SiteDefRow row = model.getObject(se.getIndex());
                moveDown(row);
                doUpdateOrders();
                tableEl.getComponent().setDirty(true);
            }
        }
    } else if (source instanceof SingleSelection) {
        if (source.getName().startsWith("site.security.") && source.getUserObject() instanceof SiteDefRow) {
            SiteDefRow row = (SiteDefRow) source.getUserObject();
            String selectCallbackId = row.getSecurityCallbackEl().getSelectedKey();
            boolean needAlt = (securityCallbacks.containsKey(selectCallbackId) && securityCallbacks.get(selectCallbackId) instanceof SiteViewSecurityCallback);
            if (row.getAlternativeControllerEl().isVisible() != needAlt) {
                row.getAlternativeControllerEl().setVisible(needAlt);
                tableEl.reset();
            }
        }
        doSaveSettings();
    } else if (source instanceof MultipleSelectionElement || source instanceof SingleSelection) {
        doSaveSettings();
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : SiteViewSecurityCallback(org.olat.core.gui.control.navigation.SiteViewSecurityCallback) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)

Example 5 with SingleSelection

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

the class AbstractPageListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (tableEl == source) {
        if (event instanceof FlexiTableSearchEvent) {
            FlexiTableSearchEvent se = (FlexiTableSearchEvent) event;
            loadModel(ureq, se.getSearch());
        } else if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            if ("up".equals(cmd)) {
                PortfolioElementRow row = model.getObject(se.getIndex());
                if (row.isPendingAssignment()) {
                    doMoveUpAssignment(ureq, row);
                }
            } else if ("down".equals(cmd)) {
                PortfolioElementRow row = model.getObject(se.getIndex());
                if (row.isPendingAssignment()) {
                    doMoveDownAssignment(ureq, row);
                }
            }
        }
    } else if (timelineSwitchOnButton == source) {
        doSwitchTimelineOff();
    } else if (timelineSwitchOffButton == source) {
        doSwitchTimelineOn();
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("open.full".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doOpenRow(ureq, row, false);
        } else if ("comment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doComment(ureq, row.getPage());
        } else if ("close.section".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doConfirmCloseSection(ureq, row);
        } else if ("reopen.section".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doConfirmReopenSection(ureq, row);
        } else if ("edit.assignment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doEditAssignment(ureq, row);
        } else if ("delete.assignment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doConfirmDeleteAssignment(ureq, row);
        } else if ("move.assignment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doMoveAssignment(ureq, row);
        } else if ("start.assignment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doStartAssignment(ureq, row);
        } else if ("open.assignment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doOpenAssignment(ureq, row);
        } else if ("up.assignment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doMoveUpAssignment(ureq, row);
        } else if ("down.assignment".equals(cmd)) {
            PortfolioElementRow row = (PortfolioElementRow) link.getUserObject();
            doMoveDownAssignment(ureq, row);
        }
    } else if (source instanceof SingleSelection) {
        SingleSelection startAssignment = (SingleSelection) source;
        if (startAssignment.isOneSelected()) {
            String selectedKey = startAssignment.getSelectedKey();
            try {
                Long key = Long.parseLong(selectedKey);
                doStartAssignment(ureq, key);
            } catch (Exception e) {
            // 
            }
        }
    } else if (source == flc) {
        if ("ONCLICK".equals(event.getCommand())) {
            String category = ureq.getParameter("tag_select");
            if (StringHelper.containsNonWhitespace(category)) {
                tableEl.quickSearch(ureq, category);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Aggregations

SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)88 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)34 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)26 FormItem (org.olat.core.gui.components.form.flexible.FormItem)18 ArrayList (java.util.ArrayList)14 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)12 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)12 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)12 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)10 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)8 CollectRestriction (org.olat.portfolio.model.restriction.CollectRestriction)8 File (java.io.File)6 Map (java.util.Map)6 FormLinkImpl (org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)6 SliderWrapper (org.olat.modules.forms.ui.model.SliderWrapper)6 UserManager (org.olat.user.UserManager)6 HashMap (java.util.HashMap)4 List (java.util.List)4 EPStructuredMapTemplate (org.olat.portfolio.model.structel.EPStructuredMapTemplate)4