1 15 package org.apache.tapestry.contrib.valid; 16 17 import org.apache.tapestry.valid.IValidator; 18 import org.apache.tapestry.valid.NumberValidator; 19 import org.apache.tapestry.valid.ValidField; 20 21 98 99 public abstract class NumericField extends ValidField 100 { 101 public abstract Number getMinimum(); 102 103 public abstract Number getMaximum(); 104 105 public abstract boolean isRequired(); 106 107 public abstract String getType(); 108 109 112 113 public IValidator getValidator() 114 { 115 NumberValidator validator = new NumberValidator(); 116 117 if (isParameterBound("minimum")) 118 validator.setMinimum(getMinimum()); 119 120 if (isParameterBound("maximum")) 121 validator.setMaximum(getMaximum()); 122 123 if (isParameterBound("required")) 124 validator.setRequired(isRequired()); 125 126 if (isParameterBound("type")) 127 validator.setValueType(getType()); 128 129 return validator; 130 } 131 } | Popular Tags |