Search in sources :

Example 36 with TextElement

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

the class RegistrationForm2 method getLastName.

protected String getLastName() {
    FormItem fi = propFormItems.get("lastName");
    TextElement fn = (TextElement) fi;
    return fn.getValue().trim();
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormItem(org.olat.core.gui.components.form.flexible.FormItem)

Example 37 with TextElement

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

the class RegistrationForm2 method getFirstName.

protected String getFirstName() {
    FormItem fi = propFormItems.get("firstName");
    TextElement fn = (TextElement) fi;
    return fn.getValue().trim();
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormItem(org.olat.core.gui.components.form.flexible.FormItem)

Example 38 with TextElement

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

the class SendMailController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    String fullName = userManager.getUserDisplayName(getIdentity());
    if (StringHelper.containsNonWhitespace(fullName)) {
        fullName = "[" + fullName + "]";
    }
    TextElement fromEl = uifactory.addTextElement("from", "contact.from", 255, fullName, formLayout);
    fromEl.setEnabled(false);
    String[] contactValues = new String[] { translate("contact.to.owner"), translate("contact.to.coach"), translate("contact.to.participant") };
    contactEl = uifactory.addCheckboxesVertical("to", "contact.to", formLayout, contactKeys, contactValues, 1);
    subjectEl = uifactory.addTextElement("subject", "contact.subject", 255, "", formLayout);
    subjectEl.setDisplaySize(255);
    subjectEl.setMandatory(true);
    bodyEl = uifactory.addRichTextElementForStringDataMinimalistic("body", "contact.body", "", 15, 8, formLayout, getWindowControl());
    bodyEl.setMandatory(true);
    attachmentEl = uifactory.addFileElement(getWindowControl(), "file_upload_1", "contact.attachment", formLayout);
    attachmentEl.addActionListener(FormEvent.ONCHANGE);
    attachmentEl.setExampleKey("contact.attachment.maxsize", new String[] { Integer.toString(contactAttachmentMaxSizeInMb) });
    String attachmentPage = velocity_root + "/attachments.html";
    uploadCont = FormLayoutContainer.createCustomFormLayout("file_upload_inner", getTranslator(), attachmentPage);
    uploadCont.setRootForm(mainForm);
    uploadCont.setVisible(false);
    uploadCont.contextPut("attachments", attachments);
    formLayout.add(uploadCont);
    copyFromEl = uifactory.addCheckboxesHorizontal("copy.from", "contact.cp.from", formLayout, onKeys, new String[] { "" });
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    uifactory.addFormCancelButton("cancel", buttonGroupLayout, ureq, getWindowControl());
    uifactory.addFormSubmitButton("tools.send.mail", buttonGroupLayout);
}
Also used : RichTextElement(org.olat.core.gui.components.form.flexible.elements.RichTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 39 with TextElement

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

the class GenericSelectionPropertyHandlerController method validateFormLogic.

@Override
protected boolean validateFormLogic(UserRequest ureq) {
    if (optionFieldNames.size() < 1) {
        return false;
    }
    if (singleKeyTrsCtrl == null) {
        singleKeyTrsCtrl = new SingleKeyTranslatorController(ureq, getWindowControl(), "", GenericSelectionPropertyHandler.class);
        listenTo(singleKeyTrsCtrl);
    }
    for (int i = 0; i < optionFieldNames.size(); i++) {
        TextElement te = (TextElement) hcFlc.getFormComponent(OPTFIELD_PREFIX + optionFieldNames.get(i));
        String textValue = te.getValue();
        if (StringHelper.containsNonWhitespace(textValue)) {
            String translatedValue = I18nManager.getInstance().getLocalizedString(GenericSelectionPropertyHandler.class.getPackage().getName(), textValue, null, getLocale(), true, true);
            if (translatedValue == null) {
                txtError.setValue("Please translate all values");
                txtError.setVisible(true);
                return false;
            }
        }
    }
    txtError.setVisible(false);
    return true;
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) SingleKeyTranslatorController(org.olat.core.util.i18n.ui.SingleKeyTranslatorController)

Example 40 with TextElement

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

the class GenericSelectionPropertyHandlerController method addOptionField.

/**
 * adds an option field to the form (one row in the table)
 *
 * @param val
 */
private void addOptionField(String val) {
    int teNumber = optionFieldNames.size() + 1;
    TextElement te = uifactory.addTextElement(OPTFIELD_PREFIX + teNumber, null, 10, "", hcFlc);
    te.setValue(val);
    if (StringHelper.containsNonWhitespace(val)) {
        uifactory.addStaticTextElement(OPTFIELD_TRSLBL_PREFIX + teNumber, null, "(" + translate(val) + ")", hcFlc);
    }
    FormLink tl = uifactory.addFormLink(OPTFIELD_TRS_PREFIX + teNumber, "gsphc.translate", "label", hcFlc, Link.LINK);
    FormLink re = uifactory.addFormLink(OPTFIELD_RMV_PREFIX + teNumber, "gsphc.remove", "label", hcFlc, Link.BUTTON_XSMALL);
    re.setUserObject(te);
    tl.setUserObject(te);
    optionFieldNames.add(String.valueOf(teNumber));
    hcFlc.contextPut("optionfields", optionFieldNames);
}
Also used : StaticTextElement(org.olat.core.gui.components.form.flexible.elements.StaticTextElement) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Aggregations

TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)146 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)40 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)36 FormItem (org.olat.core.gui.components.form.flexible.FormItem)34 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)30 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)26 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)24 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)18 ArrayList (java.util.ArrayList)16 MultipleSelectionElement (org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement)16 Identity (org.olat.core.id.Identity)12 HashMap (java.util.HashMap)8 FormLinkImpl (org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)8 EmailProperty (org.olat.user.propertyhandlers.EmailProperty)8 Date (java.util.Date)6 DateChooser (org.olat.core.gui.components.form.flexible.elements.DateChooser)6 StaticTextElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.StaticTextElementImpl)6 TextElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.TextElementImpl)6 RichTextElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl)6 File (java.io.File)4