1 15 package org.apache.tapestry.contrib.valid; 16 17 import java.text.DateFormat ; 18 import java.util.Date ; 19 20 import org.apache.tapestry.valid.DateValidator; 21 import org.apache.tapestry.valid.IValidator; 22 import org.apache.tapestry.valid.ValidField; 23 24 100 101 public abstract class DateField extends ValidField 102 { 103 public abstract Date getDate(); 104 105 public abstract void setDate(Date date); 106 107 public abstract Date getMinimum(); 108 109 public abstract Date getMaximum(); 110 111 public abstract boolean isRequired(); 112 113 public abstract DateFormat getFormat(); 114 115 public abstract String getDisplayFormat(); 116 117 120 121 public IValidator getValidator() 122 { 123 DateValidator validator = new DateValidator(); 124 125 if (isParameterBound("minimum")) 126 validator.setMinimum(getMinimum()); 127 128 if (isParameterBound("maximum")) 129 validator.setMaximum(getMaximum()); 130 131 if (isParameterBound("required")) 132 validator.setRequired(isRequired()); 133 134 if (isParameterBound("format")) 135 validator.setFormat(getFormat()); 136 137 if (isParameterBound("displayFormat")) 138 validator.setDisplayFormat(getDisplayFormat()); 139 140 return validator; 141 } 142 143 146 public Object getValue() 147 { 148 return getDate(); 149 } 150 151 154 public void setValue(Object value) 155 { 156 setDate((Date ) value); 157 } 158 159 } | Popular Tags |