Package org.apache.tapestry5.internal

Examples of org.apache.tapestry5.internal.BeanValidationContext


    protected void putPropertyNameIntoBeanValidationContext(String parameterName)
    {
        String propertyName = ((InternalComponentResources) resources).getPropertyName(parameterName);

        BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
            return;

        // If field is inside BeanEditForm, then property is already set
        if (beanValidationContext.getCurrentProperty() == null)
        {
            beanValidationContext.setCurrentProperty(propertyName);
        }
    }
View Full Code Here


        }
    }

    protected void removePropertyNameFromBeanValidationContext()
    {
        BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
            return;

        beanValidationContext.setCurrentProperty(null);
    }
View Full Code Here

            return;
        }

        String propertyName = ((InternalComponentResources) resources).getPropertyName(parameterName);

        BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
            return;

        // If field is inside BeanEditForm, then property is already set
        if (beanValidationContext.getCurrentProperty() == null)
        {
            beanValidationContext.setCurrentProperty(propertyName);
        }
    }
View Full Code Here

        if (beanValidationDisabled)
        {
            return;
        }

        BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
            return;

        beanValidationContext.setCurrentProperty(null);
    }
View Full Code Here

    }

    @Override
    public void render(final MarkupWriter writer)
    {
        final BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
        {
            return;
        }

        final Validator validator = validatorFactory.getValidator();

        final String currentProperty = beanValidationContext.getCurrentProperty();

        if (currentProperty == null) return;
       
        final ValidationInfo validationInfo = getValidationInfo(beanValidationContext, currentProperty, validator);
        final PropertyDescriptor propertyDescriptor = validationInfo.getPropertyDescriptor();
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public void validate(final Object value) throws ValidationException
    {

        final BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
        {
            return;
        }

        final Validator validator = validatorFactory.getValidator();

        String currentProperty = beanValidationContext.getCurrentProperty();

        if (currentProperty == null) return;
       
        final ValidationInfo validationInfo = getValidationInfo(beanValidationContext, currentProperty, validator);
        final PropertyDescriptor propertyDescriptor = validationInfo.getPropertyDescriptor();
View Full Code Here

    protected void putPropertyNameIntoBeanValidationContext(String parameterName)
    {
        String propertyName = ((InternalComponentResources) resources).getPropertyName(parameterName);

        BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
            return;

        // If field is inside BeanEditForm, then property is already set
        if (beanValidationContext.getCurrentProperty() == null)
        {
            beanValidationContext.setCurrentProperty(propertyName);
        }
    }
View Full Code Here

        }
    }

    protected void removePropertyNameFromBeanValidationContext()
    {
        BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

        if (beanValidationContext == null)
            return;

        beanValidationContext.setCurrentProperty(null);
    }
View Full Code Here

    return false;
  }

  public void render(final MarkupWriter writer)
  {
    final BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

    if (beanValidationContext == null)
    {
      return;
    }
   
    final Validator validator = validatorFactory.getValidator();
   
    BeanDescriptor beanDescriptor = validator.getConstraintsForClass(beanValidationContext.getBeanType());
   
    String currentProperty = beanValidationContext.getCurrentProperty();
   
    if(currentProperty == null) return;
   
    PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty(currentProperty);
   
View Full Code Here

  @SuppressWarnings("unchecked")
  public void validate(final Object value) throws ValidationException
  {

    final BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);

    if (beanValidationContext == null)
    {
      return;
    }
   
    final Validator validator = validatorFactory.getValidator();
   
    String currentProperty = beanValidationContext.getCurrentProperty();
   
    if(currentProperty == null) return;
   
    BeanDescriptor beanDescriptor = validator.getConstraintsForClass(beanValidationContext.getBeanType());
   
    PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty(currentProperty);
   
    if(propertyDescriptor == null) return;
   
    final Set<ConstraintViolation<Object>> violations = validator.validateValue(
            (Class<Object>) beanValidationContext.getBeanType(), currentProperty,
            value, beanValidationGroupSource.get());
   
    if (violations.isEmpty())
    {
      return;
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.internal.BeanValidationContext

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.