Package org.olat.core.gui.formelements

Examples of org.olat.core.gui.formelements.TextElement


    addFormElement("partips", partips);
    //
    SpacerElement s1 = new SpacerElement(true, false);
    addFormElement("s1", s1);
    //
    group = new TextElement("form.message.group", (String) config.get(COEditController.CONFIG_KEY_EMAILTOGROUPS), false, 3000);
    group.setExample(translate("form.message.example.group"));
    PopupData pd = new PopupData("popupchoosegroups" + this.hashCode(), "popupchoosegroups", "popupchoosegroups", 800, 400);
    group.setPopupData(pd);
    addFormElement(FormRenderer.JSELEMENTID +"popupchoosegroups"+this.hashCode(), group);
    //
    area = new TextElement("form.message.area", (String) config.get(COEditController.CONFIG_KEY_EMAILTOAREAS), false, 3000);
    area.setExample(translate("form.message.example.area"));
    PopupData pda = new PopupData("popupchooseareas" + this.hashCode(), "popupchooseareas", "popupchooseareas", 800, 400);
    area.setPopupData(pda);
    addFormElement(FormRenderer.JSELEMENTID +"popupchooseareas"+this.hashCode(), area);
    //
    SpacerElement s2 = new SpacerElement(true, false);
    addFormElement("s2", s2);

    this.eList = (List) config.get(COEditController.CONFIG_KEY_EMAILTOADRESSES);
    String emailToAdresses = "";
    if (eList != null) {
      emailToAdresses = StringHelper.formatIdentitesAsEmailToString(eList, "\n");
    }
    teArElEmailToAdresses = new TextAreaElement("message.emailtoadresses", 3, 60, emailToAdresses);
    addFormElement("email", teArElEmailToAdresses);

    String mS = (String) config.get(COEditController.CONFIG_KEY_MSUBJECT_DEFAULT);
    String mSubject = (mS != null) ? mS : "";
    teElSubject = new TextElement("message.subject", mSubject, false, 60, 255);
    addFormElement("mSubject", teElSubject);

    String mB = (String) config.get(COEditController.CONFIG_KEY_MBODY_DEFAULT);
    String mBody = (mB != null) ? mB : "";
    teArElBody = new TextAreaElement("message.body", 8, 60, mBody);
