Search in sources :

Example 36 with FormSubmit

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

the class ChoiceController method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (singleSelection && layoutVertical) {
        entrySelector = uifactory.addRadiosVertical(selectionName, null, formLayout, keysIn, translatedKeys);
    } else if (singleSelection && !layoutVertical) {
        entrySelector = uifactory.addRadiosHorizontal(selectionName, null, formLayout, keysIn, translatedKeys);
    } else if (!singleSelection && layoutVertical) {
        entrySelector = uifactory.addCheckboxesVertical(selectionName, null, formLayout, keysIn, translatedKeys, 1);
    } else if (!singleSelection && !layoutVertical) {
        entrySelector = uifactory.addCheckboxesHorizontal(selectionName, null, formLayout, keysIn, translatedKeys);
    }
    // add Submit
    Submit subm = new FormSubmit("subm", submitI18nKey);
    formLayout.add(subm);
}
Also used : FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit) Submit(org.olat.core.gui.components.form.flexible.elements.Submit) FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit)

Example 37 with FormSubmit

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

the class AssessedIdentityCheckListController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    if (formLayout instanceof FormLayoutContainer) {
        FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
        List<DBCheck> checks = checkboxManager.loadCheck(assessedIdentity, courseOres, courseNode.getIdent());
        Map<String, DBCheck> uuidToCheckMap = new HashMap<>();
        for (DBCheck check : checks) {
            uuidToCheckMap.put(check.getCheckbox().getCheckboxId(), check);
        }
        List<Checkbox> list = checkboxList.getList();
        wrappers = new ArrayList<>(list.size());
        for (Checkbox checkbox : list) {
            DBCheck check = uuidToCheckMap.get(checkbox.getCheckboxId());
            boolean readOnly = false;
            CheckboxWrapper wrapper = forgeCheckboxWrapper(checkbox, check, readOnly, formLayout);
            wrappers.add(wrapper);
        }
        layoutCont.contextPut("checkboxList", wrappers);
    }
    FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
    formLayout.add(buttonCont);
    FormSubmit saveButton = uifactory.addFormSubmitButton("save", "save", buttonCont);
    saveButton.setEnabled(checkboxList.getNumOfCheckbox() > 0);
    saveButton.setVisible(!coachCourseEnv.isCourseReadOnly());
    saveAndCloseLink = uifactory.addFormLink("save.close", buttonCont, Link.BUTTON);
    saveAndCloseLink.setEnabled(checkboxList.getNumOfCheckbox() > 0);
    saveAndCloseLink.setVisible(saveAndClose && !coachCourseEnv.isCourseReadOnly());
    if (cancel) {
        uifactory.addFormCancelButton("cancel", buttonCont, ureq, getWindowControl());
    }
}
Also used : DBCheck(org.olat.course.nodes.cl.model.DBCheck) FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit) HashMap(java.util.HashMap) Checkbox(org.olat.course.nodes.cl.model.Checkbox) DBCheckbox(org.olat.course.nodes.cl.model.DBCheckbox) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 38 with FormSubmit

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

the class GuiDemoFlexiForm method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    /*
		 * create a form with a title and 4 input fields to enter some persons data
		 */
    setFormTitle("guidemo_flexi_form_simpleform");
    final int defaultDisplaySize = 32;
    final boolean inputMode = !personData.isReadOnly();
    firstName = uifactory.addTextElement("firstname", "guidemo.flexi.form.firstname", 256, personData.getFirstName(), formLayout);
    firstName.setDisplaySize(defaultDisplaySize);
    firstName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    firstName.setMandatory(true);
    firstName.setEnabled(inputMode);
    firstName.setPlaceholderText("Hans");
    firstName.setHelpText("If you have a middle name, add it to the first name input field");
    firstName.setHelpUrlForManualPage("Configuration#Profile");
    lastName = uifactory.addTextElement("lastname", "guidemo.flexi.form.lastname", 256, personData.getLastName(), formLayout);
    lastName.setDisplaySize(defaultDisplaySize);
    lastName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    lastName.setEnabled(inputMode);
    lastName.setPlaceholderText("Muster");
    lastName.setHelpUrl("https://en.wikipedia.org/wiki/Family_name");
    fileElement = uifactory.addFileElement(getWindowControl(), "file", formLayout);
    fileElement.setLabel("guidemo.flexi.form.file", null);
    fileElement.setMaxUploadSizeKB(500, "guidemo.flexi.form.filetobig", null);
    Set<String> mimeTypes = new HashSet<String>();
    mimeTypes.add("image/*");
    fileElement.limitToMimeType(mimeTypes, "guidemo.flexi.form.wrongfiletype", null);
    fileElement.setMandatory(true, "guidemo.flexi.form.mustbefilled");
    fileElement.setEnabled(inputMode);
    institution = uifactory.addTextElement("institution", "guidemo.flexi.form.institution", 256, personData.getInstitution(), formLayout);
    institution.setDisplaySize(defaultDisplaySize);
    institution.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    institution.setMandatory(true);
    institution.setEnabled(inputMode);
    institution.setHelpTextKey("guidemo.flexi.form.institution.help", null);
    if (inputMode) {
        // submit only if in input mode
        submit = new FormSubmit("submit", "submit");
        formLayout.add(submit);
    }
}
Also used : FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit) HashSet(java.util.HashSet)

