Search in sources :

Example 76 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class GTARevisionAndCorrectionEditController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    // configuration
    FormLayoutContainer configCont = FormLayoutContainer.createDefaultFormLayout("config", getTranslator());
    configCont.setRootForm(mainForm);
    configCont.setFormTitle(translate("editor.revisions.title"));
    configCont.setFormContextHelp("Assessment#_task_abgabe");
    formLayout.add(configCont);
    maxNumberOfDocsEl = uifactory.addTextElement("max.documents", "max.documents", 5, "", configCont);
    updateDefaultMaximumNumberOfDocuments();
    // save
    FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    buttonsCont.setRootForm(mainForm);
    configCont.add(buttonsCont);
    uifactory.addFormSubmitButton("save", buttonsCont);
    uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 77 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class NewDocumentController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_course_gta_new_doc_form");
    filenameEl = uifactory.addTextElement("fileName", "file.name", -1, "", formLayout);
    filenameEl.setElementCssClass("o_sel_course_gta_doc_filename");
    filenameEl.setExampleKey("file.name.example", null);
    filenameEl.setDisplaySize(20);
    filenameEl.setMandatory(true);
    FormLayoutContainer formButtons = FormLayoutContainer.createButtonLayout("formButton", getTranslator());
    formLayout.add(formButtons);
    uifactory.addFormSubmitButton("submit", "create", formButtons);
    uifactory.addFormCancelButton("cancel", formButtons, ureq, getWindowControl());
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 78 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class PFFileUploadController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    uploadFileEl = uifactory.addFileElement(getWindowControl(), "upload", "textfield.upload", formLayout);
    uploadFileEl.addActionListener(FormEvent.ONCHANGE);
    typeEl = uifactory.addStaticTextElement("video.mime.type", "video.mime.type", "", formLayout);
    typeEl.setVisible(false);
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonGroupLayout);
    uifactory.addFormSubmitButton("submit", "upload.link", buttonGroupLayout);
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 79 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class FIBNumericalEntrySettingsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_gap_numeric_form");
    Double solution = interaction.getSolution();
    String solString = solution == null ? "" : solution.toString();
    solutionEl = uifactory.addTextElement("fib.solution", "fib.solution", 256, solString, formLayout);
    solutionEl.setElementCssClass("o_sel_gap_numeric_solution");
    solutionEl.setEnabled(!restrictedEdit && !readOnly);
    if (!restrictedEdit && !readOnly && !StringHelper.containsNonWhitespace(solString)) {
        solutionEl.setFocus(true);
    }
    String placeholder = interaction.getPlaceholder();
    placeholderEl = uifactory.addTextElement("fib.placeholder", "fib.placeholder", 256, placeholder, formLayout);
    placeholderEl.setElementCssClass("o_sel_gap_numeric_placeholder");
    placeholderEl.setEnabled(!restrictedEdit && !readOnly);
    Integer expectedLength = interaction.getExpectedLength();
    String expectedLengthStr = expectedLength == null ? null : expectedLength.toString();
    expectedLengthEl = uifactory.addTextElement("fib.expectedLength", "fib.expectedLength", 256, expectedLengthStr, formLayout);
    expectedLengthEl.setEnabled(!restrictedEdit && !readOnly);
    String[] toleranceModeValues = new String[] { translate("fib.tolerance.mode.exact"), translate("fib.tolerance.mode.absolute"), translate("fib.tolerance.mode.relative") };
    toleranceModeEl = uifactory.addDropdownSingleselect("fib.tolerance.mode", "fib.tolerance.mode", formLayout, toleranceModeKeys, toleranceModeValues, null);
    toleranceModeEl.setEnabled(!restrictedEdit && !readOnly);
    toleranceModeEl.setHelpText(getToleranceHelp());
    toleranceModeEl.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#details_testeditor_fragetypen_ni");
    if (interaction.getToleranceMode() != null) {
        for (String toleranceModeKey : toleranceModeKeys) {
            if (toleranceModeKey.equals(interaction.getToleranceMode().name())) {
                toleranceModeEl.select(toleranceModeKey, true);
            }
        }
    }
    if (!toleranceModeEl.isOneSelected()) {
        toleranceModeEl.select(toleranceModeKeys[0], true);
    }
    toleranceModeEl.addActionListener(FormEvent.ONCHANGE);
    Double lowerTolerance = interaction.getLowerTolerance();
    String lowerToleranceString;
    if (interaction.getToleranceMode() == ToleranceMode.ABSOLUTE) {
        if (lowerTolerance == null) {
            lowerToleranceString = "";
        } else if (solution != null) {
            BigDecimal solBig = BigDecimal.valueOf(solution);
            BigDecimal lowerToleranceBig = BigDecimal.valueOf(lowerTolerance);
            lowerToleranceString = solBig.subtract(lowerToleranceBig).toString();
        } else {
            lowerToleranceString = lowerTolerance.toString();
        }
    } else {
        lowerToleranceString = lowerTolerance == null ? "" : lowerTolerance.toString();
    }
    lowerToleranceEl = uifactory.addTextElement("fib.tolerance.low", "fib.tolerance.low", 8, lowerToleranceString, formLayout);
    lowerToleranceEl.setExampleKey("fib.tolerance.mode.absolute.example", null);
    lowerToleranceEl.setElementCssClass("o_sel_gap_numeric_lower_bound");
    lowerToleranceEl.setEnabled(!restrictedEdit && !readOnly);
    Double upperTolerance = interaction.getUpperTolerance();
    String upperToleranceString;
    if (interaction.getToleranceMode() == ToleranceMode.ABSOLUTE) {
        if (upperTolerance == null) {
            upperToleranceString = "";
        } else if (solution != null) {
            BigDecimal solBig = BigDecimal.valueOf(solution);
            BigDecimal upperToleranceBig = BigDecimal.valueOf(upperTolerance);
            upperToleranceString = solBig.add(upperToleranceBig).toString();
        } else {
            upperToleranceString = upperTolerance.toString();
        }
    } else {
        upperToleranceString = upperTolerance == null ? "" : upperTolerance.toString();
    }
    upperToleranceEl = uifactory.addTextElement("fib.tolerance.up", "fib.tolerance.up", 8, upperToleranceString, formLayout);
    upperToleranceEl.setExampleKey("fib.tolerance.mode.absolute.example", null);
    upperToleranceEl.setElementCssClass("o_sel_gap_numeric_upper_bound");
    upperToleranceEl.setEnabled(!restrictedEdit && !readOnly);
    updateToleranceUpAndLow();
    // Submit Button
    FormLayoutContainer buttonsContainer = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    buttonsContainer.setRootForm(mainForm);
    formLayout.add(buttonsContainer);
    uifactory.addFormCancelButton("cancel", buttonsContainer, ureq, getWindowControl());
    if (!restrictedEdit && !readOnly) {
        uifactory.addFormSubmitButton("submit", buttonsContainer);
    }
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) BigDecimal(java.math.BigDecimal)