View Full Code Here


  private CheckBoxElement taglessMattext;
 
  public DelimChooseForm(String name, Translator translator, String sep, String emb, String esc, String car, String suf) {
    super(name, translator);
   
    separatedByEl = new TextElement("form.separatedby", sep, false, 5, 50);
    separatedByEl.setExample(translate("form.separatedby.ex"));
    addFormElement("separatedby", separatedByEl);
    embeddedByEl = new TextElement("form.embeddedby", emb, false, 2, 1);
    embeddedByEl.setExample(translate("form.embeddedby.ex"));
    addFormElement("embeddedby", embeddedByEl);
    escapedByEl = new TextElement("form.escapedby", esc, false, 2, 1);
    escapedByEl.setExample(translate("form.escapedby.ex"));
    addFormElement("escapedby", escapedByEl);
    carriageReturnEl = new TextElement("form.carriagereturn", car,false, 5, 50);
    carriageReturnEl.setExample(translate("form.carriagereturn.ex"));
    addFormElement("carriagereturn", carriageReturnEl);
   
    addFormElement("spacer1", new SpacerElement(false, true));
   
    fileNameSuffixEl = new TextElement("form.filenamesuffix", suf, false, 5, 50);
    fileNameSuffixEl.setExample(translate("form.filenamesuffix.ex"));
    addFormElement("filenamesuffix", fileNameSuffixEl);
   
    taglessMattext = new CheckBoxElement("form.taglessmattext", false);
    addFormElement("taglessmattext", taglessMattext);
View Full Code Here

    singleSelection.select(languageKey, true);
    addFormElement("lang", singleSelection);

    // third the login name and password
    addFormElement("space_username", new SpacerElement(true, true));
    addFormElement("usr_login", new TextElement("user.login", "", 128));
    getTextElement("usr_login").setMandatory(true);
    addFormElement("pwd1", new PasswordElement("user.password", 255));
    getTextElement("pwd1").setMandatory(true);
    addFormElement("pwd2", new PasswordElement("user.password2", 255));
    getTextElement("pwd2").setMandatory(true);
View Full Code Here

      if (!userPropertyHandler.isValid(ui, null)) {
        return false;
      }
    }
    // validate user login name
    TextElement tl = getTextElement("usr_login");
    if ( ! UserManager.getInstance().syntaxCheckOlatLogin(tl.getValue())) {
      tl.setErrorKey("form.check3");
      return false;
    }
    Identity s = ManagerFactory.getManager().findIdentityByName(tl.getValue());
    if (s != null || UserManager.isLoginOnBlacklist(tl.getValue())) {
      tl.setErrorKey("form.check6");
      return false;
    }
    // validate given password
    if ( ! getTextElement("pwd1").notEmpty("form.check4")) {
      return false;
View Full Code Here

  /**
   * Initialize the form
   */
  public void init() {
    addFormElement("email_address", new TextElement("email.address","", 255));
    getTextElement("email_address").setMandatory(true);
    addSubmitKey("submit.speichernUndweiter", "submit");
    setCancelKey("submit.cancel");
  }
View Full Code Here

  /**
   * @see org.olat.core.gui.components.Form#validate(org.olat.core.gui.UserRequest)
   */
  public boolean validate() {
    TextElement mail = getTextElement("email_address");
    if ( ! mail.notEmpty("email.address.maynotbeempty"))
      return false;
    if ( ! MailHelper.isValidEmailAddress(mail.getValue())) {
      mail.setErrorKey("email.address.notregular");
      return false;
    }
    return true;
  }
View Full Code Here

  /**
   * @see org.olat.user.propertyhandlers.Generic127CharTextPropertyHandler#getFormElement(java.util.Locale, org.olat.core.id.User, java.lang.String, boolean)
   */
  @Override
  public FormElement getFormElement(Locale locale, User user, String usageIdentifyer, boolean isAdministrativeUser) {
    TextElement ui = (TextElement) super.getFormElement(locale, user, usageIdentifyer, isAdministrativeUser);
    // skype names are max 32 chars long
    ui.setMaxLength(32);
    if ( ! UserManager.getInstance().isUserViewReadOnly(usageIdentifyer, this) || isAdministrativeUser) {
      ui.setExample("myskypename");
    }
    return ui;
  }
View Full Code Here

   */
  @Override
  public boolean isValid(FormElement ui, Map formContext) {
    // check parent rules first: check if mandatory and empty
    if ( ! super.isValid(ui,formContext)) return false;
    TextElement uiEmail = (TextElement) ui;
    String value = uiEmail.getValue();
    if (StringHelper.containsNonWhitespace(value)) { 
      // check mail address syntax
      if ( ! MailHelper.isValidEmailAddress(value)) {
        uiEmail.setErrorKey(i18nFormElementLabelKey() + ".error.valid");
        return false;
      }
      // Email is syntactically correct.
      // Check whether it's available.
      if (!uiEmail.isEmpty()) {
        if (!isAddressAvailable(value, (String)formContext.get("username"))) {
          uiEmail.setErrorKey(i18nFormElementLabelKey() + ".error.exists");
          return false;
        }
      }
    }
    // everthing ok
View Full Code Here

  /**
   * @see org.olat.user.propertyhandlers.UserPropertyHandler#getFormElement(java.util.Locale, org.olat.core.id.User, java.lang.String, boolean)
   */
  public FormElement getFormElement(Locale locale, User user, String usageIdentifyer, boolean isAdministrativeUser) {
    // default is no element
    TextElement ui = null;
    UserManager um = UserManager.getInstance();
    ui = new TextElement(i18nFormElementLabelKey(), getInternalValue(user), 127);
    if ( um.isUserViewReadOnly(usageIdentifyer, this) && ! isAdministrativeUser) {
      ui.setReadOnly(true);
    }
    if (um.isMandatoryUserProperty(usageIdentifyer, this)) {
      ui.setMandatory(true);
    }
    return ui;
  }
View Full Code Here

  /**
   * @see org.olat.user.propertyhandlers.UserPropertyHandler#isValid(org.olat.core.gui.formelements.FormElement)
   */
  public boolean isValid(FormElement ui, Map formContext) {
    TextElement uiText = (TextElement) ui;
    if (ui.isMandatory()) {
      return uiText.notEmpty(i18nFormElementLabelKey()+ ".error.empty");     
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.formelements.TextElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.