Examples of ValidationError


Examples of org.apache.wicket.validation.ValidationError

  /**
   * Reports required error against this component
   */
  private void reportRequiredError()
  {
    error(new ValidationError().addKey("Required"));
  }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

  public void validate(IValidatable<String> validatable)
  {
    String email = validatable.getValue().toString();
    if (email.length() != email.trim().length())
    {
      validatable.error(decorate(new ValidationError(this), validatable));
    }
    else if (!PATTERN.matcher(validatable.getValue()).matches())
    {
      validatable.error(decorate(new ValidationError(this), validatable));
    }
  }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

   *            the original cause
   * @return {@link ValidationError}
   */
  protected ValidationError newValidationError(ConversionException cause)
  {
    ValidationError error = new ValidationError(cause.getMessage());

    if (cause.getResourceKey() != null)
    {
      error.addKey(cause.getResourceKey());
    }

    if (typeName == null)
    {
      if (cause.getTargetType() != null)
      {
        error.addKey("ConversionError." + Classes.simpleName(cause.getTargetType()));
      }
      error.addKey("ConversionError");
    }
    else
    {
      String simpleName = Classes.simpleName(getType());
      error.addKey("IConverter." + simpleName);
      error.addKey("IConverter");
      error.setVariable("type", simpleName);
    }

    final Locale locale = cause.getLocale();
    if (locale != null)
    {
      error.setVariable("locale", locale);
    }

    error.setVariable("exception", cause);

    Format format = cause.getFormat();
    if (format instanceof SimpleDateFormat)
    {
      error.setVariable("format", ((SimpleDateFormat)format).toLocalizedPattern());
    }

    Map<String, Object> variables = cause.getVariables();
    if (variables != null)
    {
      error.getVariables().putAll(variables);
    }

    return error;
  }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

  /**
   * Reports required error against this component
   */
  protected void reportRequiredError()
  {
    error(new ValidationError().addKey("Required"));
  }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

  public void validate(IValidatable<String> validatable)
  {
    // Check value against pattern
    if (pattern.matcher(validatable.getValue()).matches() == reverse)
    {
      ValidationError error = new ValidationError(this);
      error.setVariable("pattern", pattern.pattern());
      validatable.error(decorate(error, validatable));
    }
  }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

  public void validate(IValidatable<String> validatable)
  {
    String url = validatable.getValue();
    if (!isValid(url))
    {
      validatable.error(decorate(new ValidationError(this), validatable));
    }
  }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

  {
    error = super.decorate(error, validatable);

    if (error instanceof ValidationError)
    {
      ValidationError ve = (ValidationError) error;
      ve.setVariable("inputdate", validatable.getValue());

      // format variables if format has been specified
      if (format != null)
      {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        if (getMinimum() != null)
        {
          ve.setVariable("minimum", sdf.format(getMinimum()));
        }
        if (getMaximum() != null)
        {
          ve.setVariable("maximum", sdf.format(getMaximum()));
        }
        ve.setVariable("inputdate", sdf.format(validatable.getValue()));
      }
    }

    return error;
  }
View Full Code Here

Examples of org.auraframework.util.validation.ValidationError

        CSSLintValidator validator = new CSSLintValidator();
        List<ValidationError> errors = validator.validate("input.css",
                ".mybox {\n\tborder: 1px solid black;\n\tpadding: 5px;\n\twidth: 100px;}", false);
        assertEquals(2, errors.size());
        ValidationError error = errors.get(0);
        assertEquals("input.css", error.getFilename());
        assertEquals(2, error.getLine());
        assertEquals(2, error.getStartColumn());
        assertEquals("csslint", error.getValidatingTool());
        assertEquals("Using width with border can sometimes make elements larger than you expect", error.getMessage());
        assertEquals("\tborder: 1px solid black;", error.getEvidence());
        assertEquals(Level.Warning, error.getLevel());
        assertEquals("box-model", error.getRule());

        // can rerun on the same validator
        errors = validator.validate("input2.css",
                ".mybox {\n\tborder: 2px solid black;\n\tpadding: 5px;\n\twidth: 100px;}", false);
        assertEquals(2, errors.size());
View Full Code Here

Examples of org.candlepin.policy.ValidationError

        Pool p = TestUtil.createPool(prod);

        ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.BIND);
        assertNotNull(results);
        assertEquals(0, results.getWarnings().size());
        ValidationError error = results.getErrors().get(0);
        assertEquals("rulefailed.cores.unsupported.by.consumer", error.getResourceKey());
    }
View Full Code Here

Examples of org.easybatch.core.api.ValidationError

        for (ConstraintViolation<T> constraintViolation : constraintViolationSet) {
            String validationErrorMessage = new StringBuilder()
                    .append("Invalid value '").append(constraintViolation.getInvalidValue()).append("' ")
                    .append("for property '").append(constraintViolation.getPropertyPath()).append("' : ")
                    .append(constraintViolation.getMessage()).toString();
            validationErrors.add(new ValidationError(validationErrorMessage));

        }

        return validationErrors;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.