Package com.jgoodies.validation

Examples of com.jgoodies.validation.ValidationResult


 
  private static final char[] ILLEGAL_CHARACTERS = { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':' };
 
  @Override
  public ValidationResult validate(JTextComponent comp) {
    ValidationResult result = new ValidationResult();
    if (comp.getText().length()==0){
      result.add(new SimpleValidationMessage("������ ������", Severity.ERROR, comp));
      return result;
    }
    for(int i=0; i<comp.getText().length(); i++){
      char ch = comp.getText().charAt(i);
      for(int j=0; j<ILLEGAL_CHARACTERS.length; j++){
        if (ch == ILLEGAL_CHARACTERS[j]){
          result.add(new SimpleValidationMessage("������������ ������="+ch, Severity.ERROR, comp));
          return result;
        }
      }
    }
    return result;
View Full Code Here


    this.severity = severity;
  }

  @Override
  public ValidationResult validate(JTextComponent comp) {
    ValidationResult result = new ValidationResult();
    File file = new File(comp.getText());
    if (severity==Severity.ERROR){
      if (!file.exists()||!file.isDirectory()) result.add(new SimpleValidationMessage("����� �� ������", Severity.ERROR, comp));
    }
    if (severity==Severity.WARNING){
      if (!file.exists()||!file.isDirectory()) result.add(new SimpleValidationMessage("����� �� ������. ����� ����� �������.", Severity.WARNING, comp));
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of com.jgoodies.validation.ValidationResult

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.