diff options
author | Artur Signell <artur@vaadin.com> | 2016-08-10 10:02:21 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-10 16:09:24 +0300 |
commit | 192e93a814f05dc8c5cc7a01b7264bc0a8a9dec7 (patch) | |
tree | 784646d65183b23577e7f8b462f0a23ff9c1502f /server/src/main | |
parent | 314eb377ddc3112fbcd0b55f214ab6f0b7c606a9 (diff) | |
download | vaadin-framework-192e93a814f05dc8c5cc7a01b7264bc0a8a9dec7.tar.gz vaadin-framework-192e93a814f05dc8c5cc7a01b7264bc0a8a9dec7.zip |
Move and rename converters into com.vaadin.legacy.data.util.converter.Legacy*
Change-Id: I75fd33e66c8c5c265bc60cce58ff639a5d5642ab
Diffstat (limited to 'server/src/main')
40 files changed, 280 insertions, 280 deletions
diff --git a/server/src/main/java/com/vaadin/data/util/PropertyFormatter.java b/server/src/main/java/com/vaadin/data/util/PropertyFormatter.java index e188ce8bc3..b3df70534b 100644 --- a/server/src/main/java/com/vaadin/data/util/PropertyFormatter.java +++ b/server/src/main/java/com/vaadin/data/util/PropertyFormatter.java @@ -16,7 +16,7 @@ package com.vaadin.data.util; import com.vaadin.data.Property; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; /** * Formatting proxy for a {@link Property}. @@ -46,7 +46,7 @@ import com.vaadin.data.util.converter.Converter; * type of the underlying property (a PropertyFormatter is always a * Property<String>) * - * @deprecated As of 7.0, replaced by {@link Converter} + * @deprecated As of 7.0, replaced by {@link LegacyConverter} * @author Vaadin Ltd. * @since 5.3.0 */ diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/ColumnProperty.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/ColumnProperty.java index e89b8c02a8..0f778ba2ab 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/ColumnProperty.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/ColumnProperty.java @@ -22,7 +22,7 @@ import java.util.logging.Logger; import com.vaadin.data.Property; import com.vaadin.data.util.LegacyPropertyHelper; -import com.vaadin.data.util.converter.Converter.ConversionException; +import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; /** * ColumnProperty represents the value of one column in a RowItem. In addition diff --git a/server/src/main/java/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyAbstractStringToNumberConverter.java index 81f1a85f89..4b14f66df9 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/AbstractStringToNumberConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyAbstractStringToNumberConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.NumberFormat; import java.text.ParsePosition; @@ -32,8 +32,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.1 */ -public abstract class AbstractStringToNumberConverter<T> implements - Converter<String, T> { +public abstract class LegacyAbstractStringToNumberConverter<T> implements + LegacyConverter<String, T> { /** * Returns the format used by {@link #convertToPresentation(Object, Locale)} diff --git a/server/src/main/java/com/vaadin/data/util/converter/Converter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverter.java index a7188ebb33..1fdd0755b9 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/Converter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.io.Serializable; import java.util.Locale; @@ -47,7 +47,7 @@ import java.util.Locale; * @author Vaadin Ltd. * @since 7.0 */ -public interface Converter<PRESENTATION, MODEL> extends Serializable { +public interface LegacyConverter<PRESENTATION, MODEL> extends Serializable { /** * Converts the given value from target type to source type. @@ -121,8 +121,8 @@ public interface Converter<PRESENTATION, MODEL> extends Serializable { /** * An exception that signals that the value passed to - * {@link Converter#convertToPresentation(Object, Class, Locale)} or - * {@link Converter#convertToModel(Object, Class, Locale)} could not be + * {@link LegacyConverter#convertToPresentation(Object, Class, Locale)} or + * {@link LegacyConverter#convertToModel(Object, Class, Locale)} could not be * converted. * * @author Vaadin Ltd diff --git a/server/src/main/java/com/vaadin/data/util/converter/ConverterFactory.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterFactory.java index 0280be4a73..8c5cbacf04 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/ConverterFactory.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterFactory.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.io.Serializable; @@ -26,8 +26,8 @@ import java.io.Serializable; * @since 7.0 * */ -public interface ConverterFactory extends Serializable { - public <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> createConverter( +public interface LegacyConverterFactory extends Serializable { + public <PRESENTATION, MODEL> LegacyConverter<PRESENTATION, MODEL> createConverter( Class<PRESENTATION> presentationType, Class<MODEL> modelType); } diff --git a/server/src/main/java/com/vaadin/data/util/converter/ConverterUtil.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterUtil.java index 91e11a6222..42d268f781 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/ConverterUtil.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterUtil.java @@ -13,19 +13,19 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.io.Serializable; import java.util.Locale; import com.vaadin.server.VaadinSession; -public class ConverterUtil implements Serializable { +public class LegacyConverterUtil implements Serializable { /** * Finds a converter that can convert from the given presentation type to * the given model type and back. Uses the given application to find a - * {@link ConverterFactory} or, if application is null, uses the + * {@link LegacyConverterFactory} or, if application is null, uses the * {@link VaadinSession#getCurrent()}. * * @param <PRESENTATIONTYPE> @@ -42,16 +42,16 @@ public class ConverterUtil implements Serializable { * @return a Converter capable of converting between the given types or null * if no converter was found */ - public static <PRESENTATIONTYPE, MODELTYPE> Converter<PRESENTATIONTYPE, MODELTYPE> getConverter( + public static <PRESENTATIONTYPE, MODELTYPE> LegacyConverter<PRESENTATIONTYPE, MODELTYPE> getConverter( Class<PRESENTATIONTYPE> presentationType, Class<MODELTYPE> modelType, VaadinSession session) { - Converter<PRESENTATIONTYPE, MODELTYPE> converter = null; + LegacyConverter<PRESENTATIONTYPE, MODELTYPE> converter = null; if (session == null) { session = VaadinSession.getCurrent(); } if (session != null) { - ConverterFactory factory = session.getConverterFactory(); + LegacyConverterFactory factory = session.getConverterFactory(); converter = factory.createConverter(presentationType, modelType); } return converter; @@ -77,15 +77,15 @@ public class ConverterUtil implements Serializable { * @return the converted value, compatible with the presentation type, or * the original value if its type is compatible and no converter is * set. - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * if there was a problem converting the value */ @SuppressWarnings("unchecked") public static <PRESENTATIONTYPE, MODELTYPE> PRESENTATIONTYPE convertFromModel( MODELTYPE modelValue, Class<? extends PRESENTATIONTYPE> presentationType, - Converter<PRESENTATIONTYPE, MODELTYPE> converter, Locale locale) - throws Converter.ConversionException { + LegacyConverter<PRESENTATIONTYPE, MODELTYPE> converter, Locale locale) + throws LegacyConverter.ConversionException { if (converter != null) { /* * If there is a converter, always use it. It must convert or throw @@ -95,7 +95,7 @@ public class ConverterUtil implements Serializable { modelValue, presentationType, locale); if (presentation != null && !presentationType.isInstance(presentation)) { - throw new Converter.ConversionException( + throw new LegacyConverter.ConversionException( "Converter returned an object of type " + presentation.getClass().getName() + " when expecting " @@ -113,7 +113,7 @@ public class ConverterUtil implements Serializable { if (presentationType.isAssignableFrom(modelValue.getClass())) { return (PRESENTATIONTYPE) modelValue; } else { - throw new Converter.ConversionException( + throw new LegacyConverter.ConversionException( "Unable to convert value of type " + modelValue.getClass().getName() + " to presentation type " @@ -141,13 +141,13 @@ public class ConverterUtil implements Serializable { * * @return the converted value, compatible with the model type, or the * original value if its type is compatible and no converter is set. - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * if there was a problem converting the value */ public static <MODELTYPE, PRESENTATIONTYPE> MODELTYPE convertToModel( PRESENTATIONTYPE presentationValue, Class<MODELTYPE> modelType, - Converter<PRESENTATIONTYPE, MODELTYPE> converter, Locale locale) - throws Converter.ConversionException { + LegacyConverter<PRESENTATIONTYPE, MODELTYPE> converter, Locale locale) + throws LegacyConverter.ConversionException { if (converter != null) { /* * If there is a converter, always use it. It must convert or throw @@ -156,7 +156,7 @@ public class ConverterUtil implements Serializable { MODELTYPE model = converter.convertToModel(presentationValue, modelType, locale); if (model != null && !modelType.isInstance(model)) { - throw new Converter.ConversionException( + throw new LegacyConverter.ConversionException( "Converter returned an object of type " + model.getClass().getName() + " when expecting " + modelType.getName()); @@ -178,7 +178,7 @@ public class ConverterUtil implements Serializable { // presentation type directly compatible with model type return modelType.cast(presentationValue); } else { - throw new Converter.ConversionException( + throw new LegacyConverter.ConversionException( "Unable to convert value of type " + presentationValue.getClass().getName() + " to model type " @@ -193,7 +193,7 @@ public class ConverterUtil implements Serializable { * presentation and model type. Does strict type checking and only returns * true if the converter claims it can handle exactly the given types. * - * @see #canConverterPossiblyHandle(Converter, Class, Class) + * @see #canConverterPossiblyHandle(LegacyConverter, Class, Class) * * @param converter * The converter to check. If this is null the result is always @@ -205,7 +205,7 @@ public class ConverterUtil implements Serializable { * @return true if the converter supports conversion between the given * presentation and model type, false otherwise */ - public static boolean canConverterHandle(Converter<?, ?> converter, + public static boolean canConverterHandle(LegacyConverter<?, ?> converter, Class<?> presentationType, Class<?> modelType) { if (converter == null) { return false; @@ -235,7 +235,7 @@ public class ConverterUtil implements Serializable { * @return true if the converter possibly support conversion between the * given presentation and model type, false otherwise */ - public static boolean canConverterPossiblyHandle(Converter<?, ?> converter, + public static boolean canConverterPossiblyHandle(LegacyConverter<?, ?> converter, Class<?> presentationType, Class<?> modelType) { if (converter == null) { return false; diff --git a/server/src/main/java/com/vaadin/data/util/converter/DateToLongConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToLongConverter.java index fffe80352e..04d037b12f 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/DateToLongConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToLongConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.util.Date; import java.util.Locale; @@ -25,7 +25,7 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class DateToLongConverter implements Converter<Date, Long> { +public class LegacyDateToLongConverter implements LegacyConverter<Date, Long> { /* * (non-Javadoc) diff --git a/server/src/main/java/com/vaadin/data/util/converter/DateToSqlDateConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToSqlDateConverter.java index 6a7e8327a1..1ea4eaca8c 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/DateToSqlDateConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToSqlDateConverter.java @@ -17,7 +17,7 @@ /** * */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.util.Date; import java.util.Locale; @@ -32,7 +32,7 @@ import java.util.Locale; * @since 7.1 * @author Vaadin Ltd */ -public class DateToSqlDateConverter implements Converter<Date, java.sql.Date> { +public class LegacyDateToSqlDateConverter implements LegacyConverter<Date, java.sql.Date> { @Override public java.sql.Date convertToModel(Date value, diff --git a/server/src/main/java/com/vaadin/data/util/converter/DefaultConverterFactory.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDefaultConverterFactory.java index 3a1f1a4252..c647981650 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/DefaultConverterFactory.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDefaultConverterFactory.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.math.BigDecimal; import java.math.BigInteger; @@ -24,25 +24,25 @@ import java.util.logging.Logger; import com.vaadin.server.VaadinSession; /** - * Default implementation of {@link ConverterFactory}. Provides converters for + * Default implementation of {@link LegacyConverterFactory}. Provides converters for * standard types like {@link String}, {@link Double} and {@link Date}. </p> * <p> * Custom converters can be provided by extending this class and using - * {@link VaadinSession#setConverterFactory(ConverterFactory)}. + * {@link VaadinSession#setConverterFactory(LegacyConverterFactory)}. * </p> * * @author Vaadin Ltd * @since 7.0 */ -public class DefaultConverterFactory implements ConverterFactory { +public class LegacyDefaultConverterFactory implements LegacyConverterFactory { private final static Logger log = Logger - .getLogger(DefaultConverterFactory.class.getName()); + .getLogger(LegacyDefaultConverterFactory.class.getName()); @Override - public <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> createConverter( + public <PRESENTATION, MODEL> LegacyConverter<PRESENTATION, MODEL> createConverter( Class<PRESENTATION> presentationType, Class<MODEL> modelType) { - Converter<PRESENTATION, MODEL> converter = findConverter( + LegacyConverter<PRESENTATION, MODEL> converter = findConverter( presentationType, modelType); if (converter != null) { log.finest(getClass().getName() + " created a " @@ -51,12 +51,12 @@ public class DefaultConverterFactory implements ConverterFactory { } // Try to find a reverse converter - Converter<MODEL, PRESENTATION> reverseConverter = findConverter( + LegacyConverter<MODEL, PRESENTATION> reverseConverter = findConverter( modelType, presentationType); if (reverseConverter != null) { log.finest(getClass().getName() + " created a reverse " + reverseConverter.getClass()); - return new ReverseConverter<PRESENTATION, MODEL>(reverseConverter); + return new LegacyReverseConverter<PRESENTATION, MODEL>(reverseConverter); } log.finest(getClass().getName() + " could not find a converter for " @@ -66,17 +66,17 @@ public class DefaultConverterFactory implements ConverterFactory { } - protected <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> findConverter( + protected <PRESENTATION, MODEL> LegacyConverter<PRESENTATION, MODEL> findConverter( Class<PRESENTATION> presentationType, Class<MODEL> modelType) { if (presentationType == String.class) { // TextField converters and more - Converter<PRESENTATION, MODEL> converter = (Converter<PRESENTATION, MODEL>) createStringConverter(modelType); + LegacyConverter<PRESENTATION, MODEL> converter = (LegacyConverter<PRESENTATION, MODEL>) createStringConverter(modelType); if (converter != null) { return converter; } } else if (presentationType == Date.class) { // DateField converters and more - Converter<PRESENTATION, MODEL> converter = (Converter<PRESENTATION, MODEL>) createDateConverter(modelType); + LegacyConverter<PRESENTATION, MODEL> converter = (LegacyConverter<PRESENTATION, MODEL>) createDateConverter(modelType); if (converter != null) { return converter; } @@ -86,39 +86,39 @@ public class DefaultConverterFactory implements ConverterFactory { } - protected Converter<Date, ?> createDateConverter(Class<?> sourceType) { + protected LegacyConverter<Date, ?> createDateConverter(Class<?> sourceType) { if (Long.class.isAssignableFrom(sourceType)) { - return new DateToLongConverter(); + return new LegacyDateToLongConverter(); } else if (java.sql.Date.class.isAssignableFrom(sourceType)) { - return new DateToSqlDateConverter(); + return new LegacyDateToSqlDateConverter(); } else { return null; } } - protected Converter<String, ?> createStringConverter(Class<?> sourceType) { + protected LegacyConverter<String, ?> createStringConverter(Class<?> sourceType) { if (Double.class.isAssignableFrom(sourceType)) { - return new StringToDoubleConverter(); + return new LegacyStringToDoubleConverter(); } else if (Float.class.isAssignableFrom(sourceType)) { - return new StringToFloatConverter(); + return new LegacyStringToFloatConverter(); } else if (Integer.class.isAssignableFrom(sourceType)) { - return new StringToIntegerConverter(); + return new LegacyStringToIntegerConverter(); } else if (Long.class.isAssignableFrom(sourceType)) { - return new StringToLongConverter(); + return new LegacyStringToLongConverter(); } else if (BigDecimal.class.isAssignableFrom(sourceType)) { - return new StringToBigDecimalConverter(); + return new LegacyStringToBigDecimalConverter(); } else if (Boolean.class.isAssignableFrom(sourceType)) { - return new StringToBooleanConverter(); + return new LegacyStringToBooleanConverter(); } else if (Date.class.isAssignableFrom(sourceType)) { - return new StringToDateConverter(); + return new LegacyStringToDateConverter(); } else if (Enum.class.isAssignableFrom(sourceType)) { - return new StringToEnumConverter(); + return new LegacyStringToEnumConverter(); } else if (BigInteger.class.isAssignableFrom(sourceType)) { - return new StringToBigIntegerConverter(); + return new LegacyStringToBigIntegerConverter(); } else if (Short.class.isAssignableFrom(sourceType)) { - return new StringToShortConverter(); + return new LegacyStringToShortConverter(); } else if (Byte.class.isAssignableFrom(sourceType)) { - return new StringToByteConverter(); + return new LegacyStringToByteConverter(); } else { return null; } diff --git a/server/src/main/java/com/vaadin/data/util/converter/ReverseConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyReverseConverter.java index 2495dc631a..6841e99b6e 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/ReverseConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyReverseConverter.java @@ -14,12 +14,12 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.util.Locale; /** - * A converter that wraps another {@link Converter} and reverses source and + * A converter that wraps another {@link LegacyConverter} and reverses source and * target types. * * @param <MODEL> @@ -30,10 +30,10 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class ReverseConverter<PRESENTATION, MODEL> implements - Converter<PRESENTATION, MODEL> { +public class LegacyReverseConverter<PRESENTATION, MODEL> implements + LegacyConverter<PRESENTATION, MODEL> { - private Converter<MODEL, PRESENTATION> realConverter; + private LegacyConverter<MODEL, PRESENTATION> realConverter; /** * Creates a converter from source to target based on a converter that @@ -42,7 +42,7 @@ public class ReverseConverter<PRESENTATION, MODEL> implements * @param converter * The converter to use in a reverse fashion */ - public ReverseConverter(Converter<MODEL, PRESENTATION> converter) { + public LegacyReverseConverter(LegacyConverter<MODEL, PRESENTATION> converter) { this.realConverter = converter; } @@ -55,7 +55,7 @@ public class ReverseConverter<PRESENTATION, MODEL> implements @Override public MODEL convertToModel(PRESENTATION value, Class<? extends MODEL> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { return realConverter.convertToPresentation(value, targetType, locale); } @@ -69,7 +69,7 @@ public class ReverseConverter<PRESENTATION, MODEL> implements @Override public PRESENTATION convertToPresentation(MODEL value, Class<? extends PRESENTATION> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { return realConverter.convertToModel(value, targetType, locale); } diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToBigDecimalConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigDecimalConverter.java index 549f156f61..4b6c2151a0 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToBigDecimalConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigDecimalConverter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.math.BigDecimal; import java.text.DecimalFormat; @@ -34,8 +34,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.2 */ -public class StringToBigDecimalConverter extends - AbstractStringToNumberConverter<BigDecimal> { +public class LegacyStringToBigDecimalConverter extends + LegacyAbstractStringToNumberConverter<BigDecimal> { @Override protected NumberFormat getFormat(Locale locale) { NumberFormat numberFormat = super.getFormat(locale); @@ -49,7 +49,7 @@ public class StringToBigDecimalConverter extends @Override public BigDecimal convertToModel(String value, Class<? extends BigDecimal> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { return (BigDecimal) convertToNumber(value, BigDecimal.class, locale); } diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToBigIntegerConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigIntegerConverter.java index adaa8c6111..f2d3754dd2 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToBigIntegerConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigIntegerConverter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.math.BigDecimal; import java.math.BigInteger; @@ -35,8 +35,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class StringToBigIntegerConverter extends - AbstractStringToNumberConverter<BigInteger> { +public class LegacyStringToBigIntegerConverter extends + LegacyAbstractStringToNumberConverter<BigInteger> { @Override protected NumberFormat getFormat(Locale locale) { @@ -51,7 +51,7 @@ public class StringToBigIntegerConverter extends @Override public BigInteger convertToModel(String value, Class<? extends BigInteger> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { BigDecimal bigDecimalValue = (BigDecimal) convertToNumber(value, BigDecimal.class, locale); diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToBooleanConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBooleanConverter.java index f965cfcc6a..7d36a9d248 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToBooleanConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBooleanConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.util.Locale; @@ -27,7 +27,7 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class StringToBooleanConverter implements Converter<String, Boolean> { +public class LegacyStringToBooleanConverter implements LegacyConverter<String, Boolean> { private final String trueString; @@ -37,7 +37,7 @@ public class StringToBooleanConverter implements Converter<String, Boolean> { * Creates converter with default string representations - "true" and "false" * */ - public StringToBooleanConverter() { + public LegacyStringToBooleanConverter() { this(Boolean.TRUE.toString(), Boolean.FALSE.toString()); } @@ -48,7 +48,7 @@ public class StringToBooleanConverter implements Converter<String, Boolean> { * @param falseString string representation for <code>false</code> * @param trueString string representation for <code>true</code> */ - public StringToBooleanConverter(String trueString, String falseString) { + public LegacyStringToBooleanConverter(String trueString, String falseString) { this.trueString = trueString; this.falseString = falseString; } diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToByteConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToByteConverter.java index 719fced0ed..0531322663 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToByteConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToByteConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.NumberFormat; import java.util.Locale; @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class StringToByteConverter extends - AbstractStringToNumberConverter<Byte> { +public class LegacyStringToByteConverter extends + LegacyAbstractStringToNumberConverter<Byte> { /** * Returns the format used by diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToCollectionConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToCollectionConverter.java index 6930b6da06..59321d5fb3 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToCollectionConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToCollectionConverter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.io.Serializable; import java.lang.reflect.Modifier; @@ -38,11 +38,11 @@ import java.util.Locale; * * @author Vaadin Ltd */ -public class StringToCollectionConverter implements - Converter<String, Collection> { +public class LegacyStringToCollectionConverter implements + LegacyConverter<String, Collection> { private final String delimiter; - private final Converter<String, ?> tokenConverter; + private final LegacyConverter<String, ?> tokenConverter; private final Class<?> tokenType; private final CollectionFactory factory; @@ -50,7 +50,7 @@ public class StringToCollectionConverter implements * Creates converter with <code>", "</code> as delimiter and {@link String} * as token model type in collection. */ - public StringToCollectionConverter() { + public LegacyStringToCollectionConverter() { this(", ", null, String.class); } @@ -61,7 +61,7 @@ public class StringToCollectionConverter implements * @param delimiter * custom delimiter */ - public StringToCollectionConverter(String delimiter) { + public LegacyStringToCollectionConverter(String delimiter) { this(delimiter, null, String.class); } @@ -77,7 +77,7 @@ public class StringToCollectionConverter implements * @param tokenType * expected token model type */ - public StringToCollectionConverter(Converter<String, ?> tokenConverter, + public LegacyStringToCollectionConverter(LegacyConverter<String, ?> tokenConverter, Class<?> tokenType) { this(", ", tokenConverter, tokenType); } @@ -96,8 +96,8 @@ public class StringToCollectionConverter implements * @param delimiter * delimiter in presentation string */ - public StringToCollectionConverter(String delimiter, - Converter<String, ?> tokenConverter, Class<?> tokenClass) { + public LegacyStringToCollectionConverter(String delimiter, + LegacyConverter<String, ?> tokenConverter, Class<?> tokenClass) { this(delimiter, tokenConverter, tokenClass, new DefaultCollectionFactory()); } @@ -118,8 +118,8 @@ public class StringToCollectionConverter implements * @param factory * factory to create resulting collection */ - public StringToCollectionConverter(String delimiter, - Converter<String, ?> tokenConverter, Class<?> tokenClass, + public LegacyStringToCollectionConverter(String delimiter, + LegacyConverter<String, ?> tokenConverter, Class<?> tokenClass, CollectionFactory factory) { if (delimiter == null || delimiter.isEmpty()) { throw new IllegalArgumentException( @@ -144,7 +144,7 @@ public class StringToCollectionConverter implements @Override public Collection convertToModel(String value, Class<? extends Collection> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (value == null) { return null; } @@ -152,7 +152,7 @@ public class StringToCollectionConverter implements int index = value.indexOf(delimiter); int previous = 0; Collection result = factory.createCollection(targetType); - Converter converter = tokenConverter; + LegacyConverter converter = tokenConverter; while (index != -1) { collectToken(value.substring(previous, index), result, converter, locale); @@ -166,12 +166,12 @@ public class StringToCollectionConverter implements @Override public String convertToPresentation(Collection value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (value == null) { return null; } StringBuilder builder = new StringBuilder(); - Converter converter = tokenConverter; + LegacyConverter converter = tokenConverter; for (Iterator<?> iterator = value.iterator(); iterator.hasNext();) { if (converter == null) { builder.append(iterator.next()); @@ -189,7 +189,7 @@ public class StringToCollectionConverter implements } private void collectToken(String token, Collection collection, - Converter converter, Locale locale) { + LegacyConverter converter, Locale locale) { if (converter == null) { collection.add(token); } else { diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToDateConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDateConverter.java index 8f0db24caf..40780bfdd0 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToDateConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDateConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.DateFormat; import java.text.ParsePosition; @@ -34,7 +34,7 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class StringToDateConverter implements Converter<String, Date> { +public class LegacyStringToDateConverter implements LegacyConverter<String, Date> { /** * Returns the format used by @@ -66,7 +66,7 @@ public class StringToDateConverter implements Converter<String, Date> { @Override public Date convertToModel(String value, Class<? extends Date> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { if (targetType != getModelType()) { throw new ConversionException("Converter only supports " + getModelType().getName() + " (targetType was " @@ -100,7 +100,7 @@ public class StringToDateConverter implements Converter<String, Date> { @Override public String convertToPresentation(Date value, Class<? extends String> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { if (value == null) { return null; } diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToDoubleConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDoubleConverter.java index f514eac648..191648fba9 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToDoubleConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDoubleConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.NumberFormat; import java.util.Locale; @@ -33,8 +33,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class StringToDoubleConverter extends - AbstractStringToNumberConverter<Double> { +public class LegacyStringToDoubleConverter extends + LegacyAbstractStringToNumberConverter<Double> { /* * (non-Javadoc) diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToEnumConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToEnumConverter.java index 7b2f43f972..ef1dec64eb 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToEnumConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToEnumConverter.java @@ -13,7 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.util.EnumSet; import java.util.Locale; @@ -36,7 +36,7 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class StringToEnumConverter implements Converter<String, Enum> { +public class LegacyStringToEnumConverter implements LegacyConverter<String, Enum> { @Override public Enum convertToModel(String value, Class<? extends Enum> targetType, diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToFloatConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToFloatConverter.java index f4d7f97853..0d24e16a35 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToFloatConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToFloatConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.NumberFormat; import java.util.Locale; @@ -33,8 +33,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class StringToFloatConverter extends - AbstractStringToNumberConverter<Float> { +public class LegacyStringToFloatConverter extends + LegacyAbstractStringToNumberConverter<Float> { /* * (non-Javadoc) diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToIntegerConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToIntegerConverter.java index 59a46babe1..37c00b7c3e 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToIntegerConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToIntegerConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.NumberFormat; import java.util.Locale; @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class StringToIntegerConverter extends - AbstractStringToNumberConverter<Integer> { +public class LegacyStringToIntegerConverter extends + LegacyAbstractStringToNumberConverter<Integer> { /** * Returns the format used by diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToLongConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToLongConverter.java index cd7cf49042..0de27bc3f3 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToLongConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToLongConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.NumberFormat; import java.util.Locale; @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.2 */ -public class StringToLongConverter extends - AbstractStringToNumberConverter<Long> { +public class LegacyStringToLongConverter extends + LegacyAbstractStringToNumberConverter<Long> { /** * Returns the format used by diff --git a/server/src/main/java/com/vaadin/data/util/converter/StringToShortConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToShortConverter.java index 554b958ee0..8b1646542f 100644 --- a/server/src/main/java/com/vaadin/data/util/converter/StringToShortConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToShortConverter.java @@ -14,7 +14,7 @@ * the License. */ -package com.vaadin.data.util.converter; +package com.vaadin.legacy.data.util.converter; import java.text.NumberFormat; import java.util.Locale; @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class StringToShortConverter extends - AbstractStringToNumberConverter<Short> { +public class LegacyStringToShortConverter extends + LegacyAbstractStringToNumberConverter<Short> { /** * Returns the format used by diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java index 0c804e7247..dd45f365d0 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java @@ -16,7 +16,7 @@ package com.vaadin.legacy.data.validator; import com.vaadin.data.Property; -import com.vaadin.data.util.converter.StringToDoubleConverter; +import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; /** * String validator for a double precision floating point number. See @@ -25,7 +25,7 @@ import com.vaadin.data.util.converter.StringToDoubleConverter; * * @author Vaadin Ltd. * @since 5.4 - * @deprecated As of 7.0. Use a {@link StringToDoubleConverter} converter on the + * @deprecated As of 7.0. Use a {@link LegacyStringToDoubleConverter} converter on the * field instead or bind the field to a {@link Property} of type * {@link Double}. */ diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java index e6c2bae815..dc34215680 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java @@ -16,7 +16,7 @@ package com.vaadin.legacy.data.validator; import com.vaadin.data.Property; -import com.vaadin.data.util.converter.StringToIntegerConverter; +import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; /** * String validator for integers. See @@ -25,7 +25,7 @@ import com.vaadin.data.util.converter.StringToIntegerConverter; * * @author Vaadin Ltd. * @since 5.4 - * @deprecated As of 7.0. Use a {@link StringToIntegerConverter} converter on + * @deprecated As of 7.0. Use a {@link LegacyStringToIntegerConverter} converter on * the field instead or bind the field to a {@link Property} of type * {@link Integer}. */ diff --git a/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java index 5beada527f..402f1fb257 100644 --- a/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java +++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java @@ -33,15 +33,15 @@ import org.jsoup.nodes.Element; import com.vaadin.data.Buffered; import com.vaadin.data.Property; import com.vaadin.data.util.LegacyPropertyHelper; -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.Converter.ConversionException; -import com.vaadin.data.util.converter.ConverterUtil; import com.vaadin.event.Action; import com.vaadin.event.ShortcutAction; import com.vaadin.event.ShortcutListener; import com.vaadin.legacy.data.Validatable; import com.vaadin.legacy.data.Validator; import com.vaadin.legacy.data.Validator.InvalidValueException; +import com.vaadin.legacy.data.util.converter.LegacyConverter; +import com.vaadin.legacy.data.util.converter.LegacyConverterUtil; +import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; import com.vaadin.server.AbstractErrorMessage; import com.vaadin.server.CompositeErrorMessage; import com.vaadin.server.ErrorMessage; @@ -99,7 +99,7 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * A converter used to convert from the data model type to the field type * and vice versa. */ - private Converter<T, Object> converter = null; + private LegacyConverter<T, Object> converter = null; /** * Connected data-source. */ @@ -459,7 +459,7 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent */ @Override public void setValue(T newFieldValue) throws Property.ReadOnlyException, - Converter.ConversionException { + LegacyConverter.ConversionException { setValue(newFieldValue, false); } @@ -471,7 +471,7 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * @param repaintIsNotNeeded * True iff caller is sure that repaint is not needed. * @throws Property.ReadOnlyException - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * @throws InvalidValueException */ protected void setValue(T newFieldValue, boolean repaintIsNotNeeded) { @@ -489,12 +489,12 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * @param ignoreReadOnly * True iff if the read-only check should be ignored * @throws Property.ReadOnlyException - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * @throws InvalidValueException */ protected void setValue(T newFieldValue, boolean repaintIsNotNeeded, boolean ignoreReadOnly) throws Property.ReadOnlyException, - Converter.ConversionException, InvalidValueException { + LegacyConverter.ConversionException, InvalidValueException { if (!SharedUtil.equals(newFieldValue, getInternalValue())) { @@ -656,7 +656,7 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent // Check if the current converter is compatible. if (newDataSource != null - && !ConverterUtil.canConverterPossiblyHandle(getConverter(), + && !LegacyConverterUtil.canConverterPossiblyHandle(getConverter(), getType(), newDataSource.getType())) { // There is no converter set or there is no way the current // converter can be compatible. @@ -714,7 +714,7 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * from */ public void setConverter(Class<?> datamodelType) { - Converter<T, ?> c = (Converter<T, ?>) ConverterUtil.getConverter( + LegacyConverter<T, ?> c = (LegacyConverter<T, ?>) LegacyConverterUtil.getConverter( getType(), datamodelType, getSession()); setConverter(c); } @@ -726,7 +726,7 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * The data source value to convert. * @return The converted value that is compatible with the UI type or the * original value if its type is compatible and no converter is set. - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * if there is no converter and the type is not compatible with * the data source type. */ @@ -741,12 +741,12 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * The data source value to convert. * @return The converted value that is compatible with the UI type or the * original value if its type is compatible and no converter is set. - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * if there is no converter and the type is not compatible with * the data source type. */ private T convertFromModel(Object newValue, Locale locale) { - return ConverterUtil.convertFromModel(newValue, getType(), + return LegacyConverterUtil.convertFromModel(newValue, getType(), getConverter(), locale); } @@ -757,12 +757,12 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * The value to convert. Typically returned by * {@link #getFieldValue()} * @return The converted value that is compatible with the data source type. - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * if there is no converter and the type is not compatible with * the data source type. */ private Object convertToModel(T fieldValue) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { return convertToModel(fieldValue, getLocale()); } @@ -775,15 +775,15 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * @param locale * The locale to use for the conversion * @return The converted value that is compatible with the data source type. - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * if there is no converter and the type is not compatible with * the data source type. */ private Object convertToModel(T fieldValue, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { Class<?> modelType = getModelType(); try { - return ConverterUtil.convertToModel(fieldValue, + return LegacyConverterUtil.convertToModel(fieldValue, (Class<Object>) modelType, getConverter(), locale); } catch (ConversionException e) { throw new ConversionException(getConversionError(modelType, e), e); @@ -1727,7 +1727,7 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * * @return The converter or null if none is set. */ - public Converter<T, Object> getConverter() { + public LegacyConverter<T, Object> getConverter() { return converter; } @@ -1739,8 +1739,8 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent * @param converter * The new converter to use. */ - public void setConverter(Converter<T, ?> converter) { - this.converter = (Converter<T, Object>) converter; + public void setConverter(LegacyConverter<T, ?> converter) { + this.converter = (LegacyConverter<T, Object>) converter; markAsDirty(); } diff --git a/server/src/main/java/com/vaadin/server/VaadinSession.java b/server/src/main/java/com/vaadin/server/VaadinSession.java index d99bd75de8..d7a85cecfd 100644 --- a/server/src/main/java/com/vaadin/server/VaadinSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinSession.java @@ -47,10 +47,10 @@ import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.ConverterFactory; -import com.vaadin.data.util.converter.DefaultConverterFactory; import com.vaadin.event.EventRouter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; +import com.vaadin.legacy.data.util.converter.LegacyConverterFactory; +import com.vaadin.legacy.data.util.converter.LegacyDefaultConverterFactory; import com.vaadin.legacy.ui.LegacyAbstractField; import com.vaadin.shared.communication.PushMode; import com.vaadin.ui.Table; @@ -228,7 +228,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * The converter factory that is used to provide default converters for the * session. */ - private ConverterFactory converterFactory = new DefaultConverterFactory(); + private LegacyConverterFactory converterFactory = new LegacyDefaultConverterFactory(); private LinkedList<RequestHandler> requestHandlers = new LinkedList<RequestHandler>(); @@ -592,32 +592,32 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { } /** - * Gets the {@link ConverterFactory} used to locate a suitable - * {@link Converter} for fields in the session. + * Gets the {@link LegacyConverterFactory} used to locate a suitable + * {@link LegacyConverter} for fields in the session. * - * See {@link #setConverterFactory(ConverterFactory)} for more details + * See {@link #setConverterFactory(LegacyConverterFactory)} for more details * * @return The converter factory used in the session */ - public ConverterFactory getConverterFactory() { + public LegacyConverterFactory getConverterFactory() { assert hasLock(); return converterFactory; } /** - * Sets the {@link ConverterFactory} used to locate a suitable - * {@link Converter} for fields in the session. + * Sets the {@link LegacyConverterFactory} used to locate a suitable + * {@link LegacyConverter} for fields in the session. * <p> - * The {@link ConverterFactory} is used to find a suitable converter when + * The {@link LegacyConverterFactory} is used to find a suitable converter when * binding data to a UI component and the data type does not match the UI * component type, e.g. binding a Double to a TextField (which is based on a * String). * </p> * <p> - * The {@link Converter} for an individual field can be overridden using - * {@link LegacyAbstractField#setConverter(Converter)} and for individual property + * The {@link LegacyConverter} for an individual field can be overridden using + * {@link LegacyAbstractField#setConverter(LegacyConverter)} and for individual property * ids in a {@link Table} using - * {@link Table#setConverter(Object, Converter)}. + * {@link Table#setConverter(Object, LegacyConverter)}. * </p> * <p> * The converter factory must never be set to null. @@ -625,7 +625,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * @param converterFactory * The converter factory used in the session */ - public void setConverterFactory(ConverterFactory converterFactory) { + public void setConverterFactory(LegacyConverterFactory converterFactory) { assert hasLock(); this.converterFactory = converterFactory; } diff --git a/server/src/main/java/com/vaadin/ui/AbstractSelect.java b/server/src/main/java/com/vaadin/ui/AbstractSelect.java index 1867e2edfd..d264b01f0e 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSelect.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSelect.java @@ -35,9 +35,6 @@ import com.vaadin.data.Container; import com.vaadin.data.Item; import com.vaadin.data.Property; import com.vaadin.data.util.IndexedContainer; -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.Converter.ConversionException; -import com.vaadin.data.util.converter.ConverterUtil; import com.vaadin.event.DataBoundTransferable; import com.vaadin.event.Transferable; import com.vaadin.event.dd.DragAndDropEvent; @@ -47,6 +44,9 @@ import com.vaadin.event.dd.acceptcriteria.ClientSideCriterion; import com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor; import com.vaadin.event.dd.acceptcriteria.TargetDetailIs; import com.vaadin.legacy.data.Validator.InvalidValueException; +import com.vaadin.legacy.data.util.converter.LegacyConverter; +import com.vaadin.legacy.data.util.converter.LegacyConverterUtil; +import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; import com.vaadin.legacy.ui.LegacyAbstractField; import com.vaadin.server.KeyMapper; import com.vaadin.server.PaintException; @@ -1265,9 +1265,9 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme private String idToCaption(Object itemId) { try { - Converter<String, Object> c = (Converter<String, Object>) ConverterUtil + LegacyConverter<String, Object> c = (LegacyConverter<String, Object>) LegacyConverterUtil .getConverter(String.class, itemId.getClass(), getSession()); - return ConverterUtil.convertFromModel(itemId, String.class, c, + return LegacyConverterUtil.convertFromModel(itemId, String.class, c, getLocale()); } catch (Exception e) { return itemId.toString(); diff --git a/server/src/main/java/com/vaadin/ui/DateField.java b/server/src/main/java/com/vaadin/ui/DateField.java index f5a582f571..1630053ee1 100644 --- a/server/src/main/java/com/vaadin/ui/DateField.java +++ b/server/src/main/java/com/vaadin/ui/DateField.java @@ -29,7 +29,6 @@ import java.util.logging.Logger; import org.jsoup.nodes.Element; import com.vaadin.data.Property; -import com.vaadin.data.util.converter.Converter; 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.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.data.util.converter.LegacyConverter; import com.vaadin.legacy.ui.LegacyAbstractField; import com.vaadin.legacy.ui.LegacyField; import com.vaadin.server.PaintException; @@ -558,7 +558,7 @@ public class DateField extends LegacyAbstractField<Date> implements * this case the invalid text remains in the DateField. */ markAsDirty(); - } catch (Converter.ConversionException e) { + } catch (LegacyConverter.ConversionException e) { /* * Datefield now contains some text that could't be parsed @@ -659,13 +659,13 @@ public class DateField extends LegacyAbstractField<Date> implements * * @param dateString * @return parsed Date - * @throws Converter.ConversionException + * @throws LegacyConverter.ConversionException * to keep the old value and indicate an error */ protected Date handleUnparsableDateString(String dateString) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { currentParseErrorMessage = null; - throw new Converter.ConversionException(getParseErrorMessage()); + throw new LegacyConverter.ConversionException(getParseErrorMessage()); } /* Property features */ diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 592175eeff..1319f868c7 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -60,8 +60,6 @@ import com.vaadin.data.fieldgroup.FieldGroupFieldFactory; import com.vaadin.data.sort.Sort; import com.vaadin.data.sort.SortOrder; import com.vaadin.data.util.IndexedContainer; -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.ConverterUtil; import com.vaadin.event.ContextClickEvent; import com.vaadin.event.ItemClickEvent; import com.vaadin.event.ItemClickEvent.ItemClickListener; @@ -73,6 +71,8 @@ import com.vaadin.event.SortEvent; import com.vaadin.event.SortEvent.SortListener; import com.vaadin.event.SortEvent.SortNotifier; import com.vaadin.legacy.data.Validator.InvalidValueException; +import com.vaadin.legacy.data.util.converter.LegacyConverter; +import com.vaadin.legacy.data.util.converter.LegacyConverterUtil; import com.vaadin.legacy.ui.LegacyField; import com.vaadin.server.AbstractClientConnector; import com.vaadin.server.AbstractExtension; @@ -133,7 +133,7 @@ import elemental.json.JsonValue; * <p> * Each column has its own {@link Renderer} that displays data into something * that can be displayed in the browser. That data is first converted with a - * {@link com.vaadin.data.util.converter.Converter Converter} into something + * {@link com.vaadin.legacy.data.util.converter.LegacyConverter Converter} into something * that the Renderer can process. This can also be an implicit step - if a * column has a simple data type, like a String, no explicit assignment is * needed. @@ -2196,7 +2196,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, private void writeData(CellReference cell, JsonObject data) { Column column = getColumn(cell.getPropertyId()); - Converter<?, ?> converter = column.getConverter(); + LegacyConverter<?, ?> converter = column.getConverter(); Renderer<?> renderer = column.getRenderer(); Item item = cell.getItem(); @@ -3216,12 +3216,12 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, */ private final Object propertyId; - private Converter<?, Object> converter; + private LegacyConverter<?, Object> converter; /** * A check for allowing the * {@link #Column(Grid, GridColumnState, Object) constructor} to call - * {@link #setConverter(Converter)} with a <code>null</code>, even if + * {@link #setConverter(LegacyConverter)} with a <code>null</code>, even if * model and renderer aren't compatible. */ private boolean isFirstConverterAssignment = true; @@ -3462,8 +3462,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * if no compatible converter could be found * * @see VaadinSession#getConverterFactory() - * @see ConverterUtil#getConverter(Class, Class, VaadinSession) - * @see #setConverter(Converter) + * @see LegacyConverterUtil#getConverter(Class, Class, VaadinSession) + * @see #setConverter(LegacyConverter) */ public Column setRenderer(Renderer<?> renderer) { if (!internalSetRenderer(renderer)) { @@ -3491,7 +3491,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * if the renderer is already associated with a grid column */ public <T> Column setRenderer(Renderer<T> renderer, - Converter<? extends T, ?> converter) { + LegacyConverter<? extends T, ?> converter) { if (renderer.getParent() != null) { throw new IllegalArgumentException( "Cannot set a renderer that is already connected to a grid column (in " @@ -3520,7 +3520,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * @throws IllegalArgumentException * if the types are not compatible */ - public Column setConverter(Converter<?, ?> converter) + public Column setConverter(LegacyConverter<?, ?> converter) throws IllegalArgumentException { Class<?> modelType = getModelType(); if (converter != null) { @@ -3574,7 +3574,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, isFirstConverterAssignment = false; @SuppressWarnings("unchecked") - Converter<?, Object> castConverter = (Converter<?, Object>) converter; + LegacyConverter<?, Object> castConverter = (LegacyConverter<?, Object>) converter; this.converter = castConverter; return this; @@ -3594,19 +3594,19 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * * @return the converter */ - public Converter<?, ?> getConverter() { + public LegacyConverter<?, ?> getConverter() { return converter; } private <T> boolean internalSetRenderer(Renderer<T> renderer) { - Converter<? extends T, ?> converter; + LegacyConverter<? extends T, ?> converter; if (isCompatibleWithProperty(renderer, getConverter())) { // Use the existing converter (possibly none) if types // compatible - converter = (Converter<? extends T, ?>) getConverter(); + converter = (LegacyConverter<? extends T, ?>) getConverter(); } else { - converter = ConverterUtil.getConverter( + converter = LegacyConverterUtil.getConverter( renderer.getPresentationType(), getModelType(), getSession()); } @@ -3620,7 +3620,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } private boolean isCompatibleWithProperty(Renderer<?> renderer, - Converter<?, ?> converter) { + LegacyConverter<?, ?> converter) { Class<?> type; if (converter == null) { type = getModelType(); @@ -4231,7 +4231,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * @return an encoded value ready to be sent to the client */ public static <T> JsonValue encodeValue(Object modelValue, - Renderer<T> renderer, Converter<?, ?> converter, + Renderer<T> renderer, LegacyConverter<?, ?> converter, Locale locale) { Class<T> presentationType = renderer.getPresentationType(); T presentationValue; @@ -4246,7 +4246,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, // Class.cast(null) will always succeed presentationValue = (T) modelValue.toString(); } else { - throw new Converter.ConversionException( + throw new LegacyConverter.ConversionException( "Unable to convert value of type " + modelValue.getClass().getName() + " to presentation type " @@ -4258,7 +4258,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, assert presentationType.isAssignableFrom(converter .getPresentationType()); @SuppressWarnings("unchecked") - Converter<T, Object> safeConverter = (Converter<T, Object>) converter; + LegacyConverter<T, Object> safeConverter = (LegacyConverter<T, Object>) converter; presentationValue = safeConverter .convertToPresentation(modelValue, safeConverter.getPresentationType(), locale); diff --git a/server/src/main/java/com/vaadin/ui/Label.java b/server/src/main/java/com/vaadin/ui/Label.java index 1498246ec5..97b6648977 100644 --- a/server/src/main/java/com/vaadin/ui/Label.java +++ b/server/src/main/java/com/vaadin/ui/Label.java @@ -25,8 +25,8 @@ import org.jsoup.nodes.Element; import com.vaadin.data.Property; import com.vaadin.data.util.AbstractProperty; import com.vaadin.data.util.LegacyPropertyHelper; -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.ConverterUtil; +import com.vaadin.legacy.data.util.converter.LegacyConverter; +import com.vaadin.legacy.data.util.converter.LegacyConverterUtil; import com.vaadin.shared.ui.label.ContentMode; import com.vaadin.shared.ui.label.LabelState; import com.vaadin.shared.util.SharedUtil; @@ -100,7 +100,7 @@ public class Label extends AbstractComponent implements Property<String>, * A converter used to convert from the data model type to the field type * and vice versa. Label type is always String. */ - private Converter<String, Object> converter = null; + private LegacyConverter<String, Object> converter = null; private Property<String> dataSource = null; @@ -190,7 +190,7 @@ public class Label extends AbstractComponent implements Property<String>, * @return */ private String getDataSourceValue() { - return ConverterUtil.convertFromModel(getPropertyDataSource() + return LegacyConverterUtil.convertFromModel(getPropertyDataSource() .getValue(), String.class, getConverter(), getLocale()); } @@ -258,11 +258,11 @@ public class Label extends AbstractComponent implements Property<String>, // Check if the current converter is compatible. if (newDataSource != null - && !ConverterUtil.canConverterPossiblyHandle(getConverter(), + && !LegacyConverterUtil.canConverterPossiblyHandle(getConverter(), getType(), newDataSource.getType())) { // There is no converter set or there is no way the current // converter can be compatible. - Converter<String, ?> c = ConverterUtil.getConverter(String.class, + LegacyConverter<String, ?> c = LegacyConverterUtil.getConverter(String.class, newDataSource.getType(), getSession()); setConverter(c); } @@ -528,7 +528,7 @@ public class Label extends AbstractComponent implements Property<String>, * * @return The converter or null if none is set. */ - public Converter<String, Object> getConverter() { + public LegacyConverter<String, Object> getConverter() { return converter; } @@ -539,8 +539,8 @@ public class Label extends AbstractComponent implements Property<String>, * @param converter * The new converter to use. */ - public void setConverter(Converter<String, ?> converter) { - this.converter = (Converter<String, Object>) converter; + public void setConverter(LegacyConverter<String, ?> converter) { + this.converter = (LegacyConverter<String, Object>) converter; markAsDirty(); } diff --git a/server/src/main/java/com/vaadin/ui/Table.java b/server/src/main/java/com/vaadin/ui/Table.java index 4e85b9e028..b60fe473b1 100644 --- a/server/src/main/java/com/vaadin/ui/Table.java +++ b/server/src/main/java/com/vaadin/ui/Table.java @@ -42,8 +42,6 @@ import com.vaadin.data.Item; import com.vaadin.data.Property; import com.vaadin.data.util.ContainerOrderedWrapper; import com.vaadin.data.util.IndexedContainer; -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.ConverterUtil; import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.ContextClickEvent; @@ -57,6 +55,8 @@ import com.vaadin.event.dd.DragSource; import com.vaadin.event.dd.DropHandler; import com.vaadin.event.dd.DropTarget; import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion; +import com.vaadin.legacy.data.util.converter.LegacyConverter; +import com.vaadin.legacy.data.util.converter.LegacyConverterUtil; import com.vaadin.legacy.ui.LegacyField; import com.vaadin.server.KeyMapper; import com.vaadin.server.LegacyCommunicationManager; @@ -586,7 +586,7 @@ public class Table extends AbstractSelect implements Action.Container, private boolean painted = false; - private HashMap<Object, Converter<String, Object>> propertyValueConverters = new HashMap<Object, Converter<String, Object>>(); + private HashMap<Object, LegacyConverter<String, Object>> propertyValueConverters = new HashMap<Object, LegacyConverter<String, Object>>(); /** * Set to true if the client-side should be informed that the key mapper has @@ -2777,7 +2777,7 @@ public class Table extends AbstractSelect implements Action.Container, .getContainerPropertyIds(); LinkedList<Object> retainableValueConverters = new LinkedList<Object>(); for (Object propertyId : newPropertyIds) { - Converter<String, ?> converter = getConverter(propertyId); + LegacyConverter<String, ?> converter = getConverter(propertyId); if (converter != null) { if (typeIsCompatible(converter.getModelType(), newDataSource.getType(propertyId))) { @@ -4163,12 +4163,12 @@ public class Table extends AbstractSelect implements Action.Container, if (property == null) { return ""; } - Converter<String, Object> converter = null; + LegacyConverter<String, Object> converter = null; if (hasConverter(colId)) { converter = getConverter(colId); } else { - converter = (Converter) ConverterUtil.getConverter(String.class, + converter = (LegacyConverter) LegacyConverterUtil.getConverter(String.class, property.getType(), getSession()); } Object value = property.getValue(); @@ -6071,7 +6071,7 @@ public class Table extends AbstractSelect implements Action.Container, * @param converter * The converter to use for the property id */ - public void setConverter(Object propertyId, Converter<String, ?> converter) { + public void setConverter(Object propertyId, LegacyConverter<String, ?> converter) { if (!getContainerPropertyIds().contains(propertyId)) { throw new IllegalArgumentException("PropertyId " + propertyId + " must be in the container"); @@ -6084,7 +6084,7 @@ public class Table extends AbstractSelect implements Action.Container, + converter.getModelType() + ")"); } propertyValueConverters.put(propertyId, - (Converter<String, Object>) converter); + (LegacyConverter<String, Object>) converter); refreshRowCache(); } @@ -6108,7 +6108,7 @@ public class Table extends AbstractSelect implements Action.Container, * @return The converter used to format the propertyId or null if no * converter has been set */ - public Converter<String, Object> getConverter(Object propertyId) { + public LegacyConverter<String, Object> getConverter(Object propertyId) { return propertyValueConverters.get(propertyId); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java index bbfd90b2cc..35cbf755d4 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -36,7 +36,7 @@ import org.jsoup.nodes.Attributes; import org.jsoup.nodes.Element; import org.jsoup.nodes.Node; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; import com.vaadin.shared.ui.AlignmentInfo; import com.vaadin.shared.util.SharedUtil; import com.vaadin.ui.Alignment; @@ -381,7 +381,7 @@ public class DesignAttributeHandler implements Serializable { // value is not null. How to represent null value in attributes? return ""; } - Converter<String, Object> converter = getFormatter().findConverterFor( + LegacyConverter<String, Object> converter = getFormatter().findConverterFor( sourceType); if (converter != null) { return converter.convertToPresentation(value, String.class, null); diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java index 509015130d..c5b67a06d8 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java @@ -30,11 +30,11 @@ import java.util.concurrent.ConcurrentHashMap; import org.jsoup.parser.Parser; -import com.vaadin.data.util.converter.Converter; -import com.vaadin.data.util.converter.StringToBigDecimalConverter; -import com.vaadin.data.util.converter.StringToDoubleConverter; -import com.vaadin.data.util.converter.StringToFloatConverter; import com.vaadin.event.ShortcutAction; +import com.vaadin.legacy.data.util.converter.LegacyConverter; +import com.vaadin.legacy.data.util.converter.LegacyStringToBigDecimalConverter; +import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; +import com.vaadin.legacy.data.util.converter.LegacyStringToFloatConverter; import com.vaadin.server.Resource; import com.vaadin.ui.AbstractSelect; import com.vaadin.ui.declarative.converters.DesignDateConverter; @@ -55,9 +55,9 @@ import com.vaadin.ui.declarative.converters.DesignToStringConverter; */ public class DesignFormatter implements Serializable { - private final Map<Class<?>, Converter<String, ?>> converterMap = new ConcurrentHashMap<Class<?>, Converter<String, ?>>(); - private final Converter<String, Enum> stringEnumConverter = new DesignEnumConverter(); - private final Converter<String, Object> stringObjectConverter = new DesignObjectConverter(); + private final Map<Class<?>, LegacyConverter<String, ?>> converterMap = new ConcurrentHashMap<Class<?>, LegacyConverter<String, ?>>(); + private final LegacyConverter<String, Enum> stringEnumConverter = new DesignEnumConverter(); + private final LegacyConverter<String, Object> stringObjectConverter = new DesignObjectConverter(); /** * Creates the formatter with default types already mapped. @@ -84,19 +84,19 @@ public class DesignFormatter implements Serializable { } // booleans use a bit different converter than the standard one // "false" is boolean false, everything else is boolean true - Converter<String, Boolean> booleanConverter = new Converter<String, Boolean>() { + LegacyConverter<String, Boolean> booleanConverter = new LegacyConverter<String, Boolean>() { @Override public Boolean convertToModel(String value, Class<? extends Boolean> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { return !value.equalsIgnoreCase("false"); } @Override public String convertToPresentation(Boolean value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (value.booleanValue()) { return ""; } else { @@ -124,7 +124,7 @@ public class DesignFormatter implements Serializable { final DecimalFormat fmt = new DecimalFormat("0.###", symbols); fmt.setGroupingUsed(false); - Converter<String, ?> floatConverter = new StringToFloatConverter() { + LegacyConverter<String, ?> floatConverter = new LegacyStringToFloatConverter() { @Override protected NumberFormat getFormat(Locale locale) { return fmt; @@ -133,7 +133,7 @@ public class DesignFormatter implements Serializable { converterMap.put(Float.class, floatConverter); converterMap.put(float.class, floatConverter); - Converter<String, ?> doubleConverter = new StringToDoubleConverter() { + LegacyConverter<String, ?> doubleConverter = new LegacyStringToDoubleConverter() { @Override protected NumberFormat getFormat(Locale locale) { return fmt; @@ -145,7 +145,7 @@ public class DesignFormatter implements Serializable { final DecimalFormat bigDecimalFmt = new DecimalFormat("0.###", symbols); bigDecimalFmt.setGroupingUsed(false); bigDecimalFmt.setParseBigDecimal(true); - converterMap.put(BigDecimal.class, new StringToBigDecimalConverter() { + converterMap.put(BigDecimal.class, new LegacyStringToBigDecimalConverter() { @Override protected NumberFormat getFormat(Locale locale) { return bigDecimalFmt; @@ -153,19 +153,19 @@ public class DesignFormatter implements Serializable { }); // strings do nothing - converterMap.put(String.class, new Converter<String, String>() { + converterMap.put(String.class, new LegacyConverter<String, String>() { @Override public String convertToModel(String value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { return value; } @Override public String convertToPresentation(String value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { return value; } @@ -182,13 +182,13 @@ public class DesignFormatter implements Serializable { }); // char takes the first character from the string - Converter<String, Character> charConverter = new DesignToStringConverter<Character>( + LegacyConverter<String, Character> charConverter = new DesignToStringConverter<Character>( Character.class) { @Override public Character convertToModel(String value, Class<? extends Character> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { return value.charAt(0); } @@ -209,7 +209,7 @@ public class DesignFormatter implements Serializable { * @param converter * Converter to add. */ - protected <T> void addConverter(Converter<String, T> converter) { + protected <T> void addConverter(LegacyConverter<String, T> converter) { converterMap.put(converter.getModelType(), converter); } @@ -222,7 +222,7 @@ public class DesignFormatter implements Serializable { * Converter. */ protected <T> void addConverter(Class<?> type, - Converter<String, ?> converter) { + LegacyConverter<String, ?> converter) { converterMap.put(type, converter); } @@ -258,7 +258,7 @@ public class DesignFormatter implements Serializable { * converter for that type. */ public <T> T parse(String value, Class<? extends T> type) { - Converter<String, T> converter = findConverterFor(type); + LegacyConverter<String, T> converter = findConverterFor(type); if (converter != null) { return converter.convertToModel(value, type, null); } else { @@ -292,7 +292,7 @@ public class DesignFormatter implements Serializable { if (object == null) { return null; } else { - Converter<String, Object> converter = findConverterFor(object + LegacyConverter<String, Object> converter = findConverterFor(object .getClass()); return converter.convertToPresentation(object, String.class, null); } @@ -325,27 +325,27 @@ public class DesignFormatter implements Serializable { * if it was not found. */ @SuppressWarnings("unchecked") - protected <T> Converter<String, T> findConverterFor( + protected <T> LegacyConverter<String, T> findConverterFor( Class<? extends T> sourceType, boolean strict) { if (sourceType == Object.class) { // Use for propertyIds, itemIds and such. Only string type objects // are really supported if no special logic is implemented in the // component. - return (Converter<String, T>) stringObjectConverter; + return (LegacyConverter<String, T>) stringObjectConverter; } if (converterMap.containsKey(sourceType)) { - return ((Converter<String, T>) converterMap.get(sourceType)); + return ((LegacyConverter<String, T>) converterMap.get(sourceType)); } else if (!strict) { for (Class<?> supported : converterMap.keySet()) { if (supported.isAssignableFrom(sourceType)) { - return ((Converter<String, T>) converterMap.get(supported)); + return ((LegacyConverter<String, T>) converterMap.get(supported)); } } } if (sourceType.isEnum()) { - return (Converter<String, T>) stringEnumConverter; + return (LegacyConverter<String, T>) stringEnumConverter; } return null; } @@ -359,7 +359,7 @@ public class DesignFormatter implements Serializable { * @return A valid converter for a given type or its subtype, <b>null</b> if * it was not found. */ - protected <T> Converter<String, T> findConverterFor( + protected <T> LegacyConverter<String, T> findConverterFor( Class<? extends T> sourceType) { return findConverterFor(sourceType, false); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignDateConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignDateConverter.java index d2d63ad16e..5fc7c239e1 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignDateConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignDateConverter.java @@ -20,7 +20,7 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; import com.vaadin.ui.declarative.DesignAttributeHandler; /** @@ -30,11 +30,11 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @since 7.4 * @author Vaadin Ltd */ -public class DesignDateConverter implements Converter<String, Date> { +public class DesignDateConverter implements LegacyConverter<String, Date> { @Override public Date convertToModel(String value, Class<? extends Date> targetType, - Locale locale) throws Converter.ConversionException { + Locale locale) throws LegacyConverter.ConversionException { for (String pattern : new String[] { "yyyy-MM-dd HH:mm:ssZ", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd HH", "yyyy-MM-dd", "yyyy-MM", "yyyy" }) { @@ -50,7 +50,7 @@ public class DesignDateConverter implements Converter<String, Date> { @Override public String convertToPresentation(Date value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ").format(value); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java index 9f07ff9560..1f14c0571d 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java @@ -17,7 +17,7 @@ package com.vaadin.ui.declarative.converters; import java.util.Locale; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; import com.vaadin.ui.declarative.DesignAttributeHandler; /** @@ -27,12 +27,12 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @since 7.4 * @author Vaadin Ltd */ -public class DesignEnumConverter implements Converter<String, Enum> { +public class DesignEnumConverter implements LegacyConverter<String, Enum> { @Override public Enum convertToModel(String value, Class<? extends Enum> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { if (value == null || value.trim().equals("")) { return null; } @@ -42,7 +42,7 @@ public class DesignEnumConverter implements Converter<String, Enum> { @Override public String convertToPresentation(Enum value, Class<? extends String> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { if (value == null) { return null; } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignObjectConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignObjectConverter.java index f11585d6b8..cb950aa821 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignObjectConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignObjectConverter.java @@ -17,7 +17,7 @@ package com.vaadin.ui.declarative.converters; import java.util.Locale; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; import com.vaadin.ui.declarative.DesignAttributeHandler; /** @@ -27,19 +27,19 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @since 7.4 * @author Vaadin Ltd */ -public class DesignObjectConverter implements Converter<String, Object> { +public class DesignObjectConverter implements LegacyConverter<String, Object> { @Override public Object convertToModel(String value, Class<? extends Object> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { return value; } @Override public String convertToPresentation(Object value, Class<? extends String> targetType, Locale locale) - throws com.vaadin.data.util.converter.Converter.ConversionException { + throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { if (value == null) { return null; } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index ffa51fedd1..57a1682261 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -21,7 +21,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; import com.vaadin.server.ExternalResource; import com.vaadin.server.FileResource; import com.vaadin.server.FontAwesome; @@ -40,12 +40,12 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @author Vaadin Ltd */ @SuppressWarnings("serial") -public class DesignResourceConverter implements Converter<String, Resource> { +public class DesignResourceConverter implements LegacyConverter<String, Resource> { @Override public Resource convertToModel(String value, Class<? extends Resource> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (!value.contains("://")) { // assume it'is "file://" protocol, one that is used to access a // file on a given path on the server, this will later be striped @@ -67,13 +67,13 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String convertToPresentation(Resource value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { ResourceConverterByProtocol byType = ResourceConverterByProtocol .byType(value.getClass()); if (byType != null) { return byType.format(value); } else { - throw new Converter.ConversionException("unknown Resource type - " + throw new LegacyConverter.ConversionException("unknown Resource type - " + value.getClass().getName()); } } @@ -108,7 +108,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String format(Resource value) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { return new ResourceReference(value, null, null).getURL(); } }, @@ -137,7 +137,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String format(Resource value) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { FontIcon icon = (FontIcon) value; return new ResourceReference(icon, null, null).getURL(); @@ -161,7 +161,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String format(Resource value) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { throw new UnsupportedOperationException("Use " + ResourceConverterByProtocol.FONTICON.toString() + " instead"); @@ -175,7 +175,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String format(Resource value) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { String path = ((FileResource) value).getSourceFile().getPath(); if (File.separatorChar != '/') { // make sure we use '/' as file separator in templates @@ -195,7 +195,7 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String format(Resource value) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { // default behavior for HTTP, HTTPS, FTP and FTPS return ((ExternalResource) value).getURL(); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java index d6f2f65938..e310222d46 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java @@ -21,10 +21,10 @@ import java.util.Locale; import java.util.Map; import java.util.Map.Entry; -import com.vaadin.data.util.converter.Converter; import com.vaadin.event.ShortcutAction; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.event.ShortcutAction.ModifierKey; +import com.vaadin.legacy.data.util.converter.LegacyConverter; /** * Converter for {@link ShortcutActions}. @@ -33,7 +33,7 @@ import com.vaadin.event.ShortcutAction.ModifierKey; * @author Vaadin Ltd */ public class DesignShortcutActionConverter implements - Converter<String, ShortcutAction> { + LegacyConverter<String, ShortcutAction> { private final Map<Integer, String> keyCodeMap; private final Map<String, Integer> presentationMap; @@ -122,7 +122,7 @@ public class DesignShortcutActionConverter implements @Override public ShortcutAction convertToModel(String value, Class<? extends ShortcutAction> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (value.length() == 0) { return null; } @@ -162,7 +162,7 @@ public class DesignShortcutActionConverter implements @Override public String convertToPresentation(ShortcutAction value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { StringBuilder sb = new StringBuilder(); // handle modifiers if (value.getModifiers() != null) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java index 51f47edac9..a15231b10f 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java @@ -18,7 +18,7 @@ package com.vaadin.ui.declarative.converters; import java.util.Locale; import java.util.TimeZone; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; import com.vaadin.ui.declarative.DesignAttributeHandler; /** @@ -28,12 +28,12 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @since 7.4 * @author Vaadin Ltd */ -public class DesignTimeZoneConverter implements Converter<String, TimeZone> { +public class DesignTimeZoneConverter implements LegacyConverter<String, TimeZone> { @Override public TimeZone convertToModel(String value, Class<? extends TimeZone> targetTimeZone, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (value == null || value.isEmpty()) { return null; } @@ -44,7 +44,7 @@ public class DesignTimeZoneConverter implements Converter<String, TimeZone> { @Override public String convertToPresentation(TimeZone value, Class<? extends String> targetTimeZone, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (value == null) { return ""; } else { diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java index 0c6cf55bed..0af6905dc8 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java @@ -18,7 +18,7 @@ package com.vaadin.ui.declarative.converters; import java.lang.reflect.InvocationTargetException; import java.util.Locale; -import com.vaadin.data.util.converter.Converter; +import com.vaadin.legacy.data.util.converter.LegacyConverter; import com.vaadin.ui.declarative.DesignAttributeHandler; /** @@ -30,7 +30,7 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @param <TYPE> * Type of the data being converted. */ -public class DesignToStringConverter<TYPE> implements Converter<String, TYPE> { +public class DesignToStringConverter<TYPE> implements LegacyConverter<String, TYPE> { private final Class<? extends TYPE> type; @@ -72,30 +72,30 @@ public class DesignToStringConverter<TYPE> implements Converter<String, TYPE> { @Override public TYPE convertToModel(String value, Class<? extends TYPE> targetType, - Locale locale) throws Converter.ConversionException { + Locale locale) throws LegacyConverter.ConversionException { try { return type.cast(type .getMethod(this.staticMethodName, String.class).invoke( null, value)); } catch (IllegalAccessException e) { - throw new Converter.ConversionException(e); + throw new LegacyConverter.ConversionException(e); } catch (IllegalArgumentException e) { - throw new Converter.ConversionException(e); + throw new LegacyConverter.ConversionException(e); } catch (InvocationTargetException e) { - throw new Converter.ConversionException(e.getCause()); + throw new LegacyConverter.ConversionException(e.getCause()); } catch (NoSuchMethodException e) { - throw new Converter.ConversionException(e); + throw new LegacyConverter.ConversionException(e); } catch (SecurityException e) { - throw new Converter.ConversionException(e); + throw new LegacyConverter.ConversionException(e); } catch (RuntimeException e) { - throw new Converter.ConversionException(e); + throw new LegacyConverter.ConversionException(e); } } @Override public String convertToPresentation(TYPE value, Class<? extends String> targetType, Locale locale) - throws Converter.ConversionException { + throws LegacyConverter.ConversionException { if (value == null) { return NULL_VALUE_REPRESENTATION; } else { |