1 15 package org.apache.tapestry.contrib.valid; 16 17 import org.apache.tapestry.valid.IValidator; 18 import org.apache.tapestry.valid.StringValidator; 19 import org.apache.tapestry.valid.ValidField; 20 21 78 79 public abstract class ValidatingTextField extends ValidField 80 { 81 public abstract int getMinimumLength(); 82 83 public abstract boolean isRequired(); 84 85 public abstract String getText(); 86 87 public abstract void setText(String value); 88 89 94 public Object getValue() 95 { 96 return getText(); 97 } 98 99 104 public void setValue(Object value) 105 { 106 setText((String ) value); 107 } 108 109 112 public IValidator getValidator() 113 { 114 StringValidator validator = new StringValidator(); 115 116 if (isParameterBound("required")) 117 validator.setRequired(isRequired()); 118 119 if (isParameterBound("minimumLength")) 120 validator.setMinimumLength(getMinimumLength()); 121 122 return validator; 123 } 124 } | Popular Tags |