Package org.apache.wicket.validation

Examples of org.apache.wicket.validation.ValidationError


            final DateTimeField dateTimeField = (DateTimeField) dateTimeComponents[0];

            if (!(dateTimeField.getDate() != null && dateTimeField.getHours() != null
                    && dateTimeField.getMinutes() != null)) {

                ValidationError ve = new ValidationError();
                ve.setVariables(DateTimeFormValidator.this.variablesMap());
                ve.addKey(resourceKey());
                dateTimeComponents[0].error((IValidationError) ve);
            }
        }
View Full Code Here


    {
      throw new IllegalArgumentException("Argument [[resourceKey]] cannot be null");
    }


    ValidationError error = new ValidationError().addMessageKey(resourceKey);
    final String defaultKey = getClass().getSimpleName();
    if (!resourceKey.equals(defaultKey))
    {
      error.addMessageKey(defaultKey);
    }

    error.setVariables(vars);
    validatable.error(error);
  }
View Full Code Here

    R value = getValue(validatable);
    final R min = getMinimum();
    final R max = getMaximum();
    if ((min != null && value.compareTo(min) < 0) || (max != null && value.compareTo(max) > 0))
    {
      ValidationError error = new ValidationError(this, getMode().getVariation());
      if (min != null)
      {
        error.setVariable("minimum", min);
      }
      if (max != null)
      {
        error.setVariable("maximum", max);
      }
      validatable.error(decorate(error, validatable));
    }
  }
View Full Code Here

  private static class ClassValidator implements IValidator<String>
  {
    @Override
    public void validate(IValidatable<String> validatable)
    {
      ValidationError error = new ValidationError();
      error.addKey("testError");
      validatable.error(error);
    }
View Full Code Here

  private static class InterfaceValidator implements IValidator<String>
  {
    @Override
    public void validate(IValidatable<String> validatable)
    {
      ValidationError error = new ValidationError();
      error.addKey("testError");
      validatable.error(error);
    }
View Full Code Here

      {
        convertedInput = convertValue(getInputAsArray());
      }
      catch (ConversionException e)
      {
        ValidationError error = new ValidationError();
        if (e.getResourceKey() != null)
        {
          error.addKey(e.getResourceKey());
        }
        if (e.getTargetType() != null)
        {
          error.addKey("ConversionError." + e.getTargetType().getSimpleName());
        }
        error.addKey("ConversionError");
        reportValidationError(e, error);
      }
    }
    else
    {
      final IConverter<T> converter = getConverter(getType());

      try
      {
        convertedInput = converter.convertToObject(getInput(), getLocale());
      }
      catch (ConversionException e)
      {
        ValidationError error = new ValidationError();
        if (e.getResourceKey() != null)
        {
          error.addKey(e.getResourceKey());
        }
        String simpleName = getType().getSimpleName();
        error.addKey("IConverter." + simpleName);
        error.addKey("IConverter");
        error.setVariable("type", simpleName);
        reportValidationError(e, error);
      }
    }
  }
View Full Code Here

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

  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

    {
      throw new IllegalArgumentException("Argument [[resourceKey]] cannot be null");
    }


    ValidationError error = new ValidationError().addMessageKey(resourceKey);
    final String defaultKey = getClass().getSimpleName();
    if (!resourceKey.equals(defaultKey))
    {
      error.addMessageKey(defaultKey);
    }

    error.setVariables(vars);
    validatable.error(error);
  }
View Full Code Here

    R value = getValue(validatable);
    final R min = getMinimum();
    final R max = getMaximum();
    if ((min != null && value.compareTo(min) < 0) || (max != null && value.compareTo(max) > 0))
    {
      ValidationError error = new ValidationError(this, getMode().getVariation());
      error.setVariable("minimum", min);
      error.setVariable("maximum", max);
      validatable.error(decorate(error, validatable));
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.validation.ValidationError

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.