Package eu.maydu.gwt.validation.client.i18n

Examples of eu.maydu.gwt.validation.client.i18n.StandardValidationMessages


    }
  }

  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    int selectedIndex = box.getSelectedIndex();
    String selectedValue = this.unselectedValue;
    if(selectedIndex > -1)
      selectedValue = box.getValue(selectedIndex);
    if(selectedValue.equals(this.unselectedValue) && isRequired()) {
     
      ValidationResult result = new ValidationResult();
      ValidationError error = result.new ValidationError(null, getErrorMessage(allMessages, messages.mustSelectValue()));
      result.getErrors().add(error);
      return result;
    }
     
    return null;
View Full Code Here


  }
 

  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str = text.getText();   
    if(str == null)
      str = "";
    str = str.trim();
    if(!isRequired() && str.equals(""))
      return new ValidationResult(getErrorMessage(allMessages, messages.noDateGiven()));
    else if(str.equals(""))
      return null;
   
    try {
      formatter.parseStrict(str);
    }catch(IllegalArgumentException ex) {
      return new ValidationResult(getErrorMessage(allMessages, messages.unparsableDate()));
    }
   
    return null;
  }
View Full Code Here

    this.setCustomMsgKey(customMsgKey);
  }
 
  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str;
    if(text != null)
      str = text.getText();
    else str = suggest.getText();
    if(str == null)
      str = "";
    if(str.equals("") && !isRequired())
      return null;
    if(str.length() < this.min || str.length() > this.max)
      return new ValidationResult(getErrorMessage(allMessages, messages.length(this.min, this.max, str.length()), this.min, this.max, str.length()));

    return null;
  }
View Full Code Here

 

 
  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str1;
    String str2;
    if(text1 != null) {
      str1 = text1.getText();
      str2 = text2.getText();
    }else {
      str1 = suggest1.getText();
      str2 = suggest2.getText();
    }
   
    if(str1.equals("") && str2.equals("") && isRequired())
      return new ValidationResult(getErrorMessage(allMessages, messages.notNull()));
   
    List<String> strings = new LinkedList<String>();
    strings.add(str1);
    strings.add(str2);
    ValidatorAlgorithmResult result = algorithm.validate(strings);
    if(result == null)
      return null;
    else
      return new ValidationResult(getErrorMessage(allMessages, messages.stringsNotEqual()));
   
  }
View Full Code Here

  }
 

  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str = text.getText();   
    if(!isRequired() && str.equals(""))
      return null;
    str = str.trim();
    if(str.equals(""))
      return new ValidationResult(getErrorMessage(allMessages, messages.noDateGiven()));
   
   
    try {
      formatter.parseStrict(str);
    }catch(Exception ex) {
      return new ValidationResult(getErrorMessage(allMessages, messages.unparsableDate()));
    }
   
    return null;
  }
View Full Code Here

    this.setCustomMsgKey(customMsgKey);
  }
 
  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str;
    if(text != null)
      str = text.getText();
    else str = suggest.getText();
    if(!isRequired() && str.equals(""))
      return null;
    str = str.trim();
    if(str.equals(""))
      return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
    if(!this.noMinMax) {
      //Integer in range
      try {
        long value = Long.parseLong(str);
        if(value < this.min || value > this.max) {
          return new ValidationResult(getErrorMessage(allMessages, messages.notInRange(this.min, this.max, value), this.min, this.max, value));
        }
      }catch(NumberFormatException ex) {
        return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
      }
    }else {
      //Any integer
      try {
        long value = Long.parseLong(str);
        if(value < Integer.MIN_VALUE || value > Integer.MAX_VALUE)
          return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
      }catch(NumberFormatException ex) {
        return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
      }
    }
   
    return null;
  }
View Full Code Here

    this.setCustomMsgKey(customMsgKey);
  }
 
  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str;
    if(text != null)
      str = text.getText();
    else str = suggest.getText();
    if(str == null)
      str = "";
    str = str.trim();
    if(str.equals("") && isRequired())
      return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
    else if(str.equals(""))
      return null;
    if(!this.noMinMax) {
      //Integer in range
      try {
        double value = Double.parseDouble(str);
        if(value < this.min || value > this.max) {
          return new ValidationResult(getErrorMessage(allMessages, messages.notInRange(this.min, this.max, value),this.min, this.max, value));
        }
      }catch(NumberFormatException ex) {
        return new ValidationResult(getErrorMessage(allMessages, messages.notAFloat()));
      }
    }else {
      //Any integer
      try {
        double value = Double.parseDouble(str);
        if(value > Float.MAX_VALUE || value < Float.MIN_VALUE)
          return new ValidationResult(getErrorMessage(allMessages, messages.notAFloat()));
      }catch(NumberFormatException ex) {
        return new ValidationResult(getErrorMessage(allMessages, messages.notAFloat()));
      }
    }
    return null;
  }
View Full Code Here

    this.setCustomMsgKey(customMsgKey);
  }
 
  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str;
    if(text != null)
      str = text.getText();
    else str = suggest.getText();
    if(!isRequired() && str.equals(""))
      return null;
    str = str.trim();
    if(str.equals(""))
      return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
    if(!this.noMinMax) {
      //Integer in range
      try {
        long value = Long.parseLong(str);
        if(value < this.min || value > this.max) {
          return new ValidationResult(getErrorMessage(allMessages, messages.notInRange(this.min, this.max, value), this.min, this.max, value));
        }
      }catch(NumberFormatException ex) {
        return new ValidationResult(getErrorMessage(allMessages, messages.notALong()));
      }
    }else {
      //Any integer
      try {
        long value = Long.parseLong(str);
      }catch(NumberFormatException ex) {
        return new ValidationResult(getErrorMessage(allMessages, messages.notALong()));
      }
    }
    return null;
  }
View Full Code Here

    this.setCustomMsgKey(customMsgKey);
  }
 
  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    String str;
    if(text != null)
      str = text.getText();
    else str = suggest.getText();
    if(str == null)
      str = "";
    str = str.trim();
    if(str.equals("") && isRequired())
      return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
    else if(str.equals(""))
      return null;
   
    try {
      double value = Double.parseDouble(str);
      if(!this.noMinMax) {
        if(value < this.min || value > this.max) {
          return new ValidationResult(getErrorMessage(allMessages, messages.notInRange(this.min, this.max, value),this.min, this.max, value));
        }
      }
    }catch(NumberFormatException ex) {
      return new ValidationResult(getErrorMessage(allMessages, messages.notADouble()));
    }
   
    return null;
  }
View Full Code Here

    //No actions will be invoked by a Transformer
  }

  @Override
  public ValidationResult validate(ValidationMessages allMessages) {
    StandardValidationMessages messages = allMessages.getStandardMessages();
    uppercase();
    // No validation errors will occur on a transformer
    return null;
  }
View Full Code Here

TOP

Related Classes of eu.maydu.gwt.validation.client.i18n.StandardValidationMessages

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.