Change-Id: If6212ff2b7da0e87b3c68a3372b5f0b5a2a55b1atags/8.0.0.alpha1
@@ -23,7 +23,7 @@ import java.util.Map; | |||
import com.vaadin.data.Item; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.util.BeanUtil; | |||
import com.vaadin.data.validator.BeanValidator; | |||
import com.vaadin.legacy.data.validator.LegacyBeanValidator; | |||
import com.vaadin.legacy.ui.LegacyField; | |||
public class BeanFieldGroup<T> extends FieldGroup { | |||
@@ -31,11 +31,11 @@ public class BeanFieldGroup<T> extends FieldGroup { | |||
private final Class<T> beanType; | |||
private static Boolean beanValidationImplementationAvailable = null; | |||
private final Map<LegacyField<?>, BeanValidator> defaultValidators; | |||
private final Map<LegacyField<?>, LegacyBeanValidator> defaultValidators; | |||
public BeanFieldGroup(Class<T> beanType) { | |||
this.beanType = beanType; | |||
this.defaultValidators = new HashMap<LegacyField<?>, BeanValidator>(); | |||
this.defaultValidators = new HashMap<LegacyField<?>, LegacyBeanValidator>(); | |||
} | |||
@Override | |||
@@ -165,7 +165,7 @@ public class BeanFieldGroup<T> extends FieldGroup { | |||
public void unbind(LegacyField<?> field) throws BindException { | |||
super.unbind(field); | |||
BeanValidator removed = defaultValidators.remove(field); | |||
LegacyBeanValidator removed = defaultValidators.remove(field); | |||
if (removed != null) { | |||
field.removeValidator(removed); | |||
} | |||
@@ -177,7 +177,7 @@ public class BeanFieldGroup<T> extends FieldGroup { | |||
// Add Bean validators if there are annotations | |||
if (isBeanValidationImplementationAvailable() | |||
&& !defaultValidators.containsKey(field)) { | |||
BeanValidator validator = new BeanValidator(beanType, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(beanType, | |||
getPropertyId(field).toString()); | |||
field.addValidator(validator); | |||
if (field.getLocale() != null) { |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* Validator base class for validating strings. | |||
@@ -28,7 +28,7 @@ package com.vaadin.data.validator; | |||
* @since 5.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public abstract class AbstractStringValidator extends AbstractValidator<String> { | |||
public abstract class LegacyAbstractStringValidator extends LegacyAbstractValidator<String> { | |||
/** | |||
* Constructs a validator for strings. | |||
@@ -42,7 +42,7 @@ public abstract class AbstractStringValidator extends AbstractValidator<String> | |||
* the message to be included in an {@link InvalidValueException} | |||
* (with "{0}" replaced by the value that failed validation). | |||
* */ | |||
public AbstractStringValidator(String errorMessage) { | |||
public LegacyAbstractStringValidator(String errorMessage) { | |||
super(errorMessage); | |||
} | |||
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import com.vaadin.legacy.data.Validator; | |||
@@ -44,7 +44,7 @@ import com.vaadin.legacy.data.Validator; | |||
* @author Vaadin Ltd. | |||
* @since 5.4 | |||
*/ | |||
public abstract class AbstractValidator<T> implements Validator { | |||
public abstract class LegacyAbstractValidator<T> implements Validator { | |||
/** | |||
* Error message that is included in an {@link InvalidValueException} if | |||
@@ -59,7 +59,7 @@ public abstract class AbstractValidator<T> implements Validator { | |||
* the message to be included in an {@link InvalidValueException} | |||
* (with "{0}" replaced by the value that failed validation). | |||
*/ | |||
public AbstractValidator(String errorMessage) { | |||
public LegacyAbstractValidator(String errorMessage) { | |||
this.errorMessage = errorMessage; | |||
} | |||
@@ -14,7 +14,7 @@ | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import java.io.Serializable; | |||
import java.util.Locale; | |||
@@ -44,7 +44,7 @@ import com.vaadin.legacy.data.Validator; | |||
* @author Petri Hakala | |||
* @author Henri Sara | |||
*/ | |||
public class BeanValidator implements Validator { | |||
public class LegacyBeanValidator implements Validator { | |||
private static final long serialVersionUID = 1L; | |||
private static ValidatorFactory factory; | |||
@@ -97,7 +97,7 @@ public class BeanValidator implements Validator { | |||
* @param propertyName | |||
* property to validate | |||
*/ | |||
public BeanValidator(Class<?> beanClass, String propertyName) { | |||
public LegacyBeanValidator(Class<?> beanClass, String propertyName) { | |||
this.beanClass = beanClass; | |||
this.propertyName = propertyName; | |||
locale = Locale.getDefault(); | |||
@@ -168,7 +168,7 @@ public class BeanValidator implements Validator { | |||
/** | |||
* Returns a shared Validator instance to use. An instance is created using | |||
* the validator factory if necessary and thereafter reused by the | |||
* {@link BeanValidator} instance. | |||
* {@link LegacyBeanValidator} instance. | |||
* | |||
* @return the JSR-303 {@link javax.validation.Validator} to use | |||
*/ |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import java.math.BigDecimal; | |||
@@ -24,7 +24,7 @@ import java.math.BigDecimal; | |||
* @since 7.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class BigDecimalRangeValidator extends RangeValidator<BigDecimal> { | |||
public class LegacyBigDecimalRangeValidator extends LegacyRangeValidator<BigDecimal> { | |||
/** | |||
* Creates a validator for checking that an BigDecimal is within a given | |||
@@ -42,7 +42,7 @@ public class BigDecimalRangeValidator extends RangeValidator<BigDecimal> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public BigDecimalRangeValidator(String errorMessage, BigDecimal minValue, | |||
public LegacyBigDecimalRangeValidator(String errorMessage, BigDecimal minValue, | |||
BigDecimal maxValue) { | |||
super(errorMessage, BigDecimal.class, minValue, maxValue); | |||
} |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import java.math.BigInteger; | |||
@@ -24,7 +24,7 @@ import java.math.BigInteger; | |||
* @since 7.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class BigIntegerRangeValidator extends RangeValidator<BigInteger> { | |||
public class LegacyBigIntegerRangeValidator extends LegacyRangeValidator<BigInteger> { | |||
/** | |||
* Creates a validator for checking that an BigInteger is within a given | |||
@@ -42,7 +42,7 @@ public class BigIntegerRangeValidator extends RangeValidator<BigInteger> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public BigIntegerRangeValidator(String errorMessage, BigInteger minValue, | |||
public LegacyBigIntegerRangeValidator(String errorMessage, BigInteger minValue, | |||
BigInteger maxValue) { | |||
super(errorMessage, BigInteger.class, minValue, maxValue); | |||
} |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* Validator for validating that an {@link Byte} is inside a given range. | |||
@@ -22,7 +22,7 @@ package com.vaadin.data.validator; | |||
* @since 7.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class ByteRangeValidator extends RangeValidator<Byte> { | |||
public class LegacyByteRangeValidator extends LegacyRangeValidator<Byte> { | |||
/** | |||
* Creates a validator for checking that an Byte is within a given range. | |||
@@ -39,7 +39,7 @@ public class ByteRangeValidator extends RangeValidator<Byte> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public ByteRangeValidator(String errorMessage, Byte minValue, Byte maxValue) { | |||
public LegacyByteRangeValidator(String errorMessage, Byte minValue, Byte maxValue) { | |||
super(errorMessage, Byte.class, minValue, maxValue); | |||
} | |||
@@ -14,7 +14,7 @@ | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import java.util.Collection; | |||
import java.util.HashSet; | |||
@@ -34,7 +34,7 @@ import com.vaadin.legacy.data.Validator; | |||
* @since 3.0 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class CompositeValidator implements Validator { | |||
public class LegacyCompositeValidator implements Validator { | |||
public enum CombinationMode { | |||
/** | |||
@@ -78,7 +78,7 @@ public class CompositeValidator implements Validator { | |||
* Construct a composite validator in <code>AND</code> mode without error | |||
* message. | |||
*/ | |||
public CompositeValidator() { | |||
public LegacyCompositeValidator() { | |||
this(CombinationMode.AND, ""); | |||
} | |||
@@ -88,7 +88,7 @@ public class CompositeValidator implements Validator { | |||
* @param mode | |||
* @param errorMessage | |||
*/ | |||
public CompositeValidator(CombinationMode mode, String errorMessage) { | |||
public LegacyCompositeValidator(CombinationMode mode, String errorMessage) { | |||
setErrorMessage(errorMessage); | |||
setMode(mode); | |||
} | |||
@@ -243,9 +243,9 @@ public class CompositeValidator implements Validator { | |||
if (validatorType.isAssignableFrom(v.getClass())) { | |||
found.add(v); | |||
} | |||
if (v instanceof CompositeValidator | |||
&& ((CompositeValidator) v).getMode() == MODE_AND) { | |||
final Collection<Validator> c = ((CompositeValidator) v) | |||
if (v instanceof LegacyCompositeValidator | |||
&& ((LegacyCompositeValidator) v).getMode() == MODE_AND) { | |||
final Collection<Validator> c = ((LegacyCompositeValidator) v) | |||
.getSubValidators(validatorType); | |||
if (c != null) { | |||
found.addAll(c); |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import java.util.Date; | |||
@@ -31,7 +31,7 @@ import com.vaadin.shared.ui.datefield.Resolution; | |||
* @author Vaadin Ltd. | |||
* @since 7.0 | |||
*/ | |||
public class DateRangeValidator extends RangeValidator<Date> { | |||
public class LegacyDateRangeValidator extends LegacyRangeValidator<Date> { | |||
/** | |||
* Creates a validator for checking that an Date is within a given range. | |||
@@ -53,7 +53,7 @@ public class DateRangeValidator extends RangeValidator<Date> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public DateRangeValidator(String errorMessage, Date minValue, | |||
public LegacyDateRangeValidator(String errorMessage, Date minValue, | |||
Date maxValue, Resolution resolution) { | |||
super(errorMessage, Date.class, minValue, maxValue); | |||
} |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* Validator for validating that a {@link Double} is inside a given range. | |||
@@ -22,7 +22,7 @@ package com.vaadin.data.validator; | |||
* @since 7.0 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class DoubleRangeValidator extends RangeValidator<Double> { | |||
public class LegacyDoubleRangeValidator extends LegacyRangeValidator<Double> { | |||
/** | |||
* Creates a validator for checking that an Double is within a given range. | |||
@@ -39,7 +39,7 @@ public class DoubleRangeValidator extends RangeValidator<Double> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public DoubleRangeValidator(String errorMessage, Double minValue, | |||
public LegacyDoubleRangeValidator(String errorMessage, Double minValue, | |||
Double maxValue) { | |||
super(errorMessage, Double.class, minValue, maxValue); | |||
} |
@@ -13,14 +13,14 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.converter.StringToDoubleConverter; | |||
/** | |||
* String validator for a double precision floating point number. See | |||
* {@link com.vaadin.data.validator.AbstractStringValidator} for more | |||
* {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more | |||
* information. | |||
* | |||
* @author Vaadin Ltd. | |||
@@ -31,7 +31,7 @@ import com.vaadin.data.util.converter.StringToDoubleConverter; | |||
*/ | |||
@Deprecated | |||
@SuppressWarnings("serial") | |||
public class DoubleValidator extends AbstractStringValidator { | |||
public class LegacyDoubleValidator extends LegacyAbstractStringValidator { | |||
/** | |||
* Creates a validator for checking that a string can be parsed as an | |||
@@ -40,11 +40,11 @@ public class DoubleValidator extends AbstractStringValidator { | |||
* @param errorMessage | |||
* the message to display in case the value does not validate. | |||
* @deprecated As of 7.0. Use a Double converter on the field instead and/or | |||
* use a {@link DoubleRangeValidator} for validating that the | |||
* use a {@link LegacyDoubleRangeValidator} for validating that the | |||
* value is inside a given range. | |||
*/ | |||
@Deprecated | |||
public DoubleValidator(String errorMessage) { | |||
public LegacyDoubleValidator(String errorMessage) { | |||
super(errorMessage); | |||
} | |||
@@ -13,14 +13,14 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* String validator for e-mail addresses. The e-mail address syntax is not | |||
* complete according to RFC 822 but handles the vast majority of valid e-mail | |||
* addresses correctly. | |||
* | |||
* See {@link com.vaadin.data.validator.AbstractStringValidator} for more | |||
* See {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more | |||
* information. | |||
* | |||
* <p> | |||
@@ -33,7 +33,7 @@ package com.vaadin.data.validator; | |||
* @since 5.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class EmailValidator extends RegexpValidator { | |||
public class LegacyEmailValidator extends LegacyRegexpValidator { | |||
/** | |||
* Creates a validator for checking that a string is a syntactically valid | |||
@@ -42,7 +42,7 @@ public class EmailValidator extends RegexpValidator { | |||
* @param errorMessage | |||
* the message to display in case the value does not validate. | |||
*/ | |||
public EmailValidator(String errorMessage) { | |||
public LegacyEmailValidator(String errorMessage) { | |||
super( | |||
"^([a-zA-Z0-9_\\.\\-+])+@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$", | |||
true, errorMessage); |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* Validator for validating that a {@link Float} is inside a given range. | |||
@@ -22,7 +22,7 @@ package com.vaadin.data.validator; | |||
* @since 7.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class FloatRangeValidator extends RangeValidator<Float> { | |||
public class LegacyFloatRangeValidator extends LegacyRangeValidator<Float> { | |||
/** | |||
* Creates a validator for checking that an Float is within a given range. | |||
@@ -39,7 +39,7 @@ public class FloatRangeValidator extends RangeValidator<Float> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public FloatRangeValidator(String errorMessage, Float minValue, | |||
public LegacyFloatRangeValidator(String errorMessage, Float minValue, | |||
Float maxValue) { | |||
super(errorMessage, Float.class, minValue, maxValue); | |||
} |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* Validator for validating that an {@link Integer} is inside a given range. | |||
@@ -22,7 +22,7 @@ package com.vaadin.data.validator; | |||
* @since 5.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class IntegerRangeValidator extends RangeValidator<Integer> { | |||
public class LegacyIntegerRangeValidator extends LegacyRangeValidator<Integer> { | |||
/** | |||
* Creates a validator for checking that an Integer is within a given range. | |||
@@ -39,7 +39,7 @@ public class IntegerRangeValidator extends RangeValidator<Integer> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public IntegerRangeValidator(String errorMessage, Integer minValue, | |||
public LegacyIntegerRangeValidator(String errorMessage, Integer minValue, | |||
Integer maxValue) { | |||
super(errorMessage, Integer.class, minValue, maxValue); | |||
} |
@@ -13,14 +13,14 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
/** | |||
* String validator for integers. See | |||
* {@link com.vaadin.data.validator.AbstractStringValidator} for more | |||
* {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more | |||
* information. | |||
* | |||
* @author Vaadin Ltd. | |||
@@ -31,7 +31,7 @@ import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
*/ | |||
@SuppressWarnings("serial") | |||
@Deprecated | |||
public class IntegerValidator extends AbstractStringValidator { | |||
public class LegacyIntegerValidator extends LegacyAbstractStringValidator { | |||
/** | |||
* Creates a validator for checking that a string can be parsed as an | |||
@@ -40,11 +40,11 @@ public class IntegerValidator extends AbstractStringValidator { | |||
* @param errorMessage | |||
* the message to display in case the value does not validate. | |||
* @deprecated As of 7.0. Use an Integer converter on the field instead | |||
* and/or use an {@link IntegerRangeValidator} for validating | |||
* and/or use an {@link LegacyIntegerRangeValidator} for validating | |||
* that the value is inside a given range. | |||
*/ | |||
@Deprecated | |||
public IntegerValidator(String errorMessage) { | |||
public LegacyIntegerValidator(String errorMessage) { | |||
super(errorMessage); | |||
} |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* Validator for validating that an {@link Long} is inside a given range. | |||
@@ -22,7 +22,7 @@ package com.vaadin.data.validator; | |||
* @since 7.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class LongRangeValidator extends RangeValidator<Long> { | |||
public class LegacyLongRangeValidator extends LegacyRangeValidator<Long> { | |||
/** | |||
* Creates a validator for checking that an Long is within a given range. | |||
@@ -39,7 +39,7 @@ public class LongRangeValidator extends RangeValidator<Long> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public LongRangeValidator(String errorMessage, Long minValue, Long maxValue) { | |||
public LegacyLongRangeValidator(String errorMessage, Long minValue, Long maxValue) { | |||
super(errorMessage, Long.class, minValue, maxValue); | |||
} | |||
@@ -14,7 +14,7 @@ | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import com.vaadin.legacy.data.Validator; | |||
@@ -26,7 +26,7 @@ import com.vaadin.legacy.data.Validator; | |||
* @since 3.0 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class NullValidator implements Validator { | |||
public class LegacyNullValidator implements Validator { | |||
private boolean onlyNullAllowed; | |||
@@ -40,7 +40,7 @@ public class NullValidator implements Validator { | |||
* @param onlyNullAllowed | |||
* Are only nulls allowed? | |||
*/ | |||
public NullValidator(String errorMessage, boolean onlyNullAllowed) { | |||
public LegacyNullValidator(String errorMessage, boolean onlyNullAllowed) { | |||
setErrorMessage(errorMessage); | |||
setNullAllowed(onlyNullAllowed); | |||
} |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* An base implementation for validating any objects that implement | |||
@@ -21,10 +21,10 @@ package com.vaadin.data.validator; | |||
* | |||
* Verifies that the value is of the given type and within the (optionally) | |||
* given limits. Typically you want to use a sub class of this like | |||
* {@link IntegerRangeValidator}, {@link DoubleRangeValidator} or | |||
* {@link DateRangeValidator} in applications. | |||
* {@link LegacyIntegerRangeValidator}, {@link LegacyDoubleRangeValidator} or | |||
* {@link LegacyDateRangeValidator} in applications. | |||
* <p> | |||
* Note that {@link RangeValidator} always accept null values. Make a field | |||
* Note that {@link LegacyRangeValidator} always accept null values. Make a field | |||
* required to ensure that no empty values are accepted or override | |||
* {@link #isValidValue(Comparable)}. | |||
* </p> | |||
@@ -35,7 +35,7 @@ package com.vaadin.data.validator; | |||
* @author Vaadin Ltd. | |||
* @since 7.0 | |||
*/ | |||
public class RangeValidator<T extends Comparable> extends AbstractValidator<T> { | |||
public class LegacyRangeValidator<T extends Comparable> extends LegacyAbstractValidator<T> { | |||
private T minValue = null; | |||
private boolean minValueIncluded = true; | |||
@@ -55,7 +55,7 @@ public class RangeValidator<T extends Comparable> extends AbstractValidator<T> { | |||
* @param maxValue | |||
* The maximum value that should be accepted or null for no limit | |||
*/ | |||
public RangeValidator(String errorMessage, Class<T> type, T minValue, | |||
public LegacyRangeValidator(String errorMessage, Class<T> type, T minValue, | |||
T maxValue) { | |||
super(errorMessage); | |||
this.type = type; |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
import java.util.regex.Matcher; | |||
import java.util.regex.Pattern; | |||
@@ -27,7 +27,7 @@ import java.util.regex.Pattern; | |||
* {@link java.util.regex.Pattern#sum} | |||
* </p> | |||
* <p> | |||
* See {@link com.vaadin.data.validator.AbstractStringValidator} for more | |||
* See {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more | |||
* information. | |||
* </p> | |||
* <p> | |||
@@ -40,7 +40,7 @@ import java.util.regex.Pattern; | |||
* @since 5.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class RegexpValidator extends AbstractStringValidator { | |||
public class LegacyRegexpValidator extends LegacyAbstractStringValidator { | |||
private Pattern pattern; | |||
private boolean complete; | |||
@@ -55,7 +55,7 @@ public class RegexpValidator extends AbstractStringValidator { | |||
* @param errorMessage | |||
* the message to display in case the value does not validate. | |||
*/ | |||
public RegexpValidator(String regexp, String errorMessage) { | |||
public LegacyRegexpValidator(String regexp, String errorMessage) { | |||
this(regexp, true, errorMessage); | |||
} | |||
@@ -71,7 +71,7 @@ public class RegexpValidator extends AbstractStringValidator { | |||
* @param errorMessage | |||
* the message to display in case the value does not validate. | |||
*/ | |||
public RegexpValidator(String regexp, boolean complete, String errorMessage) { | |||
public LegacyRegexpValidator(String regexp, boolean complete, String errorMessage) { | |||
super(errorMessage); | |||
pattern = Pattern.compile(regexp); | |||
this.complete = complete; |
@@ -13,7 +13,7 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* Validator for validating that an {@link Short} is inside a given range. | |||
@@ -22,7 +22,7 @@ package com.vaadin.data.validator; | |||
* @since 7.4 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class ShortRangeValidator extends RangeValidator<Short> { | |||
public class LegacyShortRangeValidator extends LegacyRangeValidator<Short> { | |||
/** | |||
* Creates a validator for checking that an Short is within a given range. | |||
@@ -39,7 +39,7 @@ public class ShortRangeValidator extends RangeValidator<Short> { | |||
* @param maxValue | |||
* The maximum value to accept or null for no limit | |||
*/ | |||
public ShortRangeValidator(String errorMessage, Short minValue, | |||
public LegacyShortRangeValidator(String errorMessage, Short minValue, | |||
Short maxValue) { | |||
super(errorMessage, Short.class, minValue, maxValue); | |||
} |
@@ -14,7 +14,7 @@ | |||
* the License. | |||
*/ | |||
package com.vaadin.data.validator; | |||
package com.vaadin.legacy.data.validator; | |||
/** | |||
* This <code>StringLengthValidator</code> is used to validate the length of | |||
@@ -24,7 +24,7 @@ package com.vaadin.data.validator; | |||
* @since 3.0 | |||
*/ | |||
@SuppressWarnings("serial") | |||
public class StringLengthValidator extends AbstractStringValidator { | |||
public class LegacyStringLengthValidator extends LegacyAbstractStringValidator { | |||
private Integer minLength = null; | |||
@@ -38,7 +38,7 @@ public class StringLengthValidator extends AbstractStringValidator { | |||
* @param errorMessage | |||
* the message to display in case the value does not validate. | |||
*/ | |||
public StringLengthValidator(String errorMessage) { | |||
public LegacyStringLengthValidator(String errorMessage) { | |||
super(errorMessage); | |||
} | |||
@@ -60,7 +60,7 @@ public class StringLengthValidator extends AbstractStringValidator { | |||
* Are null strings permissible? This can be handled better by | |||
* setting a field as required or not. | |||
*/ | |||
public StringLengthValidator(String errorMessage, Integer minLength, | |||
public LegacyStringLengthValidator(String errorMessage, Integer minLength, | |||
Integer maxLength, boolean allowNull) { | |||
this(errorMessage); | |||
setMinLength(minLength); |
@@ -30,7 +30,6 @@ import org.jsoup.nodes.Element; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.validator.DateRangeValidator; | |||
import com.vaadin.event.FieldEvents; | |||
import com.vaadin.event.FieldEvents.BlurEvent; | |||
import com.vaadin.event.FieldEvents.BlurListener; | |||
@@ -38,6 +37,7 @@ import com.vaadin.event.FieldEvents.FocusEvent; | |||
import com.vaadin.event.FieldEvents.FocusListener; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.Validator.InvalidValueException; | |||
import com.vaadin.legacy.data.validator.LegacyDateRangeValidator; | |||
import com.vaadin.legacy.ui.LegacyAbstractField; | |||
import com.vaadin.legacy.ui.LegacyField; | |||
import com.vaadin.server.PaintException; | |||
@@ -158,7 +158,7 @@ public class DateField extends LegacyAbstractField<Date> implements | |||
private String dateOutOfRangeMessage = "Date is out of allowed range"; | |||
private DateRangeValidator currentRangeValidator; | |||
private LegacyDateRangeValidator currentRangeValidator; | |||
/** | |||
* Determines whether the ValueChangeEvent should be fired. Used to prevent | |||
@@ -421,7 +421,7 @@ public class DateField extends LegacyAbstractField<Date> implements | |||
currentRangeValidator = null; | |||
} | |||
if (getRangeStart() != null || getRangeEnd() != null) { | |||
currentRangeValidator = new DateRangeValidator( | |||
currentRangeValidator = new LegacyDateRangeValidator( | |||
dateOutOfRangeMessage, getRangeStart(resolution), | |||
getRangeEnd(resolution), null); | |||
addValidator(currentRangeValidator); |
@@ -5,17 +5,17 @@ import java.math.BigDecimal; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.BigDecimalRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyBigDecimalRangeValidator; | |||
public class BigDecimalRangeValidatorTest { | |||
private BigDecimalRangeValidator cleanValidator = new BigDecimalRangeValidator( | |||
private LegacyBigDecimalRangeValidator cleanValidator = new LegacyBigDecimalRangeValidator( | |||
"no values", null, null); | |||
private BigDecimalRangeValidator minValidator = new BigDecimalRangeValidator( | |||
private LegacyBigDecimalRangeValidator minValidator = new LegacyBigDecimalRangeValidator( | |||
"no values", new BigDecimal(10.1), null); | |||
private BigDecimalRangeValidator maxValidator = new BigDecimalRangeValidator( | |||
private LegacyBigDecimalRangeValidator maxValidator = new LegacyBigDecimalRangeValidator( | |||
"no values", null, new BigDecimal(100.1)); | |||
private BigDecimalRangeValidator minMaxValidator = new BigDecimalRangeValidator( | |||
private LegacyBigDecimalRangeValidator minMaxValidator = new LegacyBigDecimalRangeValidator( | |||
"no values", new BigDecimal(10.5), new BigDecimal(100.5)); | |||
@Test |
@@ -5,17 +5,17 @@ import java.math.BigInteger; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.BigIntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyBigIntegerRangeValidator; | |||
public class BigIntegerRangeValidatorTest { | |||
private BigIntegerRangeValidator cleanValidator = new BigIntegerRangeValidator( | |||
private LegacyBigIntegerRangeValidator cleanValidator = new LegacyBigIntegerRangeValidator( | |||
"no values", null, null); | |||
private BigIntegerRangeValidator minValidator = new BigIntegerRangeValidator( | |||
private LegacyBigIntegerRangeValidator minValidator = new LegacyBigIntegerRangeValidator( | |||
"no values", BigInteger.valueOf(10), null); | |||
private BigIntegerRangeValidator maxValidator = new BigIntegerRangeValidator( | |||
private LegacyBigIntegerRangeValidator maxValidator = new LegacyBigIntegerRangeValidator( | |||
"no values", null, BigInteger.valueOf(100)); | |||
private BigIntegerRangeValidator minMaxValidator = new BigIntegerRangeValidator( | |||
private LegacyBigIntegerRangeValidator minMaxValidator = new LegacyBigIntegerRangeValidator( | |||
"no values", BigInteger.valueOf(10), BigInteger.valueOf(100)); | |||
@Test |
@@ -5,17 +5,17 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.ByteRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyByteRangeValidator; | |||
public class ByteRangeValidatorTest { | |||
private ByteRangeValidator cleanValidator = new ByteRangeValidator( | |||
private LegacyByteRangeValidator cleanValidator = new LegacyByteRangeValidator( | |||
"no values", null, null); | |||
private ByteRangeValidator minValidator = new ByteRangeValidator( | |||
private LegacyByteRangeValidator minValidator = new LegacyByteRangeValidator( | |||
"no values", (byte) 10, null); | |||
private ByteRangeValidator maxValidator = new ByteRangeValidator( | |||
private LegacyByteRangeValidator maxValidator = new LegacyByteRangeValidator( | |||
"no values", null, (byte) 100); | |||
private ByteRangeValidator minMaxValidator = new ByteRangeValidator( | |||
private LegacyByteRangeValidator minMaxValidator = new LegacyByteRangeValidator( | |||
"no values", (byte) 10, (byte) 100); | |||
@Test |
@@ -8,20 +8,20 @@ import static org.junit.Assert.fail; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.CompositeValidator; | |||
import com.vaadin.data.validator.CompositeValidator.CombinationMode; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.data.validator.EmailValidator; | |||
import com.vaadin.data.validator.RegexpValidator; | |||
import com.vaadin.legacy.data.validator.LegacyCompositeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyEmailValidator; | |||
import com.vaadin.legacy.data.validator.LegacyRegexpValidator; | |||
import com.vaadin.legacy.data.validator.LegacyCompositeValidator.CombinationMode; | |||
public class CompositeValidatorTest { | |||
CompositeValidator and = new CompositeValidator(CombinationMode.AND, | |||
LegacyCompositeValidator and = new LegacyCompositeValidator(CombinationMode.AND, | |||
"One validator not valid"); | |||
CompositeValidator or = new CompositeValidator(CombinationMode.OR, | |||
LegacyCompositeValidator or = new LegacyCompositeValidator(CombinationMode.OR, | |||
"No validators are valid"); | |||
EmailValidator email = new EmailValidator("Faulty email"); | |||
RegexpValidator regex = new RegexpValidator("@mail.com", false, | |||
LegacyEmailValidator email = new LegacyEmailValidator("Faulty email"); | |||
LegacyRegexpValidator regex = new LegacyRegexpValidator("@mail.com", false, | |||
"Partial match validator error"); | |||
@Before |
@@ -11,7 +11,7 @@ import java.util.TimeZone; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.DateRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyDateRangeValidator; | |||
import com.vaadin.shared.ui.datefield.Resolution; | |||
public class DateRangeValidatorTest { | |||
@@ -20,23 +20,23 @@ public class DateRangeValidatorTest { | |||
Calendar endDate = new GregorianCalendar(TimeZone.getTimeZone("GMT"), | |||
Locale.ENGLISH); | |||
private DateRangeValidator cleanValidator; | |||
private DateRangeValidator minValidator; | |||
private DateRangeValidator maxValidator; | |||
private DateRangeValidator minMaxValidator; | |||
private LegacyDateRangeValidator cleanValidator; | |||
private LegacyDateRangeValidator minValidator; | |||
private LegacyDateRangeValidator maxValidator; | |||
private LegacyDateRangeValidator minMaxValidator; | |||
@Before | |||
public void setUp() { | |||
startDate.set(2000, Calendar.JANUARY, 1, 12, 0, 0); | |||
endDate.set(2000, Calendar.FEBRUARY, 20, 12, 0, 0); | |||
cleanValidator = new DateRangeValidator("Given date outside range", | |||
cleanValidator = new LegacyDateRangeValidator("Given date outside range", | |||
null, null, Resolution.DAY); | |||
minValidator = new DateRangeValidator("Given date before startDate", | |||
minValidator = new LegacyDateRangeValidator("Given date before startDate", | |||
startDate.getTime(), null, Resolution.DAY); | |||
maxValidator = new DateRangeValidator("Given date after endDate", null, | |||
maxValidator = new LegacyDateRangeValidator("Given date after endDate", null, | |||
endDate.getTime(), Resolution.DAY); | |||
minMaxValidator = new DateRangeValidator("Given date outside range", | |||
minMaxValidator = new LegacyDateRangeValidator("Given date outside range", | |||
startDate.getTime(), endDate.getTime(), Resolution.DAY); | |||
} | |||
@@ -5,17 +5,17 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.DoubleRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyDoubleRangeValidator; | |||
public class DoubleRangeValidatorTest { | |||
private DoubleRangeValidator cleanValidator = new DoubleRangeValidator( | |||
private LegacyDoubleRangeValidator cleanValidator = new LegacyDoubleRangeValidator( | |||
"no values", null, null); | |||
private DoubleRangeValidator minValidator = new DoubleRangeValidator( | |||
private LegacyDoubleRangeValidator minValidator = new LegacyDoubleRangeValidator( | |||
"no values", 10.1, null); | |||
private DoubleRangeValidator maxValidator = new DoubleRangeValidator( | |||
private LegacyDoubleRangeValidator maxValidator = new LegacyDoubleRangeValidator( | |||
"no values", null, 100.1); | |||
private DoubleRangeValidator minMaxValidator = new DoubleRangeValidator( | |||
private LegacyDoubleRangeValidator minMaxValidator = new LegacyDoubleRangeValidator( | |||
"no values", 10.5, 100.5); | |||
@Test |
@@ -3,11 +3,11 @@ package com.vaadin.tests.data.validator; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.EmailValidator; | |||
import com.vaadin.legacy.data.validator.LegacyEmailValidator; | |||
public class EmailValidatorTest { | |||
private EmailValidator validator = new EmailValidator("Error"); | |||
private LegacyEmailValidator validator = new LegacyEmailValidator("Error"); | |||
@Test | |||
public void testEmailValidatorWithNull() { |
@@ -5,17 +5,17 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.FloatRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyFloatRangeValidator; | |||
public class FloatRangeValidatorTest { | |||
private FloatRangeValidator cleanValidator = new FloatRangeValidator( | |||
private LegacyFloatRangeValidator cleanValidator = new LegacyFloatRangeValidator( | |||
"no values", null, null); | |||
private FloatRangeValidator minValidator = new FloatRangeValidator( | |||
private LegacyFloatRangeValidator minValidator = new LegacyFloatRangeValidator( | |||
"no values", 10.1f, null); | |||
private FloatRangeValidator maxValidator = new FloatRangeValidator( | |||
private LegacyFloatRangeValidator maxValidator = new LegacyFloatRangeValidator( | |||
"no values", null, 100.1f); | |||
private FloatRangeValidator minMaxValidator = new FloatRangeValidator( | |||
private LegacyFloatRangeValidator minMaxValidator = new LegacyFloatRangeValidator( | |||
"no values", 10.5f, 100.5f); | |||
@Test |
@@ -5,17 +5,17 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
public class IntegerRangeValidatorTest { | |||
private IntegerRangeValidator cleanValidator = new IntegerRangeValidator( | |||
private LegacyIntegerRangeValidator cleanValidator = new LegacyIntegerRangeValidator( | |||
"no values", null, null); | |||
private IntegerRangeValidator minValidator = new IntegerRangeValidator( | |||
private LegacyIntegerRangeValidator minValidator = new LegacyIntegerRangeValidator( | |||
"no values", 10, null); | |||
private IntegerRangeValidator maxValidator = new IntegerRangeValidator( | |||
private LegacyIntegerRangeValidator maxValidator = new LegacyIntegerRangeValidator( | |||
"no values", null, 100); | |||
private IntegerRangeValidator minMaxValidator = new IntegerRangeValidator( | |||
private LegacyIntegerRangeValidator minMaxValidator = new LegacyIntegerRangeValidator( | |||
"no values", 10, 100); | |||
@Test |
@@ -5,17 +5,17 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.LongRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyLongRangeValidator; | |||
public class LongRangeValidatorTest { | |||
private LongRangeValidator cleanValidator = new LongRangeValidator( | |||
private LegacyLongRangeValidator cleanValidator = new LegacyLongRangeValidator( | |||
"no values", null, null); | |||
private LongRangeValidator minValidator = new LongRangeValidator( | |||
private LegacyLongRangeValidator minValidator = new LegacyLongRangeValidator( | |||
"no values", 10l, null); | |||
private LongRangeValidator maxValidator = new LongRangeValidator( | |||
private LegacyLongRangeValidator maxValidator = new LegacyLongRangeValidator( | |||
"no values", null, 100l); | |||
private LongRangeValidator minMaxValidator = new LongRangeValidator( | |||
private LegacyLongRangeValidator minMaxValidator = new LegacyLongRangeValidator( | |||
"no values", 10l, 100l); | |||
@Test |
@@ -5,13 +5,13 @@ import static org.junit.Assert.fail; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.NullValidator; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.validator.LegacyNullValidator; | |||
public class NullValidatorTest { | |||
NullValidator notNull = new NullValidator("Null not accepted", false); | |||
NullValidator onlyNull = new NullValidator("Only null accepted", true); | |||
LegacyNullValidator notNull = new LegacyNullValidator("Null not accepted", false); | |||
LegacyNullValidator onlyNull = new LegacyNullValidator("Only null accepted", true); | |||
@Test | |||
public void testNullValue() { |
@@ -5,13 +5,13 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.RegexpValidator; | |||
import com.vaadin.legacy.data.validator.LegacyRegexpValidator; | |||
public class RegexpValidatorTest { | |||
private RegexpValidator completeValidator = new RegexpValidator("pattern", | |||
private LegacyRegexpValidator completeValidator = new LegacyRegexpValidator("pattern", | |||
true, "Complete match validator error"); | |||
private RegexpValidator partialValidator = new RegexpValidator("pattern", | |||
private LegacyRegexpValidator partialValidator = new LegacyRegexpValidator("pattern", | |||
false, "Partial match validator error"); | |||
@Test |
@@ -5,17 +5,17 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.ShortRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyShortRangeValidator; | |||
public class ShortRangeValidatorTest { | |||
private ShortRangeValidator cleanValidator = new ShortRangeValidator( | |||
private LegacyShortRangeValidator cleanValidator = new LegacyShortRangeValidator( | |||
"no values", null, null); | |||
private ShortRangeValidator minValidator = new ShortRangeValidator( | |||
private LegacyShortRangeValidator minValidator = new LegacyShortRangeValidator( | |||
"no values", (short) 10, null); | |||
private ShortRangeValidator maxValidator = new ShortRangeValidator( | |||
private LegacyShortRangeValidator maxValidator = new LegacyShortRangeValidator( | |||
"no values", null, (short) 100); | |||
private ShortRangeValidator minMaxValidator = new ShortRangeValidator( | |||
private LegacyShortRangeValidator minMaxValidator = new LegacyShortRangeValidator( | |||
"no values", (short) 10, (short) 100); | |||
@Test |
@@ -5,16 +5,16 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
public class StringLengthValidatorTest { | |||
private StringLengthValidator validator = new StringLengthValidator("Error"); | |||
private StringLengthValidator validatorNoNull = new StringLengthValidator( | |||
private LegacyStringLengthValidator validator = new LegacyStringLengthValidator("Error"); | |||
private LegacyStringLengthValidator validatorNoNull = new LegacyStringLengthValidator( | |||
"Error", 1, 5, false); | |||
private StringLengthValidator validatorMinValue = new StringLengthValidator( | |||
private LegacyStringLengthValidator validatorMinValue = new LegacyStringLengthValidator( | |||
"Error", 5, null, true); | |||
private StringLengthValidator validatorMaxValue = new StringLengthValidator( | |||
private LegacyStringLengthValidator validatorMaxValue = new LegacyStringLengthValidator( | |||
"Error", null, 15, true); | |||
@Test |
@@ -15,7 +15,7 @@ import com.vaadin.data.Item; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.IndexedContainer; | |||
import com.vaadin.data.util.MethodProperty; | |||
import com.vaadin.data.validator.RegexpValidator; | |||
import com.vaadin.legacy.data.validator.LegacyRegexpValidator; | |||
import com.vaadin.server.VaadinSession; | |||
import com.vaadin.ui.Form; | |||
@@ -23,9 +23,9 @@ public class SerializationTest { | |||
@Test | |||
public void testValidators() throws Exception { | |||
RegexpValidator validator = new RegexpValidator(".*", "Error"); | |||
LegacyRegexpValidator validator = new LegacyRegexpValidator(".*", "Error"); | |||
validator.validate("aaa"); | |||
RegexpValidator validator2 = serializeAndDeserialize(validator); | |||
LegacyRegexpValidator validator2 = serializeAndDeserialize(validator); | |||
validator2.validate("aaa"); | |||
} | |||
@@ -4,7 +4,7 @@ import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.validator.RangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyRangeValidator; | |||
import com.vaadin.tests.data.converter.ConverterFactoryTest.ConvertTo42; | |||
import com.vaadin.ui.TextField; | |||
@@ -25,7 +25,7 @@ public class TextFieldWithConverterAndValidatorTest { | |||
field.setConverter(new ConvertTo42()); | |||
field.setPropertyDataSource(property); | |||
field.addValidator(new RangeValidator<Integer>("Incorrect value", | |||
field.addValidator(new LegacyRangeValidator<Integer>("Incorrect value", | |||
Integer.class, 42, 42)); | |||
// succeeds |
@@ -6,11 +6,11 @@ import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.validator.EmailValidator; | |||
import com.vaadin.data.validator.RegexpValidator; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.Validator.InvalidValueException; | |||
import com.vaadin.legacy.data.validator.LegacyEmailValidator; | |||
import com.vaadin.legacy.data.validator.LegacyRegexpValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.ui.TextField; | |||
public class TextFieldWithValidatorTest { | |||
@@ -29,9 +29,9 @@ public class TextFieldWithValidatorTest { | |||
@Test | |||
public void testMultipleValidators() { | |||
field.addValidator(new StringLengthValidator( | |||
field.addValidator(new LegacyStringLengthValidator( | |||
"Length not between 1 and 3", 1, 3, false)); | |||
field.addValidator(new StringLengthValidator( | |||
field.addValidator(new LegacyStringLengthValidator( | |||
"Length not between 2 and 4", 2, 4, false)); | |||
// fails | |||
@@ -54,9 +54,9 @@ public class TextFieldWithValidatorTest { | |||
@Test | |||
public void testRemoveValidator() { | |||
Validator validator1 = new StringLengthValidator( | |||
Validator validator1 = new LegacyStringLengthValidator( | |||
"Length not between 1 and 3", 1, 3, false); | |||
Validator validator2 = new StringLengthValidator( | |||
Validator validator2 = new LegacyStringLengthValidator( | |||
"Length not between 2 and 4", 2, 4, false); | |||
field.addValidator(validator1); | |||
@@ -78,9 +78,9 @@ public class TextFieldWithValidatorTest { | |||
@Test | |||
public void testRemoveAllValidators() { | |||
Validator validator1 = new StringLengthValidator( | |||
Validator validator1 = new LegacyStringLengthValidator( | |||
"Length not between 1 and 3", 1, 3, false); | |||
Validator validator2 = new StringLengthValidator( | |||
Validator validator2 = new LegacyStringLengthValidator( | |||
"Length not between 2 and 4", 2, 4, false); | |||
field.addValidator(validator1); | |||
@@ -95,7 +95,7 @@ public class TextFieldWithValidatorTest { | |||
@Test | |||
public void testEmailValidator() { | |||
field.addValidator(new EmailValidator("Invalid e-mail address")); | |||
field.addValidator(new LegacyEmailValidator("Invalid e-mail address")); | |||
// not required | |||
@@ -152,7 +152,7 @@ public class TextFieldWithValidatorTest { | |||
@Test | |||
public void testRegexpValidator() { | |||
field.addValidator(new RegexpValidator("pattern", true, | |||
field.addValidator(new LegacyRegexpValidator("pattern", true, | |||
"Validation failed")); | |||
field.setRequired(false); | |||
@@ -4,55 +4,55 @@ import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.fieldgroup.BeanFieldGroup; | |||
import com.vaadin.data.validator.BeanValidator; | |||
import com.vaadin.legacy.data.Validator.InvalidValueException; | |||
import com.vaadin.legacy.data.validator.LegacyBeanValidator; | |||
import com.vaadin.legacy.ui.LegacyField; | |||
import com.vaadin.tests.data.bean.BeanToValidate; | |||
public class BeanValidationTest { | |||
@Test(expected = InvalidValueException.class) | |||
public void testBeanValidationNull() { | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, | |||
"firstname"); | |||
validator.validate(null); | |||
} | |||
@Test(expected = InvalidValueException.class) | |||
public void testBeanValidationStringTooShort() { | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, | |||
"firstname"); | |||
validator.validate("aa"); | |||
} | |||
@Test | |||
public void testBeanValidationStringOk() { | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, | |||
"firstname"); | |||
validator.validate("aaa"); | |||
} | |||
@Test(expected = InvalidValueException.class) | |||
public void testBeanValidationIntegerTooSmall() { | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, "age"); | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, "age"); | |||
validator.validate(17); | |||
} | |||
@Test | |||
public void testBeanValidationIntegerOk() { | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, "age"); | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, "age"); | |||
validator.validate(18); | |||
} | |||
@Test(expected = InvalidValueException.class) | |||
public void testBeanValidationTooManyDigits() { | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, | |||
"decimals"); | |||
validator.validate("1234.567"); | |||
} | |||
@Test | |||
public void testBeanValidationDigitsOk() { | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, | |||
"decimals"); | |||
validator.validate("123.45"); | |||
} | |||
@@ -60,7 +60,7 @@ public class BeanValidationTest { | |||
@Test | |||
public void testBeanValidationException_OneValidationError() { | |||
InvalidValueException[] causes = null; | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, | |||
"lastname"); | |||
try { | |||
validator.validate(null); | |||
@@ -74,7 +74,7 @@ public class BeanValidationTest { | |||
@Test | |||
public void testBeanValidationsException_TwoValidationErrors() { | |||
InvalidValueException[] causes = null; | |||
BeanValidator validator = new BeanValidator(BeanToValidate.class, | |||
LegacyBeanValidator validator = new LegacyBeanValidator(BeanToValidate.class, | |||
"nickname"); | |||
try { | |||
validator.validate("A"); |
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertTrue; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
public class RangeValidatorTest { | |||
@@ -14,7 +14,7 @@ public class RangeValidatorTest { | |||
// RangeValidator | |||
@Test | |||
public void testMinValueNonInclusive() { | |||
IntegerRangeValidator iv = new IntegerRangeValidator("Failed", 0, 10); | |||
LegacyIntegerRangeValidator iv = new LegacyIntegerRangeValidator("Failed", 0, 10); | |||
iv.setMinValueIncluded(false); | |||
assertFalse(iv.isValid(0)); | |||
assertTrue(iv.isValid(10)); | |||
@@ -24,7 +24,7 @@ public class RangeValidatorTest { | |||
@Test | |||
public void testMinMaxValuesInclusive() { | |||
IntegerRangeValidator iv = new IntegerRangeValidator("Failed", 0, 10); | |||
LegacyIntegerRangeValidator iv = new LegacyIntegerRangeValidator("Failed", 0, 10); | |||
assertTrue(iv.isValid(0)); | |||
assertTrue(iv.isValid(1)); | |||
assertTrue(iv.isValid(10)); | |||
@@ -34,7 +34,7 @@ public class RangeValidatorTest { | |||
@Test | |||
public void testMaxValueNonInclusive() { | |||
IntegerRangeValidator iv = new IntegerRangeValidator("Failed", 0, 10); | |||
LegacyIntegerRangeValidator iv = new LegacyIntegerRangeValidator("Failed", 0, 10); | |||
iv.setMaxValueIncluded(false); | |||
assertTrue(iv.isValid(0)); | |||
assertTrue(iv.isValid(9)); | |||
@@ -45,7 +45,7 @@ public class RangeValidatorTest { | |||
@Test | |||
public void testMinMaxValuesNonInclusive() { | |||
IntegerRangeValidator iv = new IntegerRangeValidator("Failed", 0, 10); | |||
LegacyIntegerRangeValidator iv = new LegacyIntegerRangeValidator("Failed", 0, 10); | |||
iv.setMinValueIncluded(false); | |||
iv.setMaxValueIncluded(false); | |||
@@ -2,7 +2,7 @@ package com.vaadin.tests.server.validation; | |||
import org.junit.Test; | |||
import com.vaadin.data.validator.IntegerValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerValidator; | |||
import com.vaadin.ui.TextField; | |||
public class ReadOnlyValidationTest { | |||
@@ -10,7 +10,7 @@ public class ReadOnlyValidationTest { | |||
@Test | |||
public void testIntegerValidation() { | |||
TextField field = new TextField(); | |||
field.addValidator(new IntegerValidator("Enter a Valid Number")); | |||
field.addValidator(new LegacyIntegerValidator("Enter a Valid Number")); | |||
field.setValue(String.valueOf(10)); | |||
field.validate(); | |||
} |
@@ -2,7 +2,7 @@ package com.vaadin.tests.components; | |||
import com.vaadin.annotations.Viewport; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.ui.Label; | |||
import com.vaadin.ui.TextField; | |||
@@ -26,7 +26,7 @@ public class TouchDevicesTooltip extends AbstractTestUI { | |||
private void createTextField(int n) { | |||
TextField textField = new TextField("Value" + n); | |||
textField.setConverter(new StringToIntegerConverter()); | |||
textField.addValidator(new IntegerRangeValidator(getErrorMessage(n), 0, | |||
textField.addValidator(new LegacyIntegerRangeValidator(getErrorMessage(n), 0, | |||
100)); | |||
textField.setImmediate(true); | |||
textField.setValue("-5"); |
@@ -1,7 +1,7 @@ | |||
package com.vaadin.tests.components.abstractfield; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
@@ -27,7 +27,7 @@ public class AbstractFieldCommitWithInvalidValues extends TestBase { | |||
protected void setup() { | |||
tf = new TextField("A field, must contain 1-2 chars", | |||
new ObjectProperty<String>("a")); | |||
tf.addValidator(new StringLengthValidator("Invalid length", 1, 2, false)); | |||
tf.addValidator(new LegacyStringLengthValidator("Invalid length", 1, 2, false)); | |||
tf.setBuffered(true); | |||
tf.setRequired(true); | |||
@@ -3,8 +3,8 @@ package com.vaadin.tests.components.abstractfield; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.validator.DoubleValidator; | |||
import com.vaadin.data.validator.IntegerValidator; | |||
import com.vaadin.legacy.data.validator.LegacyDoubleValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerValidator; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.tests.util.Log; | |||
import com.vaadin.ui.TextField; | |||
@@ -18,13 +18,13 @@ public class IntegerDoubleFieldsWithDataSource extends TestBase { | |||
addComponent(log); | |||
TextField tf = createIntegerTextField(); | |||
tf.addValidator(new IntegerValidator("Must be an Integer")); | |||
tf.addValidator(new LegacyIntegerValidator("Must be an Integer")); | |||
addComponent(tf); | |||
tf = createIntegerTextField(); | |||
tf.setCaption("Enter a double"); | |||
tf.setPropertyDataSource(new ObjectProperty<Double>(2.1)); | |||
tf.addValidator(new DoubleValidator("Must be a Double")); | |||
tf.addValidator(new LegacyDoubleValidator("Must be a Double")); | |||
addComponent(tf); | |||
} | |||
@@ -6,7 +6,7 @@ import java.util.Locale; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.validator.RangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyRangeValidator; | |||
import com.vaadin.shared.ui.datefield.Resolution; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.CheckBox; | |||
@@ -86,7 +86,7 @@ public class DateFieldRangeValidation extends TestBase { | |||
actualDateField = createDateField(); | |||
actualDateField.setValue(new Date(2011 - 1900, 12 - 1, 1)); | |||
actualDateField.addValidator(new RangeValidator<Date>("", Date.class, | |||
actualDateField.addValidator(new LegacyRangeValidator<Date>("", Date.class, | |||
null, null) { | |||
@Override | |||
public boolean isMinValueIncluded() { |
@@ -2,7 +2,7 @@ package com.vaadin.tests.components.datefield; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.validator.NullValidator; | |||
import com.vaadin.legacy.data.validator.LegacyNullValidator; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.DateField; | |||
@@ -27,7 +27,7 @@ public class DefaultHandleUnparsableDateField extends TestBase { | |||
final DateField validated = new DateField("Validated Default DateField"); | |||
validated.setImmediate(true); | |||
validated.addValidator(new NullValidator("Validator: Date is NULL", | |||
validated.addValidator(new LegacyNullValidator("Validator: Date is NULL", | |||
false)); | |||
addComponent(validated); | |||
} |
@@ -5,8 +5,8 @@ import java.util.Locale; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.validator.AbstractValidator; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.validator.LegacyAbstractValidator; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.DateField; | |||
@@ -35,7 +35,7 @@ public class RequiredInvalidDateField extends TestBase { | |||
Date date = new Date(2011 - 1900, 9 - 1, 1); | |||
Validator dateValidator = new AbstractValidator<Date>( | |||
Validator dateValidator = new LegacyAbstractValidator<Date>( | |||
"Day of month must be an even number") { | |||
@Override |
@@ -1,6 +1,6 @@ | |||
package com.vaadin.tests.components.form; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
@@ -28,7 +28,7 @@ public class FormCommitWithInvalidValues extends TestBase { | |||
form = new Form(); | |||
form.setFooter(null); | |||
TextField tf = new TextField("A field, must contain 1-2 chars"); | |||
tf.addValidator(new StringLengthValidator("Invalid length", 1, 2, false)); | |||
tf.addValidator(new LegacyStringLengthValidator("Invalid length", 1, 2, false)); | |||
tf.setRequired(true); | |||
form.addField("a", tf); |
@@ -24,7 +24,7 @@ import com.vaadin.annotations.Theme; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.data.util.BeanItemContainer; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUIWithLog; | |||
import com.vaadin.tests.fieldgroup.ComplexPerson; | |||
@@ -96,7 +96,7 @@ public class GridThemeUI extends AbstractTestUIWithLog { | |||
getColumn("lastName").setEditable(false); | |||
setSizeFull(); | |||
getColumn("age").getEditorField().addValidator( | |||
new IntegerRangeValidator("Must be between 0 and 100", 0, | |||
new LegacyIntegerRangeValidator("Must be between 0 and 100", 0, | |||
100)); | |||
getColumn("birthDate").setRenderer( | |||
new DateRenderer(DateFormat.getDateInstance( | |||
@@ -137,7 +137,7 @@ public class GridThemeUI extends AbstractTestUIWithLog { | |||
setEditorEnabled(true); | |||
setSizeFull(); | |||
getColumn("age").getEditorField().addValidator( | |||
new IntegerRangeValidator("Must be between 0 and 100", 0, | |||
new LegacyIntegerRangeValidator("Must be between 0 and 100", 0, | |||
100)); | |||
getColumn("birthDate").setRenderer( | |||
new DateRenderer(DateFormat.getDateInstance( |
@@ -26,8 +26,8 @@ import com.vaadin.data.fieldgroup.FieldGroup.CommitException; | |||
import com.vaadin.data.fieldgroup.PropertyId; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.util.BeanItemContainer; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.legacy.data.Validator.InvalidValueException; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.legacy.ui.LegacyField; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.shared.ui.label.ContentMode; | |||
@@ -143,7 +143,7 @@ public abstract class AbstractBasicCrud extends AbstractTestUIWithLog { | |||
birthDate.setNullRepresentation(""); | |||
age.addValidator(new IntegerRangeValidator( | |||
age.addValidator(new LegacyIntegerRangeValidator( | |||
"Must be between 0 and 100", 0, 100)); | |||
setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); |
@@ -20,9 +20,9 @@ import java.util.Locale; | |||
import com.vaadin.data.Item; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.event.SelectionEvent; | |||
import com.vaadin.event.SelectionEvent.SelectionListener; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.ui.Grid; | |||
import com.vaadin.ui.renderers.DateRenderer; | |||
@@ -54,7 +54,7 @@ public class BasicCrudGridEditorRow extends AbstractBasicCrud { | |||
grid.getColumn("age") | |||
.getEditorField() | |||
.addValidator( | |||
new IntegerRangeValidator("Must be between 0 and 100", | |||
new LegacyIntegerRangeValidator("Must be between 0 and 100", | |||
0, 100)); | |||
grid.getColumn("birthDate").setRenderer( | |||
new DateRenderer(DateFormat.getDateInstance(DateFormat.MEDIUM, |
@@ -7,9 +7,9 @@ import com.vaadin.data.fieldgroup.FieldGroup.CommitException; | |||
import com.vaadin.data.fieldgroup.FieldGroup.CommitHandler; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.util.converter.StringToBooleanConverter; | |||
import com.vaadin.data.validator.EmailValidator; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.validator.LegacyEmailValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUIWithLog; | |||
import com.vaadin.tests.data.bean.Address; | |||
@@ -160,11 +160,11 @@ public class BasicPersonForm extends AbstractTestUIWithLog { | |||
addComponent(commitButton); | |||
addComponent(discardButton); | |||
addComponent(showBean); | |||
email.addValidator(new EmailValidator("Must be a valid address")); | |||
lastName.addValidator(new StringLengthValidator("Must be min 5 chars", | |||
email.addValidator(new LegacyEmailValidator("Must be a valid address")); | |||
lastName.addValidator(new LegacyStringLengthValidator("Must be min 5 chars", | |||
5, null, true)); | |||
age.addValidator(new IntegerRangeValidator( | |||
age.addValidator(new LegacyIntegerRangeValidator( | |||
"Must be between 0 and 150, {0} is not", 0, 150)); | |||
sex.setPageLength(0); | |||
deceased.setConverter(new StringToBooleanConverter() { |
@@ -2,8 +2,8 @@ package com.vaadin.tests.fieldgroup; | |||
import com.vaadin.data.fieldgroup.FieldGroup; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.validator.BeanValidator; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.validator.LegacyBeanValidator; | |||
import com.vaadin.server.AbstractErrorMessage; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
@@ -58,7 +58,7 @@ public class MultipleValidationErrors extends AbstractTestUI { | |||
FieldGroup fieldGroup, String caption, String propertyId) { | |||
TextField textfield = new TextField(caption, | |||
item.getItemProperty(propertyId)); | |||
textfield.addValidator(new BeanValidator( | |||
textfield.addValidator(new LegacyBeanValidator( | |||
PersonBeanWithValidationAnnotations.class, propertyId)); | |||
fieldGroup.bind(textfield, propertyId); |
@@ -1,7 +1,7 @@ | |||
package com.vaadin.tests.minitutorials.v70; | |||
import com.vaadin.data.validator.AbstractValidator; | |||
import com.vaadin.data.validator.EmailValidator; | |||
import com.vaadin.legacy.data.validator.LegacyAbstractValidator; | |||
import com.vaadin.legacy.data.validator.LegacyEmailValidator; | |||
import com.vaadin.navigator.View; | |||
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; | |||
import com.vaadin.shared.ui.MarginInfo; | |||
@@ -33,7 +33,7 @@ public class SimpleLoginView extends CustomComponent implements View, | |||
user.setWidth("300px"); | |||
user.setRequired(true); | |||
user.setInputPrompt("Your username (eg. joe@email.com)"); | |||
user.addValidator(new EmailValidator( | |||
user.addValidator(new LegacyEmailValidator( | |||
"Username must be an email address")); | |||
user.setInvalidAllowed(false); | |||
@@ -73,7 +73,7 @@ public class SimpleLoginView extends CustomComponent implements View, | |||
* Validator for validating the passwords | |||
*/ | |||
private static final class PasswordValidator extends | |||
AbstractValidator<String> { | |||
LegacyAbstractValidator<String> { | |||
public PasswordValidator() { | |||
super("The password provided is not valid"); |
@@ -21,7 +21,7 @@ import javax.validation.constraints.Min; | |||
import javax.validation.constraints.Size; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.validator.BeanValidator; | |||
import com.vaadin.legacy.data.validator.LegacyBeanValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.ui.TextField; | |||
import com.vaadin.ui.UI; | |||
@@ -79,7 +79,7 @@ public class UsingBeanValidation extends UI { | |||
firstName.setImmediate(true); | |||
setContent(firstName); | |||
firstName.addValidator(new BeanValidator(Person.class, "name")); | |||
firstName.addValidator(new LegacyBeanValidator(Person.class, "name")); | |||
} | |||
} |
@@ -3,8 +3,8 @@ package com.vaadin.tests.tickets; | |||
import java.util.Iterator; | |||
import java.util.LinkedList; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.shared.ui.label.ContentMode; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
@@ -23,7 +23,7 @@ public class Ticket1811 extends com.vaadin.server.LegacyApplication { | |||
final LegacyWindow main = new LegacyWindow("#1811"); | |||
setMainWindow(main); | |||
Validator strLenValidator = new StringLengthValidator( | |||
Validator strLenValidator = new LegacyStringLengthValidator( | |||
"String must be at least 3 chars long and non-null", 3, -1, | |||
false); | |||
@@ -5,7 +5,7 @@ import java.util.Iterator; | |||
import java.util.Random; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.legacy.ui.LegacyField; | |||
import com.vaadin.server.LegacyApplication; | |||
import com.vaadin.server.Resource; | |||
@@ -197,7 +197,7 @@ public class Ticket1878 extends LegacyApplication { | |||
f.setCaption(null); | |||
} | |||
f.addValidator(new StringLengthValidator("Error", 10, 8, false)); | |||
f.addValidator(new LegacyStringLengthValidator("Error", 10, 8, false)); | |||
} | |||
// createLayout(l1, new | |||
// ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL), |
@@ -1,10 +1,10 @@ | |||
package com.vaadin.tests.tickets; | |||
import com.vaadin.data.util.MethodProperty; | |||
import com.vaadin.data.validator.CompositeValidator; | |||
import com.vaadin.data.validator.CompositeValidator.CombinationMode; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.data.validator.IntegerValidator; | |||
import com.vaadin.legacy.data.validator.LegacyCompositeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerValidator; | |||
import com.vaadin.legacy.data.validator.LegacyCompositeValidator.CombinationMode; | |||
import com.vaadin.server.LegacyApplication; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.CheckBox; | |||
@@ -22,8 +22,8 @@ public class Ticket20 extends LegacyApplication { | |||
final TextField tx = new TextField("Integer"); | |||
mainWin.addComponent(tx); | |||
tx.setImmediate(true); | |||
CompositeValidator v = new CompositeValidator(); | |||
v.addValidator(new IntegerValidator("{0} is not a number")); | |||
LegacyCompositeValidator v = new LegacyCompositeValidator(); | |||
v.addValidator(new LegacyIntegerValidator("{0} is not a number")); | |||
v.addValidator(new Validator() { | |||
private boolean isValid(Object value) { | |||
@@ -46,7 +46,7 @@ public class Ticket20 extends LegacyApplication { | |||
} | |||
} | |||
}); | |||
CompositeValidator v2 = new CompositeValidator(CombinationMode.OR, null); | |||
LegacyCompositeValidator v2 = new LegacyCompositeValidator(CombinationMode.OR, null); | |||
v2.addValidator(v); | |||
v2.addValidator(new Validator() { | |||
@@ -2,8 +2,8 @@ package com.vaadin.tests.tickets; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.util.MethodProperty; | |||
import com.vaadin.data.validator.IntegerValidator; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerValidator; | |||
import com.vaadin.server.LegacyApplication; | |||
import com.vaadin.server.ThemeResource; | |||
import com.vaadin.ui.AbstractComponent; | |||
@@ -65,7 +65,7 @@ public class Ticket736 extends LegacyApplication { | |||
// Add some validators for the form | |||
f.getField("zip").addValidator( | |||
new IntegerValidator("'{0}' is not a number")); | |||
new LegacyIntegerValidator("'{0}' is not a number")); | |||
((AbstractComponent) f.getField("zip")).setDescription("Jepjep"); | |||
((AbstractComponent) f.getField("zip")).setIcon(new ThemeResource( | |||
"../runo/icons/16/folder.png")); |
@@ -1,7 +1,7 @@ | |||
package com.vaadin.tests.tickets; | |||
import com.vaadin.data.util.MethodProperty; | |||
import com.vaadin.data.validator.IntegerValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerValidator; | |||
import com.vaadin.server.LegacyApplication; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.CheckBox; | |||
@@ -19,7 +19,7 @@ public class Ticket846 extends LegacyApplication { | |||
final TextField tx = new TextField("Integer"); | |||
mainWin.addComponent(tx); | |||
tx.setImmediate(true); | |||
tx.addValidator(new IntegerValidator("{0} is not a number")); | |||
tx.addValidator(new LegacyIntegerValidator("{0} is not a number")); | |||
final String[] visibleProps = { "required", "invalidAllowed", | |||
"readOnly", "readThrough", "invalidCommitted", |
@@ -15,7 +15,7 @@ | |||
*/ | |||
package com.vaadin.tests.tooltip; | |||
import com.vaadin.data.validator.IntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.ui.TextField; | |||
@@ -33,7 +33,7 @@ public class ValidatorCaptionTooltip extends AbstractTestUI { | |||
int max = 100; | |||
String errorMessage = "Valid value is between " + min + " and " + max | |||
+ ". {0} is not."; | |||
IntegerRangeValidator validator = new IntegerRangeValidator( | |||
LegacyIntegerRangeValidator validator = new LegacyIntegerRangeValidator( | |||
errorMessage, min, max); | |||
fieldWithError.setValue("142"); | |||
@@ -1,8 +1,8 @@ | |||
package com.vaadin.tests.util; | |||
import com.vaadin.data.validator.AbstractValidator; | |||
import com.vaadin.legacy.data.validator.LegacyAbstractValidator; | |||
public class AlwaysFailValidator extends AbstractValidator<Object> { | |||
public class AlwaysFailValidator extends LegacyAbstractValidator<Object> { | |||
public AlwaysFailValidator() { | |||
super("Validation error"); | |||
} |
@@ -17,9 +17,9 @@ package com.vaadin.tests.validation; | |||
import java.util.Set; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.ui.LegacyField; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.legacy.ui.LegacyAbstractField; | |||
import com.vaadin.server.UserError; | |||
import com.vaadin.server.VaadinRequest; | |||
@@ -49,20 +49,20 @@ public class FieldErrorIndication extends AbstractTestUI { | |||
ComboBox comboBox = new ComboBox("ComboBox"); | |||
comboBox.addItem("ok"); | |||
comboBox.addItem("error"); | |||
comboBox.addValidator(new StringLengthValidator("fail", 0, 2, false)); | |||
comboBox.addValidator(new LegacyStringLengthValidator("fail", 0, 2, false)); | |||
comboBox.setValue("error"); | |||
ListSelect listSelect = new ListSelect("ListSelect"); | |||
listSelect.addItem("ok"); | |||
listSelect.addItem("error"); | |||
listSelect.addValidator(new StringLengthValidator("fail", 0, 2, false)); | |||
listSelect.addValidator(new LegacyStringLengthValidator("fail", 0, 2, false)); | |||
listSelect.setValue("error"); | |||
NativeSelect nativeSelect = new NativeSelect("NativeSelect"); | |||
nativeSelect.addItem("ok"); | |||
nativeSelect.addItem("error"); | |||
nativeSelect | |||
.addValidator(new StringLengthValidator("fail", 0, 2, false)); | |||
.addValidator(new LegacyStringLengthValidator("fail", 0, 2, false)); | |||
nativeSelect.setValue("error"); | |||
TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect"); | |||
twinColSelect.addItem("ok"); |
@@ -1,14 +1,14 @@ | |||
package com.vaadin.tests.validation; | |||
import com.vaadin.data.validator.AbstractStringValidator; | |||
import com.vaadin.data.validator.CompositeValidator; | |||
import com.vaadin.data.validator.CompositeValidator.CombinationMode; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.data.validator.DoubleValidator; | |||
import com.vaadin.data.validator.EmailValidator; | |||
import com.vaadin.data.validator.IntegerValidator; | |||
import com.vaadin.data.validator.RegexpValidator; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.validator.LegacyAbstractStringValidator; | |||
import com.vaadin.legacy.data.validator.LegacyCompositeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyDoubleValidator; | |||
import com.vaadin.legacy.data.validator.LegacyEmailValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerValidator; | |||
import com.vaadin.legacy.data.validator.LegacyRegexpValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.legacy.data.validator.LegacyCompositeValidator.CombinationMode; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.Button; | |||
import com.vaadin.ui.Button.ClickEvent; | |||
@@ -37,59 +37,59 @@ public class TestValidators extends TestBase { | |||
// simple validators | |||
TextField tf = new TextField("A field, must contain 1-2 chars"); | |||
tf.addValidator(new StringLengthValidator("Invalid length", 1, 2, false)); | |||
tf.addValidator(new LegacyStringLengthValidator("Invalid length", 1, 2, false)); | |||
tf.setRequired(true); | |||
tf.setValue("ab"); | |||
form.addField("a", tf); | |||
tf = new TextField("A field, must contain an integer"); | |||
tf.addValidator(new IntegerValidator("Invalid integer {0}")); | |||
tf.addValidator(new LegacyIntegerValidator("Invalid integer {0}")); | |||
tf.setRequired(true); | |||
tf.setValue("123"); | |||
form.addField("b", tf); | |||
tf = new TextField("A field, must contain an integer or be empty"); | |||
tf.addValidator(new IntegerValidator("Invalid integer {0}")); | |||
tf.addValidator(new LegacyIntegerValidator("Invalid integer {0}")); | |||
tf.setValue("-321"); | |||
form.addField("c", tf); | |||
tf = new TextField( | |||
"A field, must contain a floating point number or be empty"); | |||
tf.addValidator(new DoubleValidator("Invalid double {0}")); | |||
tf.addValidator(new LegacyDoubleValidator("Invalid double {0}")); | |||
tf.setValue("-123.45e6"); | |||
form.addField("d", tf); | |||
tf = new TextField( | |||
"A field, must contain an e-mail address or be empty"); | |||
tf.addValidator(new EmailValidator("Invalid e-mail address {0}")); | |||
tf.addValidator(new LegacyEmailValidator("Invalid e-mail address {0}")); | |||
tf.setValue("a.b@example.com"); | |||
form.addField("e", tf); | |||
// regular expressions | |||
tf = new TextField("A field, must match the regular expression a.*b.*c"); | |||
tf.addValidator(new RegexpValidator("a.*b.*c", | |||
tf.addValidator(new LegacyRegexpValidator("a.*b.*c", | |||
"{0} does not match the regular expression")); | |||
tf.setValue("aagsabeqgc"); | |||
form.addField("f", tf); | |||
tf = new TextField( | |||
"A field, must contain the regular expression a.*b.*c"); | |||
tf.addValidator(new RegexpValidator("a.*b.*c", false, | |||
tf.addValidator(new LegacyRegexpValidator("a.*b.*c", false, | |||
"{0} does not contain the regular expression")); | |||
tf.setValue("aagsabeqgc"); | |||
form.addField("g", tf); | |||
tf = new TextField( | |||
"A field, must match the regular expression ^a.*b.*c$"); | |||
tf.addValidator(new RegexpValidator("^a.*b.*c$", false, | |||
tf.addValidator(new LegacyRegexpValidator("^a.*b.*c$", false, | |||
"{0} does not match the regular expression with ^ and $")); | |||
tf.setValue("aagsabeqgc"); | |||
form.addField("h", tf); | |||
tf = new TextField( | |||
"A field, must contain the regular expression ^a.*b.*c$"); | |||
tf.addValidator(new RegexpValidator("^a.*b.*c$", false, | |||
tf.addValidator(new LegacyRegexpValidator("^a.*b.*c$", false, | |||
"{0} does not contain the regular expression with ^ and $")); | |||
tf.setValue("aagsabeqgc"); | |||
form.addField("i", tf); | |||
@@ -97,11 +97,11 @@ public class TestValidators extends TestBase { | |||
// TODO CompositeValidator | |||
tf = new TextField( | |||
"A field, must be a floating point number with 4-5 chars"); | |||
CompositeValidator cv = new CompositeValidator(CombinationMode.AND, | |||
LegacyCompositeValidator cv = new LegacyCompositeValidator(CombinationMode.AND, | |||
"The field must contain a floating point number with 4-5 characters"); | |||
cv.addValidator(new StringLengthValidator( | |||
cv.addValidator(new LegacyStringLengthValidator( | |||
"String length of '{0}' should be 4-5 characters", 4, 5, false)); | |||
cv.addValidator(new DoubleValidator( | |||
cv.addValidator(new LegacyDoubleValidator( | |||
"{0} must be a floating point number")); | |||
tf.addValidator(cv); | |||
tf.setValue("12.34"); | |||
@@ -109,11 +109,11 @@ public class TestValidators extends TestBase { | |||
tf = new TextField( | |||
"A field, must be a floating point number or 4-5 chars"); | |||
cv = new CompositeValidator(CombinationMode.OR, | |||
cv = new LegacyCompositeValidator(CombinationMode.OR, | |||
"The field must contain a floating point or with 4-5 characters"); | |||
cv.addValidator(new StringLengthValidator( | |||
cv.addValidator(new LegacyStringLengthValidator( | |||
"String length of '{0}' should be 4-5 characters", 4, 5, false)); | |||
cv.addValidator(new DoubleValidator( | |||
cv.addValidator(new LegacyDoubleValidator( | |||
"{0} must be a floating point number")); | |||
tf.addValidator(cv); | |||
tf.setValue("12.34g"); | |||
@@ -124,7 +124,7 @@ public class TestValidators extends TestBase { | |||
tf.setColumns(5); | |||
// Create the validator - this would be even easier with RegexpValidator | |||
Validator postalCodeValidator = new AbstractStringValidator( | |||
Validator postalCodeValidator = new LegacyAbstractStringValidator( | |||
"Postal code must be a number 10000-99999.") { | |||
@Override | |||
protected boolean isValidValue(String value) { |
@@ -2,9 +2,9 @@ package com.vaadin.tests.validation; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.data.validator.IntegerValidator; | |||
import com.vaadin.data.validator.StringLengthValidator; | |||
import com.vaadin.legacy.data.Validator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.ui.CheckBox; | |||
@@ -17,9 +17,9 @@ public class ValidationOfRequiredEmptyFields extends AbstractTestUI { | |||
private CheckBox requiredInput; | |||
private TextField requiredErrorInput; | |||
private Validator integerValidator = new IntegerValidator( | |||
private Validator integerValidator = new LegacyIntegerValidator( | |||
"Must be an integer"); | |||
private Validator stringLengthValidator = new StringLengthValidator( | |||
private Validator stringLengthValidator = new LegacyStringLengthValidator( | |||
"Must be 5-10 chars", 5, 10, false); | |||
private CheckBox integerValidatorInput; | |||
private CheckBox stringLengthValidatorInput; |