Example 80 with FormLayoutContainer

use of org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer in project OpenOLAT by OpenOLAT.

the class FIBTextEntrySettingsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_gap_entry_form");
    String solution = interaction.getSolution();
    solutionEl = uifactory.addTextElement("fib.solution", "fib.solution", 256, solution, formLayout);
    solutionEl.setElementCssClass("o_sel_gap_entry_solution");
    solutionEl.setEnabled(!restrictedEdit && !readOnly);
    if (!StringHelper.containsNonWhitespace(solution)) {
        solutionEl.setFocus(true);
    }
    String placeholder = interaction.getPlaceholder();
    placeholderEl = uifactory.addTextElement("fib.placeholder", "fib.placeholder", 256, placeholder, formLayout);
    placeholderEl.setElementCssClass("o_sel_gap_entry_placeholder");
    placeholderEl.setEnabled(!restrictedEdit && !readOnly);
    String alternativesPage = velocity_root + "/fib_alternatives.html";
    alternativesCont = FormLayoutContainer.createCustomFormLayout("alternatives.list", getTranslator(), alternativesPage);
    alternativesCont.setRootForm(mainForm);
    formLayout.add(alternativesCont);
    alternativesCont.setLabel("fib.alternative", null);
    alternativesCont.setHelpText(translate("fib.alternative.help"));
    alternativesCont.setHelpUrlForManualPage("Test editor QTI 2.1 in detail#details_testeditor_fragetypen_fib");
    alternativesCont.contextPut("alternatives", alternativeRows);
    addFirstAlternative = uifactory.addFormLink("add.first.alternative", "add", "", null, alternativesCont, Link.LINK | Link.NONTRANSLATED);
    addFirstAlternative.setIconLeftCSS("o_icon o_icon-lg o_icon_add");
    addFirstAlternative.setVisible(!restrictedEdit && !readOnly);
    List<TextEntryAlternative> alternatives = interaction.getAlternatives();
    if (alternatives != null && alternatives.size() > 0) {
        for (TextEntryAlternative alternative : alternatives) {
            appendAlternative(alternative, null, false);
        }
    }
    Integer expectedLength = interaction.getExpectedLength();
    String expectedLengthStr = expectedLength == null ? null : expectedLength.toString();
    expectedLengthEl = uifactory.addTextElement("fib.expectedLength", "fib.expectedLength", 256, expectedLengthStr, formLayout);
    expectedLengthEl.setEnabled(!restrictedEdit && !readOnly);
    caseSensitiveEl = uifactory.addCheckboxesHorizontal("fib.caseSensitive", "fib.caseSensitive", formLayout, onKeys, new String[] { "" });
    caseSensitiveEl.setEnabled(!restrictedEdit && !readOnly);
    if (interaction.isCaseSensitive()) {
        caseSensitiveEl.select(onKeys[0], true);
    }
    // Submit Button
    FormLayoutContainer buttonsContainer = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    buttonsContainer.setRootForm(mainForm);
    formLayout.add(buttonsContainer);
    uifactory.addFormCancelButton("cancel", buttonsContainer, ureq, getWindowControl());
    if (!restrictedEdit && !readOnly) {
        uifactory.addFormSubmitButton("submit", buttonsContainer);
    }
}
Also used : FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) TextEntryAlternative(org.olat.ims.qti21.model.xml.interactions.FIBAssessmentItemBuilder.TextEntryAlternative)

Aggregations

FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)844 ArrayList (java.util.ArrayList)96 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)76 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)76 Date (java.util.Date)56 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)56 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)42 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)40 FormItem (org.olat.core.gui.components.form.flexible.FormItem)38 StaticFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer)32 Translator (org.olat.core.gui.translator.Translator)30 Identity (org.olat.core.id.Identity)30 VFSContainer (org.olat.core.util.vfs.VFSContainer)28 File (java.io.File)26 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)26 BusinessGroup (org.olat.group.BusinessGroup)26 HashMap (java.util.HashMap)22 HashSet (java.util.HashSet)22 TextFlexiCellRenderer (org.olat.core.gui.components.form.flexible.impl.elements.table.TextFlexiCellRenderer)22 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)20