Search in sources :

Example 51 with SingleSelection

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

the class ProjectEditDetailsFormController method initForm.

/**
 * Initialize form.
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // create form elements
    projectTitle = uifactory.addTextElement("title", "detailsform.title.label", 100, project.getTitle(), formLayout);
    // account-Managers
    StringBuilder projectLeaderString = new StringBuilder();
    for (Iterator<Identity> iterator = project.getProjectLeaders().iterator(); iterator.hasNext(); ) {
        Identity identity = iterator.next();
        String last = identity.getUser().getProperty(UserConstants.LASTNAME, getLocale());
        String first = identity.getUser().getProperty(UserConstants.FIRSTNAME, getLocale());
        if (projectLeaderString.length() > 0) {
            projectLeaderString.append(",");
        }
        projectLeaderString.append(first);
        projectLeaderString.append(" ");
        projectLeaderString.append(last);
    }
    projectLeaders = uifactory.addTextElement("projectleaders", "detailsform.projectleaders.label", 100, projectLeaderString.toString(), formLayout);
    projectLeaders.setEnabled(false);
    // add the learning objectives rich text input element
    projectDescription = uifactory.addRichTextElementForStringData("description", "detailsform.description.label", project.getDescription(), 10, -1, false, null, null, formLayout, ureq.getUserSession(), getWindowControl());
    projectDescription.setMaxLength(2500);
    stateLayout = FormLayoutContainer.createHorizontalFormLayout("stateLayout", getTranslator());
    stateLayout.setLabel("detailsform.state.label", null);
    formLayout.add(stateLayout);
    String stateValue = getTranslator().translate(projectBrokerManager.getStateFor(project, ureq.getIdentity(), projectBrokerModuleConfiguration));
    projectState = uifactory.addStaticTextElement("detailsform.state", stateValue + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", stateLayout);
    projectState.setLabel(null, null);
    String keyDetailsformMax = null;
    if (projectBrokerModuleConfiguration.isAcceptSelectionManually()) {
        keyDetailsformMax = "detailsform.max.candidates.label";
    } else {
        keyDetailsformMax = "detailsform.max.members.label";
    }
    selectionMaxMembers = uifactory.addCheckboxesHorizontal(keyDetailsformMax, formLayout, keys, values);
    maxMembers = uifactory.addIntegerElement("form.options.number.of.participants.per.topic_nbr", project.getMaxMembers(), formLayout);
    maxMembers.setMinValueCheck(0, null);
    maxMembers.setDisplaySize(3);
    if (project.getMaxMembers() == Project.MAX_MEMBERS_UNLIMITED) {
        maxMembers.setVisible(false);
        selectionMaxMembers.select(keys[0], false);
    } else {
        selectionMaxMembers.select(keys[0], true);
    }
    selectionMaxMembers.addActionListener(FormEvent.ONCLICK);
    String[] deselectValues = new String[] { translate("detailsform.allow.deselection.hint") };
    allowDeselection = uifactory.addCheckboxesHorizontal("detailsform.allow.deselection", formLayout, keys, deselectValues);
    allowDeselection.select(keys[0], projectGroupManager.isDeselectionAllowed(project));
    allowDeselection.addActionListener(FormEvent.ONCLICK);
    uifactory.addSpacerElement("spacer_1", formLayout, false);
    // customfields
    List<CustomField> customFields = projectBrokerModuleConfiguration.getCustomFields();
    int customFieldIndex = 0;
    for (Iterator<CustomField> iterator = customFields.iterator(); iterator.hasNext(); ) {
        CustomField customField = iterator.next();
        getLogger().debug("customField: " + customField.getName() + "=" + customField.getValue());
        StringTokenizer tok = new StringTokenizer(customField.getValue(), ProjectBrokerManager.CUSTOMFIELD_LIST_DELIMITER);
        if (customField.getValue() == null || customField.getValue().equals("") || !tok.hasMoreTokens()) {
            // no value define => Text-input
            // Add StaticTextElement as workaroung for non translated label
            // null > no label
            uifactory.addStaticTextElement("customField_label" + customFieldIndex, null, customField.getName(), formLayout);
            TextElement textElement = uifactory.addTextElement("customField_" + customFieldIndex, "", 150, project.getCustomFieldValue(customFieldIndex), formLayout);
            textElement.setDisplaySize(60);
            // textElement.setTranslator(null);
            // textElement.setLabel(customField.getName(), null);
            textElement.showLabel(false);
            customfieldElementList.add(textElement);
        } else {
            // values define => dropdown selection
            List<String> valueList = new ArrayList<String>();
            while (tok.hasMoreTokens()) {
                String value = tok.nextToken();
                valueList.add(value);
                getLogger().debug("valueList add: " + value);
            }
            String[] theValues = new String[valueList.size() + 1];
            String[] theKeys = new String[valueList.size() + 1];
            int arrayIndex = 0;
            theValues[arrayIndex] = translate(DROPDOWN_NO_SELECETION);
            theKeys[arrayIndex] = DROPDOWN_NO_SELECETION;
            arrayIndex++;
            for (Iterator<String> iterator2 = valueList.iterator(); iterator2.hasNext(); ) {
                String value = iterator2.next();
                theValues[arrayIndex] = value;
                theKeys[arrayIndex] = Integer.toString(arrayIndex);
                arrayIndex++;
            }
            // Add StaticTextElement as workaround for non translated label
            // null > no label
            uifactory.addStaticTextElement("customField_label" + customFieldIndex, null, customField.getName(), formLayout);
            SingleSelection selectionElement = uifactory.addDropdownSingleselect("customField_" + customFieldIndex, null, formLayout, theKeys, theValues, null);
            if (project.getCustomFieldValue(customFieldIndex) != null && !project.getCustomFieldValue(customFieldIndex).equals("")) {
                if (valueList.contains(project.getCustomFieldValue(customFieldIndex))) {
                    // '+1' because no-selection at the beginning
                    String key = Integer.toString(valueList.indexOf(project.getCustomFieldValue(customFieldIndex)) + 1);
                    selectionElement.select(key, true);
                } else {
                    this.showInfo("warn.customfield.key.does.not.exist", project.getCustomFieldValue(customFieldIndex));
                }
            }
            customfieldElementList.add(selectionElement);
        }
        uifactory.addSpacerElement("customField_spacer" + customFieldIndex, formLayout, false);
        customFieldIndex++;
    }
    // Events
    for (Project.EventType eventType : Project.EventType.values()) {
        if (projectBrokerModuleConfiguration.isProjectEventEnabled(eventType)) {
            ProjectEvent projectEvent = project.getProjectEvent(eventType);
            DateChooser dateChooserStart = uifactory.addDateChooser(eventType + "start", eventType.getI18nKey() + ".start.label", null, formLayout);
            dateChooserStart.setDateChooserTimeEnabled(true);
            dateChooserStart.setDisplaySize(CUSTOM_DATE_FORMAT.length());
            getLogger().info("Event=" + eventType + ", startDate=" + projectEvent.getStartDate());
            dateChooserStart.setDate(projectEvent.getStartDate());
            eventStartElementList.put(eventType, dateChooserStart);
            DateChooser dateChooserEnd = uifactory.addDateChooser(eventType + "end", eventType.getI18nKey() + ".end.label", null, formLayout);
            dateChooserEnd.setDateChooserTimeEnabled(true);
            dateChooserEnd.setDisplaySize(CUSTOM_DATE_FORMAT.length());
            getLogger().debug("Event=" + eventType + ", endDate=" + projectEvent.getEndDate());
            dateChooserEnd.setDate(projectEvent.getEndDate());
            eventEndElementList.put(eventType, dateChooserEnd);
            uifactory.addSpacerElement(eventType + "spacer", formLayout, false);
        }
    }
    attachmentFileName = uifactory.addFileElement(getWindowControl(), "detailsform.attachmentfilename.label", formLayout);
    attachmentFileName.setLabel("detailsform.attachmentfilename.label", null);
    if (project.getAttachmentFileName() != null && !project.getAttachmentFileName().equals("")) {
        attachmentFileName.setInitialFile(new File(project.getAttachmentFileName()));
        removeAttachmentLink = uifactory.addFormLink("detailsform.remove.attachment", formLayout, Link.BUTTON_XSMALL);
    }
    attachmentFileName.addActionListener(FormEvent.ONCHANGE);
    mailNotification = uifactory.addCheckboxesHorizontal("detailsform.mail.notification.label", formLayout, keys, values);
    mailNotification.select(keys[0], project.isMailNotificationEnabled());
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    uifactory.addFormSubmitButton("save", buttonGroupLayout);
    if (this.enableCancel) {
        // TODO: Frage an PB: Warum flc hier noetig ???
        uifactory.addFormCancelButton("cancel", buttonGroupLayout, ureq, getWindowControl());
    }
}
Also used : SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) Project(org.olat.course.nodes.projectbroker.datamodel.Project) StringTokenizer(java.util.StringTokenizer) RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) CustomField(org.olat.course.nodes.projectbroker.datamodel.CustomField) DateChooser(org.olat.core.gui.components.form.flexible.elements.DateChooser) Identity(org.olat.core.id.Identity) File(java.io.File) ProjectEvent(org.olat.course.nodes.projectbroker.datamodel.ProjectEvent)

Example 52 with SingleSelection

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

the class EvaluationFormController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (saveAsDoneButton == source) {
        doConfirmDone(ureq);
    } else if (source instanceof SingleSelection) {
        SingleSelection radioEl = (SingleSelection) source;
        Object uobject = radioEl.getUserObject();
        if (uobject instanceof SliderWrapper) {
            String selectedKey = radioEl.getSelectedKey();
            SliderWrapper sliderWrapper = (SliderWrapper) uobject;
            saveNumericalResponse(new BigDecimal(selectedKey), selectedKey, sliderWrapper.getId());
        }
    } else if (source instanceof SliderElement) {
        SliderElement slider = (SliderElement) source;
        Object uobject = slider.getUserObject();
        if (uobject instanceof SliderWrapper) {
            double value = slider.getValue();
            SliderWrapper sliderWrapper = (SliderWrapper) uobject;
            saveNumericalResponse(BigDecimal.valueOf(value), Double.toString(value), sliderWrapper.getId());
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        Object uobject = link.getUserObject();
        if (uobject instanceof TextInputWrapper) {
            TextInputWrapper wrapper = (TextInputWrapper) uobject;
            String value = wrapper.getTextEl().getValue();
            saveNumericalResponse(null, value, wrapper.getId());
        }
    } else if (source instanceof FileElement) {
        FileElement fileElement = (FileElement) source;
        Object uobject = fileElement.getUserObject();
        if (uobject instanceof FileUploadWrapper) {
            FileUploadWrapper wrapper = (FileUploadWrapper) uobject;
            if (event instanceof FileElementEvent) {
                if (FileElementEvent.DELETE.equals(event.getCommand())) {
                    saveFileResponse(null, null, wrapper.getId());
                    fileElement.setInitialFile(null);
                    if (fileElement.getUploadFile() != null) {
                        fileElement.reset();
                    }
                    flc.setDirty(true);
                }
            } else if (fileElement.isUploadSuccess()) {
                File file = fileElement.getUploadFile();
                String filename = fileElement.getUploadFileName();
                saveFileResponse(file, filename, wrapper.getId());
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : TextInputWrapper(org.olat.modules.forms.ui.model.TextInputWrapper) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) FileUploadWrapper(org.olat.modules.forms.ui.model.FileUploadWrapper) FileElementEvent(org.olat.core.gui.components.form.flexible.impl.elements.FileElementEvent) BigDecimal(java.math.BigDecimal) SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) SliderElement(org.olat.core.gui.components.form.flexible.elements.SliderElement) FileElement(org.olat.core.gui.components.form.flexible.elements.FileElement) File(java.io.File)

Example 53 with SingleSelection

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

the class EvaluationFormController method forgeDiscreteRadioButtons.

private SliderWrapper forgeDiscreteRadioButtons(Slider slider, Rubric element, EvaluationFormResponse response) {
    int start = element.getStart();
    int end = element.getEnd();
    int steps = element.getSteps();
    double[] theSteps = new double[steps];
    String[] theKeys = new String[steps];
    String[] theValues = new String[steps];
    double step = (end - start + 1) / (double) steps;
    for (int i = 0; i < steps; i++) {
        theSteps[i] = start + (i * step);
        theKeys[i] = Double.toString(theSteps[i]);
        theValues[i] = "";
    }
    SingleSelection radioEl = uifactory.addRadiosVertical("slider_" + (count++), null, flc, theKeys, theValues);
    radioEl.setDomReplacementWrapperRequired(false);
    radioEl.addActionListener(FormEvent.ONCHANGE);
    radioEl.setEnabled(!readOnly);
    radioEl.setAllowNoSelection(true);
    int widthInPercent = EvaluationFormElementWrapper.getWidthInPercent(element);
    radioEl.setWidthInPercent(widthInPercent, true);
    if (response != null && response.getNumericalResponse() != null) {
        double val = response.getNumericalResponse().doubleValue();
        double error = step / 10.0d;
        for (int i = 0; i < theSteps.length; i++) {
            double theStep = theSteps[i];
            double margin = Math.abs(theStep - val);
            if (margin < error) {
                radioEl.select(theKeys[i], true);
            }
        }
    }
    SliderWrapper sliderWrapper = new SliderWrapper(slider, radioEl);
    radioEl.setUserObject(sliderWrapper);
    return sliderWrapper;
}
Also used : SliderWrapper(org.olat.modules.forms.ui.model.SliderWrapper) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection)

Example 54 with SingleSelection

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

the class AbstractPageListController method forgeSectionRow.

protected PortfolioElementRow forgeSectionRow(Section section, AssessmentSection assessmentSection, List<Assignment> assignments, Map<OLATResourceable, List<Category>> categorizedElementMap) {
    PortfolioElementRow row = new PortfolioElementRow(section, assessmentSection, config.isAssessable(), (assignments != null && assignments.size() > 0));
    String openLinkId = "open_" + (++counter);
    FormLink openLink = uifactory.addFormLink(openLinkId, "open.full", "open.full.page", null, flc, Link.BUTTON_SMALL);
    openLink.setIconRightCSS("o_icon o_icon_start");
    openLink.setPrimary(true);
    row.setOpenFormLink(openLink);
    openLink.setUserObject(row);
    addCategoriesToRow(row, categorizedElementMap);
    if (assignments != null && secCallback.canViewPendingAssignments(section) && secCallback.canInstantiateAssignment()) {
        List<Assignment> startableAssignments = assignments.stream().filter(ass -> ass.getAssignmentStatus() == AssignmentStatus.notStarted).filter(ass -> ass.getPage() == null).collect(Collectors.toList());
        if (!startableAssignments.isEmpty()) {
            String[] keys = new String[startableAssignments.size() + 1];
            String[] values = new String[startableAssignments.size() + 1];
            keys[0] = "start.assignment.hint";
            values[0] = translate("start.assignment.hint");
            int count = 1;
            for (Assignment assignment : startableAssignments) {
                keys[count] = Long.toString(assignment.getKey());
                values[count] = assignment.getTitle();
                count++;
            }
            SingleSelection startEl = uifactory.addDropdownSingleselect("assignments_" + (++counter), "", flc, keys, values, null);
            startEl.setDomReplacementWrapperRequired(false);
            startEl.addActionListener(FormEvent.ONCHANGE);
            row.setStartSelection(startEl);
        }
    }
    return row;
}
Also used : PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) Assignment(org.olat.modules.portfolio.Assignment) FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) PortfolioV2Module(org.olat.modules.portfolio.PortfolioV2Module) TimelineElement(org.olat.modules.portfolio.ui.component.TimelineElement) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) ThreadLocalUserActivityLogger(org.olat.core.logging.activity.ThreadLocalUserActivityLogger) PageRemovedEvent(org.olat.modules.portfolio.ui.event.PageRemovedEvent) MediaResource(org.olat.core.gui.media.MediaResource) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) OLATResourceable(org.olat.core.id.OLATResourceable) StatusCellRenderer(org.olat.modules.portfolio.ui.renderer.StatusCellRenderer) BinderConfiguration(org.olat.modules.portfolio.BinderConfiguration) Category(org.olat.modules.portfolio.Category) OresHelper(org.olat.core.util.resource.OresHelper) Assignment(org.olat.modules.portfolio.Assignment) Map(java.util.Map) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) SectionStatus(org.olat.modules.portfolio.SectionStatus) AssignmentStatus(org.olat.modules.portfolio.AssignmentStatus) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) Page(org.olat.modules.portfolio.Page) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) DialogBoxController(org.olat.core.gui.control.generic.modal.DialogBoxController) PortfolioLoggingAction(org.olat.modules.portfolio.PortfolioLoggingAction) WindowControl(org.olat.core.gui.control.WindowControl) FlexiTableRendererType(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableRendererType) Set(java.util.Set) AssignmentType(org.olat.modules.portfolio.AssignmentType) Component(org.olat.core.gui.components.Component) Collectors(java.util.stream.Collectors) Mapper(org.olat.core.dispatcher.mapper.Mapper) DefaultFlexiTableCssDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableCssDelegate) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) PortfolioElementCellRenderer(org.olat.modules.portfolio.ui.renderer.PortfolioElementCellRenderer) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) UserCommentsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsController) TooledController(org.olat.core.gui.components.stack.TooledController) LoggingResourceable(org.olat.util.logging.activity.LoggingResourceable) ImageComponent(org.olat.core.gui.components.image.ImageComponent) SharedPageStatusCellRenderer(org.olat.modules.portfolio.ui.renderer.SharedPageStatusCellRenderer) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) FileMediaResource(org.olat.core.gui.media.FileMediaResource) Section(org.olat.modules.portfolio.Section) CategoriesCellRenderer(org.olat.modules.portfolio.ui.component.CategoriesCellRenderer) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) PortfolioElementRow(org.olat.modules.portfolio.ui.model.PortfolioElementRow) FormItem(org.olat.core.gui.components.form.flexible.FormItem) ArrayList(java.util.ArrayList) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) PageDeletedEvent(org.olat.modules.portfolio.ui.event.PageDeletedEvent) ReadOnlyCommentsSecurityCallback(org.olat.modules.portfolio.ui.model.ReadOnlyCommentsSecurityCallback) HttpServletRequest(javax.servlet.http.HttpServletRequest) Calendar(java.util.Calendar) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) ContextEntry(org.olat.core.id.context.ContextEntry) StringHelper(org.olat.core.util.StringHelper) StateEntry(org.olat.core.id.context.StateEntry) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) PageCols(org.olat.modules.portfolio.ui.PageListDataModel.PageCols) PortfolioService(org.olat.modules.portfolio.PortfolioService) Link(org.olat.core.gui.components.link.Link) FlexiTableComponentDelegate(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponentDelegate) FlexiTableSearchEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent) Controller(org.olat.core.gui.control.Controller) File(java.io.File) NotFoundMediaResource(org.olat.core.gui.media.NotFoundMediaResource) PageImageAlign(org.olat.modules.portfolio.PageImageAlign) DialogBoxUIFactory(org.olat.core.gui.control.generic.modal.DialogBoxUIFactory) UserRequest(org.olat.core.gui.UserRequest) PageStatus(org.olat.modules.portfolio.PageStatus) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 55 with SingleSelection

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

the class LicenseAdminConfigController method initHandlerConfigs.

private void initHandlerConfigs() {
    List<FormLayoutContainer> handlerConfigs = new ArrayList<>(licenseHandlers.size());
    for (LicenseHandler handler : licenseHandlers) {
        boolean handlerEnabled = licenseModule.isEnabled(handler);
        if (handlerEnabled) {
            String handlerType = handler.getType();
            FormLayoutContainer handlerCont = FormLayoutContainer.createDefaultFormLayout("handler-" + handlerType, getTranslator());
            handlerCont.setRootForm(mainForm);
            flc.add("handler-" + handlerType, handlerCont);
            uifactory.addSpacerElement("spacer-" + handlerType, handlerCont, false);
            SpacerElement handlerName = uifactory.addSpacerElement("name-" + handlerType, handlerCont, true);
            handlerName.setLabel(handler.getTitle(getLocale()), null, false);
            SingleSelection defaultLicenseTypeEl = uifactory.addDropdownSingleselect(DEFAULT_LICENSE_TYPE_PREFIX + handlerType, "admin.default.license.type", handlerCont, new String[0], new String[0], null);
            defaultLicenseTypeEl.setUserObject(handler);
            defaultLicenseTypeEl.addActionListener(FormEvent.ONCHANGE);
            defaultLicenseTypeEls.put(handlerType, defaultLicenseTypeEl);
            reloadDefaultLicenseTypeEl(handler);
            String[] licensorCreatorKeys = licensorCreators.stream().map(LicensorCreator::getType).toArray(String[]::new);
            String[] licensorCreatorValues = licensorCreators.stream().map(creator -> creator.getName(getLocale())).toArray(String[]::new);
            SingleSelection licensorCreatorEl = uifactory.addDropdownSingleselect(LICENSOR_CREATOR_TYPE_PREFIX + handlerType, "admin.licensor.creator", handlerCont, licensorCreatorKeys, licensorCreatorValues, null);
            licensorCreatorEl.setUserObject(handler);
            String creatorType = licenseModule.getLicensorCreatorType(handler);
            if (creatorType != null) {
                licensorCreatorEl.select(creatorType, true);
            }
            licensorCreatorEl.addActionListener(FormEvent.ONCHANGE);
            if (CONSTANT_CREATOR_TYPE.equals(creatorType)) {
                String licensorConstant = licenseModule.getConstantLicensor(handler);
                uifactory.addStaticTextElement("lgc-" + handlerType, "admin.licensor.constant", licensorConstant, handlerCont);
                FormLink editLicensorConstantLink = uifactory.addFormLink("lgb-", "admin.licensor.constant.edit", "", handlerCont, Link.BUTTON);
                editLicensorConstantLink.setUserObject(handler);
            }
            handlerConfigs.add(handlerCont);
        }
    }
    flc.getFormItemComponent().contextPut("handlerConfigs", handlerConfigs);
}
Also used : FlexiTableElement(org.olat.core.gui.components.form.flexible.elements.FlexiTableElement) Arrays(java.util.Arrays) LicenseModule(org.olat.core.commons.services.license.LicenseModule) LicenseService(org.olat.core.commons.services.license.LicenseService) FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) BooleanCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.BooleanCellRenderer) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormItem(org.olat.core.gui.components.form.flexible.FormItem) MultipleSelectionElement(org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement) ArrayList(java.util.ArrayList) StaticFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) SingleKeyTranslatorController(org.olat.core.util.i18n.ui.SingleKeyTranslatorController) Map(java.util.Map) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) FlexiTableDataModelFactory(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory) CONSTANT_CREATOR_TYPE(org.olat.core.commons.services.license.manager.LicensorConstantCreator.CONSTANT_CREATOR_TYPE) LicenseTypeCols(org.olat.core.commons.services.license.ui.LicenseTypeDataModel.LicenseTypeCols) TextFlexiCellRenderer(org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer) Link(org.olat.core.gui.components.link.Link) WindowControl(org.olat.core.gui.control.WindowControl) Collection(java.util.Collection) Controller(org.olat.core.gui.control.Controller) SpacerElement(org.olat.core.gui.components.form.flexible.elements.SpacerElement) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) List(java.util.List) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink) LicenseHandler(org.olat.core.commons.services.license.LicenseHandler) LicensorCreator(org.olat.core.commons.services.license.manager.LicensorCreator) UserRequest(org.olat.core.gui.UserRequest) LicenseType(org.olat.core.commons.services.license.LicenseType) Collections(java.util.Collections) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) LicenseHandler(org.olat.core.commons.services.license.LicenseHandler) SpacerElement(org.olat.core.gui.components.form.flexible.elements.SpacerElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) ArrayList(java.util.ArrayList) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) 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