Example 39 with FormSubmit

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

the class GuiDemoFlexiFormCustomlayout method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    /*
		 * create a form with a title and 4 input fields to enter some persons data
		 */
    setFormTitle("guidemo_flexi_form_customlayout");
    final boolean inputMode = !personData.isReadOnly();
    firstName = uifactory.addTextElement("firstname", "guidemo.flexi.form.firstname", 256, personData.getFirstName(), formLayout);
    firstName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    firstName.setMandatory(true);
    firstName.setEnabled(inputMode);
    lastName = uifactory.addTextElement("lastname", "guidemo.flexi.form.lastname", 256, personData.getLastName(), formLayout);
    lastName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    lastName.setMandatory(true);
    lastName.setEnabled(inputMode);
    institution = uifactory.addTextElement("institution", "guidemo.flexi.form.institution", 256, personData.getInstitution(), formLayout);
    institution.setEnabled(inputMode);
    if (inputMode) {
        // submit only if in input mode
        submit = new FormSubmit("submit", "submit");
        formLayout.add(submit);
    }
}
Also used : FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit)

Example 40 with FormSubmit

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

the class GuiDemoFlexiFormHideUnhide method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    setFormTitle("guidemo_flexi_form_hideunhide");
    final boolean inputMode = !personData.isReadOnly();
    /*
		 * hide unhide chooser
		 */
    checkbox = uifactory.addCheckboxesVertical("checkbox", "guidemo.flexi.form.show", formLayout, new String[] { "ison" }, new String[] { "" }, 1);
    checkbox.select("ison", true);
    // register for on click event to hide/disable other elements
    checkbox.addActionListener(FormEvent.ONCLICK);
    // rule to hide/unhide is defined at the end
    firstName = uifactory.addTextElement("firstname", "guidemo.flexi.form.firstname", 256, personData.getFirstName(), formLayout);
    firstName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    firstName.setMandatory(true);
    firstName.setEnabled(inputMode);
    lastName = uifactory.addTextElement("firstname", "guidemo.flexi.form.lastname", 256, personData.getLastName(), formLayout);
    lastName.setNotEmptyCheck("guidemo.flexi.form.mustbefilled");
    lastName.setMandatory(true);
    lastName.setEnabled(inputMode);
    institution = uifactory.addTextElement("institution", "guidemo.flexi.form.institution", 256, personData.getInstitution(), formLayout);
    institution.setEnabled(inputMode);
    if (inputMode) {
        // submit only if in input mode
        submit = new FormSubmit("submit", "submit");
        formLayout.add(submit);
    }
    /*
		 * now the rules to hide unhide 
		 */
    Set<FormItem> targets = new HashSet<FormItem>();
    targets.add(firstName);
    targets.add(lastName);
    targets.add(institution);
    targets.add(submit);
    RulesFactory.createHideRule(checkbox, null, targets, formLayout);
    RulesFactory.createShowRule(checkbox, "ison", targets, formLayout);
}
Also used : FormSubmit(org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit) FormItem(org.olat.core.gui.components.form.flexible.FormItem) HashSet(java.util.HashSet)

Aggregations

FormSubmit (org.olat.core.gui.components.form.flexible.impl.elements.FormSubmit)42 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)16 HashSet (java.util.HashSet)4 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)4 Submit (org.olat.core.gui.components.form.flexible.elements.Submit)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)4 Date (java.util.Date)2 HashMap (java.util.HashMap)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)2 Translator (org.olat.core.gui.translator.Translator)2 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)2 ContextEntry (org.olat.core.id.context.ContextEntry)2 Checkbox (org.olat.course.nodes.cl.model.Checkbox)2 DBCheck (org.olat.course.nodes.cl.model.DBCheck)2 DBCheckbox (org.olat.course.nodes.cl.model.DBCheckbox)2 RubricBlock (uk.ac.ed.ph.jqtiplus.node.content.variable.RubricBlock)2 TimeLimits (uk.ac.ed.ph.jqtiplus.node.test.TimeLimits)2