[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences ...

Christian Bauer christian at hibernate.org
Sat Aug 25 13:59:24 EDT 2007


  User: cbauer  
  Date: 07/08/25 13:59:24

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/preferences 
                        PreferenceProperty.java
  Log:
  Major refactoring of navigation
  
  Revision  Changes    Path
  1.5       +12 -0     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceProperty.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PreferenceProperty.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/preferences/PreferenceProperty.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- PreferenceProperty.java	17 Aug 2007 13:00:29 -0000	1.4
  +++ PreferenceProperty.java	25 Aug 2007 17:59:24 -0000	1.5
  @@ -6,6 +6,7 @@
   import org.hibernate.validator.InvalidValue;
   import org.hibernate.validator.ClassValidator;
   import org.hibernate.validator.InvalidStateException;
  +import org.hibernate.validator.Length;
   
   import java.lang.reflect.Method;
   import java.lang.reflect.Field;
  @@ -82,6 +83,17 @@
           }
       }
   
  +    public boolean isLongStringAllowed() {
  +        if (fieldAccess) {
  +            Field field = Reflections.getField(preferenceComponent.getComponent().getBeanClass(), getName());
  +            return field.getAnnotation(Length.class) != null && field.getAnnotation(Length.class).max() > 1000;
  +
  +        } else {
  +            Method setterMethod = Reflections.getSetterMethod(preferenceComponent.getComponent().getBeanClass(), getName());
  +            return setterMethod.getAnnotation(Length.class) != null && setterMethod.getAnnotation(Length.class).max() > 1000;
  +        }
  +    }
  +
       public InvalidValue[] validate(Component component, Object value) {
           ClassValidator validator = Validators.instance().getValidator( component.getBeanClass() );
           return validator.getPotentialInvalidValues( getName(), value );
  
  
  



More information about the jboss-cvs-commits mailing list