Search in sources :

Example 86 with TextElement

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

the class ChecklistEditCheckpointsController method addNewFormCheckpoint.

private void addNewFormCheckpoint(int index, Checkpoint checkpoint) {
    // add checkpoint title
    String pointTitle = checkpoint.getTitle() == null ? "" : checkpoint.getTitle();
    TextElement title = uifactory.addTextElement("title" + counter, null, -1, pointTitle, titleContainer);
    // TODO:SK:2009-11-20:PB:should be default -> check layout in velocity.
    title.showError(false);
    title.setDisplaySize(20);
    title.setMandatory(true);
    // TODO:Stefan Köber: please verify that the default not empty check does the same as you ItemValidatorProvider
    title.setNotEmptyCheck("cl.table.title.error");
    title.setUserObject(checkpoint);
    titleInputList.add(index, title);
    // add checkpoint description
    TextElement description = uifactory.addTextElement("description" + counter, null, -1, checkpoint.getDescription(), titleContainer);
    description.setDisplaySize(35);
    description.setMandatory(false);
    description.setUserObject(checkpoint);
    descriptionInputList.add(index, description);
    // add link comment
    String[] keys = CheckpointMode.getModes();
    String[] values = new String[keys.length];
    for (int i = 0; i < keys.length; i++) {
        values[i] = translate(keys[i]);
    }
    SingleSelection mode = uifactory.addDropdownSingleselect("modus" + counter, "form.enableCancelEnroll", titleContainer, keys, values, null);
    mode.select(checkpoint.getMode(), checkpoint.getMode() != null);
    mode.setUserObject(checkpoint);
    modeInputList.add(index, mode);
    // add link deletion action button
    FormLink delButton = new FormLinkImpl("delete" + counter, "delete" + counter, "cl.table.delete", Link.BUTTON_SMALL);
    delButton.setUserObject(checkpoint);
    titleContainer.add(delButton);
    delButtonList.add(index, delButton);
    // increase the counter to enable unique component names
    counter++;
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormLinkImpl(org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 87 with TextElement

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

the class LandingPagesAdminController method initRuleWrapper.

private RuleWrapper initRuleWrapper(int pos, Rule rule, FormItemContainer formLayout) {
    int i = counter.incrementAndGet();
    RuleWrapper wrapper = new RuleWrapper(rule);
    wrapper.setPosition(pos);
    SingleSelection roleEl = uifactory.addDropdownSingleselect("role-" + i, null, formLayout, roleKeys, roleValues, null);
    String role = rule.getRole();
    for (int j = roleKeys.length; j-- > 0; ) {
        if (roleKeys[j].equals(role)) {
            roleEl.select(roleKeys[j], true);
        }
    }
    wrapper.setRoleEl(roleEl);
    SingleSelection attrNameEl = uifactory.addDropdownSingleselect("attr-key-" + i, null, formLayout, attrKeys, attrValues, null);
    String userAttributeKey = rule.getUserAttributeKey();
    for (int j = attrKeys.length; j-- > 0; ) {
        if (attrKeys[j].equals(userAttributeKey)) {
            attrNameEl.select(attrKeys[j], true);
        }
    }
    wrapper.setAttrNameEl(attrNameEl);
    TextElement valEl = uifactory.addTextElement("attr-val-" + i, null, 256, "", formLayout);
    valEl.setValue(rule.getUserAttributeValue());
    wrapper.setAttrValueEl(valEl);
    TextElement landingPageEl = uifactory.addTextElement("l-page-" + i, null, 256, "", formLayout);
    landingPageEl.setValue(rule.getLandingPath());
    wrapper.setLandingPageEl(landingPageEl);
    formLayout.add(landingPageEl);
    FormLink chooser = uifactory.addFormLink("chooser-" + i, "chooser", RCols.landingPageChooser.i18nKey(), null, formLayout, Link.BUTTON);
    chooser.setIconRightCSS("o_icon o_icon_caret");
    chooser.setUserObject(wrapper);
    wrapper.setLandingPageChooser(chooser);
    return wrapper;
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) SingleSelection(org.olat.core.gui.components.form.flexible.elements.SingleSelection) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 88 with TextElement

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

the class FormUIFactory method addInlineTextElement.

public TextElement addInlineTextElement(String name, String value, FormItemContainer formLayout, FormBasicController listener) {
    TextElement ie = new TextElementImpl(null, name, value, TextElementImpl.HTML_INPUT_TYPE_TEXT, true);
    ie.addActionListener(FormEvent.ONCLICK);
    if (listener != null) {
        formLayout.add(ie);
    }
    return ie;
}
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 89 with TextElement

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

the class FormUIFactory method addTextElement.

/**
 * @param id The unique identifier of this text element (can be null)
 * @param name
 * @param maxLen
 * @param initialValue
 * @param i18nLabel
 * @param formLayout
 * @return
 */
public TextElement addTextElement(String id, String name, final String i18nLabel, final int maxLen, String initialValue, FormItemContainer formLayout) {
    String val = initialValue == null ? "" : initialValue;
    TextElement te = new TextElementImpl(id, name, val);
    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 90 with TextElement

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

the class UsermanagerUserSearchForm 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(isAdministrativeUser);
    login.setElementCssClass("o_sel_user_search_username");
    items.put("login", login);
    String currentGroup = null;
    // Add all available user fields to this form
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        if (userPropertyHandler == null)
            continue;
        String group = userPropertyHandler.getGroup();
        if (!group.equals(currentGroup)) {
            if (currentGroup != null) {
                uifactory.addSpacerElement("spacer_" + group, formLayout, false);
            }
            currentGroup = group;
        }
        FormItem fi = userPropertyHandler.addFormItem(getLocale(), null, getClass().getCanonicalName(), false, formLayout);
        // Do not validate items, this is a search form!
        if (fi instanceof TextElement) {
            TextElement textElement = (TextElement) fi;
            textElement.setItemValidatorProvider(null);
        }
        fi.setElementCssClass("o_sel_user_search_".concat(userPropertyHandler.getName().toLowerCase()));
        fi.setTranslator(getTranslator());
        items.put(fi.getName(), fi);
    }
    uifactory.addSpacerElement("space1", formLayout, false);
    roles = uifactory.addCheckboxesVertical("roles", "search.form.title.roles", formLayout, roleKeys, roleValues, 1);
    uifactory.addSpacerElement("space2", formLayout, false);
    auth = uifactory.addCheckboxesVertical("auth", "search.form.title.authentications", formLayout, authKeys, authValues, 1);
    uifactory.addSpacerElement("space3", formLayout, false);
    status = uifactory.addRadiosVertical("status", "search.form.title.status", formLayout, statusKeys, statusValues);
    status.select(statusKeys[0], true);
    uifactory.addSpacerElement("space4", formLayout, false);
    afterDate = uifactory.addDateChooser("search.form.afterDate", null, formLayout);
    afterDate.setValidDateCheck("error.search.form.no.valid.datechooser");
    beforeDate = uifactory.addDateChooser("search.form.beforeDate", null, formLayout);
    beforeDate.setValidDateCheck("error.search.form.no.valid.datechooser");
    uifactory.addSpacerElement("space5", formLayout, false);
    userLoginAfter = uifactory.addDateChooser("search.form.userLoginAfterDate", null, formLayout);
    userLoginAfter.setValidDateCheck("error.search.form.no.valid.datechooser");
    userLoginBefore = uifactory.addDateChooser("search.form.userLoginBeforeDate", null, formLayout);
    userLoginBefore.setValidDateCheck("error.search.form.no.valid.datechooser");
    uifactory.addSpacerElement("spaceBottom", formLayout, false);
    // 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("search", formLayout, Link.BUTTON);
    searchButton.addActionListener(FormEvent.ONCLICK);
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormItem(org.olat.core.gui.components.form.flexible.FormItem) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

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