Package org.apache.tapestry5.internal

Examples of org.apache.tapestry5.internal.BeanValidationContext


        BeanModel model = mockBeanModel();
        Environment env = mockEnvironment();
        RegistrationData data = new RegistrationData();
        Messages messages = mockMessages();
        PropertyOverrides overrides = mockPropertyOverrides();
        BeanValidationContext beanValidationContext = newMock(BeanValidationContext.class);

        train_getBoundType(resources, "object", RegistrationData.class);

        train_createEditModel(source, RegistrationData.class, messages, model);
View Full Code Here


            }
        };

        environment.push(PropertyEditContext.class, context);
       
        BeanValidationContext beanValidationContext = environment.peek(BeanValidationContext.class);
       
        if(beanValidationContext != null)
        {
          beanValidationContext.setCurrentProperty(propertyName);
        }
    }
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

   
    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;
       
        Class<?> beanType = beanValidationContext.getBeanType();
        String[] path = currentProperty.split("\\.");
        BeanDescriptor beanDescriptor = validator.getConstraintsForClass(beanType);
       
        for (int i = 1; i < path.length - 1; i++)
        {
View Full Code Here

    {
        if (beanValidationDisabled) { 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

    protected void removePropertyNameFromBeanValidationContext()
    {
        if (beanValidationDisabled) { return; }

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

        if (beanValidationContext == null)
            return;

        beanValidationContext.setCurrentProperty(null);
    }
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.