Search in sources :

Example 36 with MultipleSelectionElement

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

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

the class CopyEventToCalendarController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    for (MultipleSelectionElement copyEl : copyEls) {
        if (copyEl.isEnabled() && copyEl.isAtLeastSelected(1)) {
            KalendarRenderWrapper calendarWrapper = (KalendarRenderWrapper) copyEl.getUserObject();
            Kalendar cal = calendarWrapper.getKalendar();
            KalendarEvent clonedKalendarEvent = (KalendarEvent) XStreamHelper.xstreamClone(kalendarEvent);
            if (clonedKalendarEvent.getKalendarEventLinks().size() > 0) {
                clonedKalendarEvent.setKalendarEventLinks(new ArrayList<KalendarEventLink>());
            }
            calendarManager.addEventTo(cal, clonedKalendarEvent);
        }
    }
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) Kalendar(org.olat.commons.calendar.model.Kalendar) KalendarEvent(org.olat.commons.calendar.model.KalendarEvent) KalendarEventLink(org.olat.commons.calendar.model.KalendarEventLink) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper)

Example 38 with MultipleSelectionElement

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

the class CopyEventToCalendarController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("cal.copy.title");
    copyEls = new ArrayList<>(calendars.size());
    for (KalendarRenderWrapper calendarWrapper : calendars) {
        String calId = calendarWrapper.getKalendar().getCalendarID();
        String value = calendarWrapper.getDisplayName();
        MultipleSelectionElement copyEl = uifactory.addCheckboxesHorizontal("cal_" + calId, null, formLayout, copy, new String[] { value });
        copyEl.setUserObject(calendarWrapper);
        if (calendarWrapper.getKalendar().getCalendarID().equals(kalendarEvent.getCalendar().getCalendarID())) {
            // this is the calendar, the event comes from
            copyEl.select(copy[0], true);
            copyEl.setEnabled(false);
        } else {
            copyEl.setEnabled(calendarWrapper.getAccess() == KalendarRenderWrapper.ACCESS_READ_WRITE);
        }
    }
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) KalendarRenderWrapper(org.olat.commons.calendar.ui.components.KalendarRenderWrapper)

Example 39 with MultipleSelectionElement

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

the class LicenseAdminConfigController method createActivationCheckBoxes.

private List<MultipleSelectionElement> createActivationCheckBoxes(LicenseType licenseType, List<LicenseHandler> handlers) {
    List<MultipleSelectionElement> formItems = new ArrayList<>();
    for (LicenseHandler handler : handlers) {
        boolean handlerEnabled = licenseModule.isEnabled(handler);
        if (handlerEnabled) {
            String toggleName = "toggle-" + licenseType.getKey() + handler.getType();
            MultipleSelectionElement toggle = uifactory.addCheckboxesHorizontal(toggleName, null, flc, keys, values);
            toggle.setUserObject(new HandlerLicenseType(licenseType, handler));
            toggle.addActionListener(FormEvent.ONCHANGE);
            toggle.setAjaxOnly(true);
            toggle.select(keys[0], licenseService.isActive(handler, licenseType));
            formItems.add(toggle);
        }
    }
    return formItems;
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) LicenseHandler(org.olat.core.commons.services.license.LicenseHandler) ArrayList(java.util.ArrayList)

Example 40 with MultipleSelectionElement

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

the class CheckListAssessmentController method doDisableEditingMode.

private void doDisableEditingMode() {
    table.setEditMode(false);
    List<CheckListAssessmentRow> rows = model.getBackedUpRows();
    for (CheckListAssessmentRow row : rows) {
        MultipleSelectionElement[] checkedEls = row.getCheckedEl();
        if (checkedEls != null) {
            for (MultipleSelectionElement checkEl : checkedEls) {
                flc.remove(checkEl);
            }
        }
        row.setCheckedEl(null);
    }
}
Also used : MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)

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