Search in sources :

Example 1 with TextElement

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

the class FormUIFactory method addPasswordElement.

public TextElement addPasswordElement(String id, String name, final String i18nLabel, final int maxLen, String initialValue, FormItemContainer formLayout) {
    TextElement te = new TextElementImpl(id, name, initialValue, TextElementImpl.HTML_INPUT_TYPE_PASSWORD);
    te.setNotLongerThanCheck(maxLen, "text.element.error.notlongerthan");
    setLabelIfNotNull(i18nLabel, te);
    te.setMaxLength(maxLen);
    formLayout.add(te);
    return te;
}
Also used : 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) RichTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl) StaticTextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.StaticTextElementImpl) TextElementImpl(org.olat.core.gui.components.form.flexible.impl.elements.TextElementImpl)

Example 2 with TextElement

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

the class MediaLinksController method addNewFormLink.

private void addNewFormLink(LinkWrapper link, FormLayoutContainer layoutContainer) {
    // add link target
    String id = link.getId();
    TextElement url = uifactory.addTextElement("url_" + id, null, -1, link.getLink().getURI(), layoutContainer);
    url.clearError();
    url.setDisplaySize(60);
    url.setMandatory(true);
    url.setEnabled(false);
    link.setUrl(url);
    // custom media action button
    FormLink mediaButton = uifactory.addFormLink("media_" + id, " ", " ", layoutContainer, Link.NONTRANSLATED);
    mediaButton.setIconLeftCSS("o_icon o_icon_browse");
    mediaButton.setUserObject(link);
    link.setMediaButton(mediaButton);
    // add link description
    TextElement name = uifactory.addTextElement("displayName_" + id, null, -1, link.getLink().getDisplayName(), layoutContainer);
    name.clearError();
    name.setDisplaySize(40);
    name.setMandatory(true);
    link.setName(name);
    // add link add action button
    FormLink addButton = uifactory.addFormLink("add_" + id, "table.add", "table.add", layoutContainer, Link.BUTTON);
    addButton.setUserObject(link);
    link.setAddButton(addButton);
    // add link deletion action button
    FormLink delButton = uifactory.addFormLink("del_" + id, "table.delete", "table.delete", layoutContainer, Link.BUTTON);
    delButton.setUserObject(link);
    link.setDelButton(delButton);
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 3 with TextElement

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

the class UsermanagerUserSearchForm method getStateEntry.

protected StateMapped getStateEntry() {
    StateMapped state = new StateMapped();
    if (items != null) {
        for (Map.Entry<String, FormItem> itemEntry : items.entrySet()) {
            String key = itemEntry.getKey();
            FormItem f = itemEntry.getValue();
            if (f instanceof TextElement) {
                state.getDelegate().put(key, ((TextElement) f).getValue());
            }
        }
    }
    if (auth.isMultiselect()) {
    // auth.
    }
    if (roles.isMultiselect()) {
    // 
    }
    if (status.isOneSelected()) {
    // 
    }
    return state;
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormItem(org.olat.core.gui.components.form.flexible.FormItem) StateMapped(org.olat.core.id.context.StateMapped) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with TextElement

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

the class UserSearchForm method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    formLayout.setElementCssClass("o_sel_user_search_form");
    login = uifactory.addTextElement("login", "search.form.login", 128, "", formLayout);
    login.setVisible(isAdminProps);
    login.setElementCssClass("o_sel_user_search_username");
    Translator tr = Util.createPackageTranslator(UserPropertyHandler.class, getLocale(), getTranslator());
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        if (userPropertyHandler == null)
            continue;
        FormItem fi = userPropertyHandler.addFormItem(getLocale(), null, getClass().getCanonicalName(), false, formLayout);
        fi.setTranslator(tr);
        // DO NOT validate email field => see OLAT-3324, OO-155, OO-222
        if (userPropertyHandler instanceof EmailProperty && fi instanceof TextElement) {
            TextElement textElement = (TextElement) fi;
            textElement.setItemValidatorProvider(null);
        }
        fi.setElementCssClass("o_sel_user_search_".concat(userPropertyHandler.getName().toLowerCase()));
        propFormItems.put(userPropertyHandler.getName(), fi);
    }
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    // Don't use submit button, form should not be marked as dirty since this is
    // not a configuration form but only a search form (OLAT-5626)
    searchButton = uifactory.addFormLink("submit.search", buttonGroupLayout, Link.BUTTON);
    searchButton.setElementCssClass("o_sel_user_search_button");
    if (cancelButton) {
        uifactory.addFormCancelButton("cancel", buttonGroupLayout, ureq, getWindowControl());
    }
}
Also used : EmailProperty(org.olat.user.propertyhandlers.EmailProperty) TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) Translator(org.olat.core.gui.translator.Translator) FormItem(org.olat.core.gui.components.form.flexible.FormItem) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 5 with TextElement

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

