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++;
}
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;
}
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;
}
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;
}
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);
}
Aggregations