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