Package org.olat.core.gui.formelements

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


  /**
   * @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);
    ui.setExample("+41 12 345 67 89");
    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 uiPhone = (TextElement) ui;
    String value = uiPhone.getValue();
    if (StringHelper.containsNonWhitespace(value)) {     
      // check phone address syntax
      if ( ! VALID_PHONE_PATTERN_IP.matcher(value).matches()) {
        ui.setErrorKey(i18nFormElementLabelKey()+ ".error.valid");
        return false;
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);
    if ( ! UserManager.getInstance().isUserViewReadOnly(usageIdentifyer, this) || isAdministrativeUser) {
      ui.setExample("http://www.olat.org");
    }
    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 uiURL = (TextElement) ui;
    String value = uiURL.getValue();
    if (StringHelper.containsNonWhitespace(value)) {     
      // check url address syntax
      try {
        new URL(value);
      } catch (MalformedURLException e) {
        uiURL.setErrorKey(i18nFormElementLabelKey() + ".error.valid");
        return false;
      }
    }
    // everthing ok
    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.