the class MembersMailController 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", "email.from", 255, fullName, formLayout);
    fromEl.setEnabled(false);
    uifactory.addSpacerElement("space-1", formLayout, false);
    String to = "send.mail.to";
    if (ownerList != null && ownerList.size() > 0) {
        String[] values = new String[] { translate("contact.all.owners") };
        ownerEl = uifactory.addCheckboxesHorizontal("contact.all.owners", to, formLayout, keys, values);
        to = null;
    }
    if (coachList != null && coachList.size() > 0) {
        String[] values = new String[] { translate("contact.all.coaches") };
        coachEl = uifactory.addCheckboxesHorizontal("contact.all.coaches", to, formLayout, keys, values);
        to = null;
    }
    if (participantList != null && participantList.size() > 0) {
        String[] values = new String[] { translate("contact.all.participants") };
        participantEl = uifactory.addCheckboxesHorizontal("contact.all.participants", to, formLayout, keys, values);
        to = null;
    }
    if (waitingList != null && waitingList.size() > 0) {
        String[] values = new String[] { translate("contact.all.waiting") };
        waitingEl = uifactory.addCheckboxesHorizontal("contact.all.waiting", to, formLayout, keys, values);
        to = null;
    }
    if ((ownerList != null && ownerList.size() > 0) || (coachList != null && coachList.size() > 0) || (participantList != null && participantList.size() > 0) || (waitingList != null && waitingList.size() > 0)) {
        String[] values = new String[] { translate("contact.individual") };
        individualEl = uifactory.addCheckboxesHorizontal("contact.individual", to, formLayout, keys, values);
        individualEl.addActionListener(FormEvent.ONCHANGE);
        to = null;
        String attachmentPage = velocity_root + "/individual_members.html";
        individualMemberCont = FormLayoutContainer.createCustomFormLayout("contact.individual.list", getTranslator(), attachmentPage);
        formLayout.add(individualMemberCont);
        individualMemberCont.setRootForm(mainForm);
        individualMemberCont.setVisible(false);
        individualMemberCont.contextPut("selectedMembers", selectedMembers);
        addMemberButton = uifactory.addFormLink("add.member", "add", "", "", individualMemberCont, Link.NONTRANSLATED);
        addMemberButton.setIconLeftCSS("o_icon o_icon-lg o_icon_table_large");
        addMemberButton.setDomReplacementWrapperRequired(false);
        addMemberButton.getComponent().setSuppressDirtyFormWarning(true);
    }
    String[] extValues = new String[] { translate("contact.external") };
    externalEl = uifactory.addCheckboxesHorizontal("contact.external", to, formLayout, keys, extValues);
    externalEl.addActionListener(FormEvent.ONCHANGE);
    externalAddressesEl = uifactory.addTextAreaElement("contact.external.list", null, 4096, 3, 60, false, "", formLayout);
    externalAddressesEl.setExampleKey("contact.external.list.example", null);
    externalAddressesEl.setVisible(false);
    uifactory.addSpacerElement("space-2", formLayout, false);
    subjectEl = uifactory.addTextElement("subject", "mail.subject", 255, "", formLayout);
    subjectEl.setDisplaySize(255);
    subjectEl.setMandatory(true);
    bodyEl = uifactory.addRichTextElementForStringDataMinimalistic("body", "mail.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);
    String[] copyValues = new String[] { "" };
    copyFromEl = uifactory.addCheckboxesHorizontal("copy.from", "contact.cp.from", formLayout, keys, copyValues);
    FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttonGroupLayout", getTranslator());
    formLayout.add(buttonGroupLayout);
    uifactory.addFormSubmitButton("email.send", buttonGroupLayout);
    uifactory.addFormCancelButton("cancel", buttonGroupLayout, ureq, getWindowControl());
}
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)

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