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