Change-Id: I75fd33e66c8c5c265bc60cce58ff639a5d5642abtags/8.0.0.alpha1
@@ -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 | |||
*/ |
@@ -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 |
@@ -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)} |
@@ -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 |
@@ -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); | |||
} |
@@ -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; |
@@ -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) |
@@ -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, |
@@ -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; | |||
} |
@@ -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); | |||
} | |||
@@ -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); | |||
} | |||
@@ -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); |
@@ -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; | |||
} |
@@ -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 |
@@ -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 { |
@@ -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; | |||
} |
@@ -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) |
@@ -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, |
@@ -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) |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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}. | |||
*/ |
@@ -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}. | |||
*/ |
@@ -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(); | |||
} | |||
@@ -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; | |||
} |
@@ -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(); |
@@ -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 */ |
@@ -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); |
@@ -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(); | |||
} | |||
@@ -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); | |||
} | |||
@@ -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); |
@@ -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); | |||
} |
@@ -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); | |||
} | |||
@@ -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; | |||
} |
@@ -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; | |||
} |
@@ -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(); | |||
} |
@@ -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) { |
@@ -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 { |
@@ -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 { |
@@ -23,15 +23,15 @@ import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.ReverseConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyReverseConverter; | |||
import com.vaadin.tests.data.bean.AnotherTestEnum; | |||
import com.vaadin.tests.data.bean.TestEnum; | |||
import com.vaadin.ui.TextField; | |||
public class AnyEnumToStringConverterTest { | |||
public class AnyEnumToStringConverter implements Converter<Enum, String> { | |||
public class AnyEnumToStringConverter implements LegacyConverter<Enum, String> { | |||
public AnyEnumToStringConverter() { | |||
} | |||
@@ -39,7 +39,7 @@ public class AnyEnumToStringConverterTest { | |||
@Override | |||
public String convertToModel(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; | |||
} | |||
@@ -50,7 +50,7 @@ public class AnyEnumToStringConverterTest { | |||
@Override | |||
public Enum convertToPresentation(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) { | |||
return null; | |||
} | |||
@@ -107,7 +107,7 @@ public class AnyEnumToStringConverterTest { | |||
@Test | |||
public void stringToEnumWithField() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new ReverseConverter(converter)); | |||
tf.setConverter(new LegacyReverseConverter(converter)); | |||
tf.setPropertyDataSource(new ObjectProperty(AnotherTestEnum.TWO)); | |||
Assert.assertEquals(AnotherTestEnum.TWO.toString(), tf.getValue()); | |||
tf.setValue(AnotherTestEnum.ONE.toString()); |
@@ -20,27 +20,27 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.DefaultConverterFactory; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyDefaultConverterFactory; | |||
import com.vaadin.server.VaadinSession; | |||
import com.vaadin.tests.util.AlwaysLockedVaadinSession; | |||
import com.vaadin.ui.TextField; | |||
public class ConverterFactoryTest { | |||
public static class ConvertTo42 implements Converter<String, Integer> { | |||
public static class ConvertTo42 implements LegacyConverter<String, Integer> { | |||
@Override | |||
public Integer convertToModel(String value, | |||
Class<? extends Integer> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return 42; | |||
} | |||
@Override | |||
public String convertToPresentation(Integer value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "42"; | |||
} | |||
@@ -56,12 +56,12 @@ public class ConverterFactoryTest { | |||
} | |||
public static class ConverterFactory42 extends DefaultConverterFactory { | |||
public static class ConverterFactory42 extends LegacyDefaultConverterFactory { | |||
@Override | |||
public <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> createConverter( | |||
public <PRESENTATION, MODEL> LegacyConverter<PRESENTATION, MODEL> createConverter( | |||
Class<PRESENTATION> presentationType, Class<MODEL> modelType) { | |||
if (modelType == Integer.class) { | |||
return (Converter<PRESENTATION, MODEL>) new ConvertTo42(); | |||
return (LegacyConverter<PRESENTATION, MODEL>) new ConvertTo42(); | |||
} | |||
return super.createConverter(presentationType, modelType); |
@@ -5,11 +5,11 @@ import java.util.Date; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.DateToLongConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyDateToLongConverter; | |||
public class DateToLongConverterTest { | |||
DateToLongConverter converter = new DateToLongConverter(); | |||
LegacyDateToLongConverter converter = new LegacyDateToLongConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -6,11 +6,11 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.DateToSqlDateConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyDateToSqlDateConverter; | |||
public class DateToSqlDateConverterTest { | |||
DateToSqlDateConverter converter = new DateToSqlDateConverter(); | |||
LegacyDateToSqlDateConverter converter = new LegacyDateToSqlDateConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -23,11 +23,11 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.DefaultConverterFactory; | |||
import com.vaadin.legacy.data.util.converter.LegacyDefaultConverterFactory; | |||
public class DefaultConverterFactoryTest { | |||
private DefaultConverterFactory factory = new DefaultConverterFactory(); | |||
private LegacyDefaultConverterFactory factory = new LegacyDefaultConverterFactory(); | |||
@Test | |||
public void stringToBigDecimal() { |
@@ -23,8 +23,8 @@ import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.ReverseConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyReverseConverter; | |||
import com.vaadin.tests.data.bean.AnotherTestEnum; | |||
import com.vaadin.tests.data.bean.TestEnum; | |||
import com.vaadin.ui.TextField; | |||
@@ -32,7 +32,7 @@ import com.vaadin.ui.TextField; | |||
public class SpecificEnumToStringConverterTest { | |||
public class SpecificEnumToStringConverter implements | |||
Converter<Enum, String> { | |||
LegacyConverter<Enum, String> { | |||
private Class<? extends Enum> enumClass; | |||
@@ -43,7 +43,7 @@ public class SpecificEnumToStringConverterTest { | |||
@Override | |||
public String convertToModel(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; | |||
} | |||
@@ -54,7 +54,7 @@ public class SpecificEnumToStringConverterTest { | |||
@Override | |||
public Enum convertToPresentation(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) { | |||
return null; | |||
} | |||
@@ -112,7 +112,7 @@ public class SpecificEnumToStringConverterTest { | |||
@Test | |||
public void stringToEnumWithField() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new ReverseConverter(anotherTestEnumConverter)); | |||
tf.setConverter(new LegacyReverseConverter(anotherTestEnumConverter)); | |||
tf.setPropertyDataSource(new ObjectProperty(AnotherTestEnum.TWO)); | |||
Assert.assertEquals(AnotherTestEnum.TWO.toString(), tf.getValue()); | |||
tf.setValue(AnotherTestEnum.ONE.toString()); |
@@ -21,11 +21,11 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToBigDecimalConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToBigDecimalConverter; | |||
public class StringToBigDecimalConverterTest { | |||
StringToBigDecimalConverter converter = new StringToBigDecimalConverter(); | |||
LegacyStringToBigDecimalConverter converter = new LegacyStringToBigDecimalConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -21,11 +21,11 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToBigIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToBigIntegerConverter; | |||
public class StringToBigIntegerConverterTest { | |||
StringToBigIntegerConverter converter = new StringToBigIntegerConverter(); | |||
LegacyStringToBigIntegerConverter converter = new LegacyStringToBigIntegerConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -7,14 +7,14 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToBooleanConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToBooleanConverter; | |||
public class StringToBooleanConverterTest { | |||
StringToBooleanConverter converter = new StringToBooleanConverter(); | |||
StringToBooleanConverter yesNoConverter = new StringToBooleanConverter( | |||
LegacyStringToBooleanConverter converter = new LegacyStringToBooleanConverter(); | |||
LegacyStringToBooleanConverter yesNoConverter = new LegacyStringToBooleanConverter( | |||
"yes", "no"); | |||
StringToBooleanConverter localeConverter = new StringToBooleanConverter() { | |||
LegacyStringToBooleanConverter localeConverter = new LegacyStringToBooleanConverter() { | |||
@Override | |||
public String getFalseString(Locale locale) { | |||
Date d = new Date(3000000000000L); |
@@ -3,15 +3,15 @@ package com.vaadin.tests.data.converter; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.data.util.converter.ReverseConverter; | |||
import com.vaadin.data.util.converter.StringToByteConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyReverseConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToByteConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
public class StringToByteConverterTest { | |||
StringToByteConverter converter = new StringToByteConverter(); | |||
Converter<Byte, String> reverseConverter = new ReverseConverter<Byte, String>( | |||
LegacyStringToByteConverter converter = new LegacyStringToByteConverter(); | |||
LegacyConverter<Byte, String> reverseConverter = new LegacyReverseConverter<Byte, String>( | |||
converter); | |||
@Test |
@@ -29,13 +29,13 @@ import java.util.Vector; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToCollectionConverter; | |||
import com.vaadin.data.util.converter.StringToCollectionConverter.CollectionFactory; | |||
import com.vaadin.data.util.converter.StringToEnumConverter; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToCollectionConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToEnumConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToCollectionConverter.CollectionFactory; | |||
/** | |||
* Tests for {@link StringToCollectionConverter}. | |||
* Tests for {@link LegacyStringToCollectionConverter}. | |||
* | |||
* @author Vaadin Ltd | |||
*/ | |||
@@ -43,7 +43,7 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToModel_defaultCtor() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter(); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter(); | |||
Collection<?> model = converter.convertToModel("a, b, c", List.class, | |||
null); | |||
Assert.assertTrue("Unexpected model class", model instanceof ArrayList); | |||
@@ -55,7 +55,7 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToModel_customDelimiter() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter( | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter( | |||
"x"); | |||
Collection<?> model = converter.convertToModel("axbxc", List.class, | |||
null); | |||
@@ -68,8 +68,8 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToModel_customConverter() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter( | |||
",", new StringToIntegerConverter(), Integer.class); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter( | |||
",", new LegacyStringToIntegerConverter(), Integer.class); | |||
Collection<?> model = converter.convertToModel("6,2,5", List.class, | |||
null); | |||
Assert.assertTrue("Unexpected model class", model instanceof ArrayList); | |||
@@ -81,8 +81,8 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToModel_setAsCollection() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter( | |||
" ", new StringToEnumConverter(), TestEnum.class); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter( | |||
" ", new LegacyStringToEnumConverter(), TestEnum.class); | |||
Collection<?> model = converter | |||
.convertToModel("Z X Y", Set.class, null); | |||
Assert.assertTrue("Unexpected model class", model instanceof HashSet); | |||
@@ -102,7 +102,7 @@ public class StringToCollectionConverterTest { | |||
return new Vector(); | |||
} | |||
}; | |||
StringToCollectionConverter converter = new StringToCollectionConverter( | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter( | |||
", ", null, String.class, factory); | |||
Collection<?> model = converter.convertToModel("a, b, c", | |||
Collection.class, null); | |||
@@ -115,7 +115,7 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToPresentation_default() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter(); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter(); | |||
String presentation = converter.convertToPresentation( | |||
Arrays.asList("a", "b", "c"), String.class, null); | |||
@@ -124,7 +124,7 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToPresentation_customDelimiter() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter( | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter( | |||
"x"); | |||
String presentation = converter.convertToPresentation( | |||
Arrays.asList("a", "b", "c"), String.class, null); | |||
@@ -134,8 +134,8 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToPresentation_customConverter() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter( | |||
",", new StringToEnumConverter(), TestEnum.class); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter( | |||
",", new LegacyStringToEnumConverter(), TestEnum.class); | |||
String presentation = converter.convertToPresentation( | |||
Arrays.asList(TestEnum.Z, TestEnum.Y), String.class, null); | |||
@@ -144,7 +144,7 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToModel_singleItem() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter(); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter(); | |||
Collection<?> model = converter.convertToModel("a", List.class, null); | |||
Iterator<?> iterator = model.iterator(); | |||
Assert.assertEquals("Incorrect fist token", "a", iterator.next()); | |||
@@ -154,14 +154,14 @@ public class StringToCollectionConverterTest { | |||
@Test | |||
public void convertToModel_null() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter(); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter(); | |||
Assert.assertNull(converter.convertToModel(null, ArrayList.class, | |||
Locale.ENGLISH)); | |||
} | |||
@Test | |||
public void convertToPresentation_null() { | |||
StringToCollectionConverter converter = new StringToCollectionConverter(); | |||
LegacyStringToCollectionConverter converter = new LegacyStringToCollectionConverter(); | |||
Assert.assertNull(converter.convertToPresentation(null, String.class, | |||
Locale.ENGLISH)); | |||
} |
@@ -6,11 +6,11 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToDateConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToDateConverter; | |||
public class StringToDateConverterTest { | |||
StringToDateConverter converter = new StringToDateConverter(); | |||
LegacyStringToDateConverter converter = new LegacyStringToDateConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -3,11 +3,11 @@ package com.vaadin.tests.data.converter; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToDoubleConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; | |||
public class StringToDoubleConverterTest { | |||
StringToDoubleConverter converter = new StringToDoubleConverter(); | |||
LegacyStringToDoubleConverter converter = new LegacyStringToDoubleConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -3,10 +3,10 @@ package com.vaadin.tests.data.converter; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.data.util.converter.ReverseConverter; | |||
import com.vaadin.data.util.converter.StringToEnumConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyReverseConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToEnumConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
public class StringToEnumConverterTest { | |||
@@ -32,8 +32,8 @@ public class StringToEnumConverterTest { | |||
} | |||
} | |||
StringToEnumConverter converter = new StringToEnumConverter(); | |||
Converter<Enum, String> reverseConverter = new ReverseConverter<Enum, String>( | |||
LegacyStringToEnumConverter converter = new LegacyStringToEnumConverter(); | |||
LegacyConverter<Enum, String> reverseConverter = new LegacyReverseConverter<Enum, String>( | |||
converter); | |||
private String convertToString(Enum value) { |
@@ -3,11 +3,11 @@ package com.vaadin.tests.data.converter; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToFloatConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToFloatConverter; | |||
public class StringToFloatConverterTest { | |||
StringToFloatConverter converter = new StringToFloatConverter(); | |||
LegacyStringToFloatConverter converter = new LegacyStringToFloatConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -3,12 +3,12 @@ package com.vaadin.tests.data.converter; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
public class StringToIntegerConverterTest { | |||
StringToIntegerConverter converter = new StringToIntegerConverter(); | |||
LegacyStringToIntegerConverter converter = new LegacyStringToIntegerConverter(); | |||
@Test | |||
public void testNullConversion() { |
@@ -5,14 +5,14 @@ import java.util.Locale; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.ReverseConverter; | |||
import com.vaadin.data.util.converter.StringToLongConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyReverseConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToLongConverter; | |||
public class StringToLongConverterTest { | |||
StringToLongConverter converter = new StringToLongConverter(); | |||
Converter<Long, String> reverseConverter = new ReverseConverter<Long, String>( | |||
LegacyStringToLongConverter converter = new LegacyStringToLongConverter(); | |||
LegacyConverter<Long, String> reverseConverter = new LegacyReverseConverter<Long, String>( | |||
converter); | |||
@Test |
@@ -3,15 +3,15 @@ package com.vaadin.tests.data.converter; | |||
import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.data.util.converter.ReverseConverter; | |||
import com.vaadin.data.util.converter.StringToShortConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyReverseConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToShortConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
public class StringToShortConverterTest { | |||
StringToShortConverter converter = new StringToShortConverter(); | |||
Converter<Short, String> reverseConverter = new ReverseConverter<Short, String>( | |||
LegacyStringToShortConverter converter = new LegacyStringToShortConverter(); | |||
LegacyConverter<Short, String> reverseConverter = new LegacyReverseConverter<Short, String>( | |||
converter); | |||
@Test |
@@ -29,10 +29,10 @@ import org.junit.Assert; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
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.ConversionException; | |||
import com.vaadin.server.ExternalResource; | |||
import com.vaadin.server.FileResource; | |||
import com.vaadin.server.FontAwesome; |
@@ -6,9 +6,9 @@ import org.junit.Assert; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.MethodProperty; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.legacy.data.Validator.InvalidValueException; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
import com.vaadin.tests.data.bean.Address; | |||
import com.vaadin.tests.data.bean.Country; | |||
import com.vaadin.tests.data.bean.Person; | |||
@@ -24,7 +24,7 @@ public class AbsFieldValueConversionErrorTest { | |||
@Test | |||
public void testValidateConversionErrorParameters() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new StringToIntegerConverter()); | |||
tf.setConverter(new LegacyStringToIntegerConverter()); | |||
tf.setPropertyDataSource(new MethodProperty<String>(paulaBean, "age")); | |||
tf.setConversionError("(Type: {0}) Converter exception message: {1}"); | |||
tf.setValue("abc"); | |||
@@ -42,7 +42,7 @@ public class AbsFieldValueConversionErrorTest { | |||
@Test | |||
public void testConvertToModelConversionErrorParameters() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new StringToIntegerConverter()); | |||
tf.setConverter(new LegacyStringToIntegerConverter()); | |||
tf.setPropertyDataSource(new MethodProperty<String>(paulaBean, "age")); | |||
tf.setConversionError("(Type: {0}) Converter exception message: {1}"); | |||
tf.setValue("abc"); | |||
@@ -60,7 +60,7 @@ public class AbsFieldValueConversionErrorTest { | |||
@Test | |||
public void testNullConversionMessages() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new StringToIntegerConverter()); | |||
tf.setConverter(new LegacyStringToIntegerConverter()); | |||
tf.setPropertyDataSource(new MethodProperty<String>(paulaBean, "age")); | |||
tf.setConversionError(null); | |||
tf.setValue("abc"); | |||
@@ -76,7 +76,7 @@ public class AbsFieldValueConversionErrorTest { | |||
@Test | |||
public void testDefaultConversionErrorMessage() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new StringToIntegerConverter()); | |||
tf.setConverter(new LegacyStringToIntegerConverter()); | |||
tf.setPropertyDataSource(new MethodProperty<String>(paulaBean, "age")); | |||
tf.setValue("abc"); | |||
@@ -11,9 +11,9 @@ import org.junit.Test; | |||
import com.vaadin.data.util.MethodProperty; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
import com.vaadin.server.VaadinSession; | |||
import com.vaadin.tests.data.bean.Address; | |||
import com.vaadin.tests.data.bean.Country; | |||
@@ -88,7 +88,7 @@ public class AbsFieldValueConversionsTest { | |||
@Test | |||
public void testStringIdentityConversion() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new Converter<String, String>() { | |||
tf.setConverter(new LegacyConverter<String, String>() { | |||
@Override | |||
public String convertToModel(String value, | |||
@@ -126,7 +126,7 @@ public class AbsFieldValueConversionsTest { | |||
public void testIntegerStringConversion() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new StringToIntegerConverter()); | |||
tf.setConverter(new LegacyStringToIntegerConverter()); | |||
tf.setPropertyDataSource(new MethodProperty<Integer>(paulaBean, "age")); | |||
assertEquals(34, tf.getPropertyDataSource().getValue()); | |||
assertEquals("34", tf.getValue()); | |||
@@ -158,7 +158,7 @@ public class AbsFieldValueConversionsTest { | |||
@Test | |||
public void testBooleanNullConversion() { | |||
CheckBox cb = new CheckBox(); | |||
cb.setConverter(new Converter<Boolean, Boolean>() { | |||
cb.setConverter(new LegacyConverter<Boolean, Boolean>() { | |||
@Override | |||
public Boolean convertToModel(Boolean value, | |||
@@ -245,10 +245,10 @@ public class AbsFieldValueConversionsTest { | |||
assertEquals(490, tf.getPropertyDataSource().getValue()); | |||
assertEquals("490", tf.getValue()); | |||
Converter c1 = tf.getConverter(); | |||
LegacyConverter c1 = tf.getConverter(); | |||
tf.setPropertyDataSource(new MethodProperty<Number>(nb, "number")); | |||
Converter c2 = tf.getConverter(); | |||
LegacyConverter c2 = tf.getConverter(); | |||
assertTrue( | |||
"StringToInteger converter is ok for integer types and should stay even though property is changed", | |||
c1 == c2); | |||
@@ -260,9 +260,9 @@ public class AbsFieldValueConversionsTest { | |||
@Test | |||
public void testNullConverter() { | |||
TextField tf = new TextField("foo"); | |||
tf.setConverter(new StringToIntegerConverter()); | |||
tf.setConverter(new LegacyStringToIntegerConverter()); | |||
tf.setPropertyDataSource(new ObjectProperty<Integer>(12)); | |||
tf.setConverter((Converter) null); | |||
tf.setConverter((LegacyConverter) null); | |||
try { | |||
Object v = tf.getConvertedValue(); | |||
System.out.println(v); |
@@ -6,7 +6,7 @@ import org.junit.Test; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.AbstractProperty; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
import com.vaadin.legacy.ui.LegacyAbstractField; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.server.VaadinSession; |
@@ -24,7 +24,7 @@ import org.junit.Test; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.ObjectProperty; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.shared.ui.datefield.Resolution; | |||
import com.vaadin.ui.DateField; | |||
@@ -38,7 +38,7 @@ public class DateFieldConverterTest { | |||
date = new ObjectProperty<Long>(0L); | |||
datefield = new DateField(); | |||
datefield.setBuffered(false); | |||
datefield.setConverter(new Converter<Date, Long>() { | |||
datefield.setConverter(new LegacyConverter<Date, Long>() { | |||
@Override | |||
public Long convertToModel(Date value, |
@@ -34,7 +34,7 @@ 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.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.ui.Table; | |||
public class TablePropertyValueConverterTest { | |||
@@ -84,20 +84,20 @@ public class TablePropertyValueConverterTest { | |||
createContainer(new String[] { "col1", "col2", "col3" }, | |||
new Class[] { String.class, BaseClass.class, | |||
DerivedClass.class })); | |||
customTable.setConverter("col1", new Converter<String, String>() { | |||
customTable.setConverter("col1", new LegacyConverter<String, String>() { | |||
private static final long serialVersionUID = 1L; | |||
@Override | |||
public String convertToModel(String value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "model"; | |||
} | |||
@Override | |||
public String convertToPresentation(String value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "presentation"; | |||
} | |||
@@ -112,13 +112,13 @@ public class TablePropertyValueConverterTest { | |||
} | |||
}); | |||
customTable.setConverter("col2", new Converter<String, BaseClass>() { | |||
customTable.setConverter("col2", new LegacyConverter<String, BaseClass>() { | |||
private static final long serialVersionUID = 1L; | |||
@Override | |||
public BaseClass convertToModel(String value, | |||
Class<? extends BaseClass> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return new BaseClass("model"); | |||
} | |||
@@ -135,17 +135,17 @@ public class TablePropertyValueConverterTest { | |||
@Override | |||
public String convertToPresentation(BaseClass value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return null; | |||
} | |||
}); | |||
customTable.setConverter("col3", new Converter<String, DerivedClass>() { | |||
customTable.setConverter("col3", new LegacyConverter<String, DerivedClass>() { | |||
private static final long serialVersionUID = 1L; | |||
@Override | |||
public DerivedClass convertToModel(String value, | |||
Class<? extends DerivedClass> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return new DerivedClass("derived" + 1001); | |||
} | |||
@@ -162,7 +162,7 @@ public class TablePropertyValueConverterTest { | |||
@Override | |||
public String convertToPresentation(DerivedClass value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return null; | |||
} | |||
}); | |||
@@ -186,20 +186,20 @@ public class TablePropertyValueConverterTest { | |||
createContainer(new String[] { "col1", "col2", "col3" }, | |||
new Class[] { int.class, BaseClass.class, | |||
DerivedClass.class })); | |||
customTable.setConverter("col1", new Converter<String, Integer>() { | |||
customTable.setConverter("col1", new LegacyConverter<String, Integer>() { | |||
private static final long serialVersionUID = 1L; | |||
@Override | |||
public Integer convertToModel(String value, | |||
Class<? extends Integer> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return 11; | |||
} | |||
@Override | |||
public String convertToPresentation(Integer value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "presentation"; | |||
} | |||
@@ -229,20 +229,20 @@ public class TablePropertyValueConverterTest { | |||
public void setUp() { | |||
table = new TestableTable("Test table", createContainer(new String[] { | |||
"col1", "col2", "col3" })); | |||
table.setConverter("col1", new Converter<String, String>() { | |||
table.setConverter("col1", new LegacyConverter<String, String>() { | |||
private static final long serialVersionUID = 1L; | |||
@Override | |||
public String convertToModel(String value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "model"; | |||
} | |||
@Override | |||
public String convertToPresentation(String value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "presentation"; | |||
} | |||
@@ -258,20 +258,20 @@ public class TablePropertyValueConverterTest { | |||
}); | |||
table.setConverter("col2", new Converter<String, String>() { | |||
table.setConverter("col2", new LegacyConverter<String, String>() { | |||
private static final long serialVersionUID = 1L; | |||
@Override | |||
public String convertToModel(String value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "model2"; | |||
} | |||
@Override | |||
public String convertToPresentation(String value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "presentation2"; | |||
} | |||
@@ -346,10 +346,10 @@ public class TablePropertyValueConverterTest { | |||
Field f = Table.class | |||
.getDeclaredField("propertyValueConverters"); | |||
f.setAccessible(true); | |||
HashMap<Object, Converter<String, Object>> pvc = (HashMap<Object, Converter<String, Object>>) f | |||
HashMap<Object, LegacyConverter<String, Object>> pvc = (HashMap<Object, LegacyConverter<String, Object>>) f | |||
.get(this); | |||
Set<Object> currentConverters = new HashSet<Object>(); | |||
for (Entry<Object, Converter<String, Object>> entry : pvc | |||
for (Entry<Object, LegacyConverter<String, Object>> entry : pvc | |||
.entrySet()) { | |||
currentConverters.add(entry.getKey()); | |||
} |
@@ -27,8 +27,8 @@ import org.junit.Test; | |||
import com.vaadin.data.Item; | |||
import com.vaadin.data.util.IndexedContainer; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.server.VaadinSession; | |||
import com.vaadin.tests.server.component.grid.TestGrid; | |||
import com.vaadin.tests.util.AlwaysLockedVaadinSession; | |||
@@ -65,7 +65,7 @@ public class RendererTest { | |||
} | |||
} | |||
private static class TestConverter implements Converter<String, TestBean> { | |||
private static class TestConverter implements LegacyConverter<String, TestBean> { | |||
@Override | |||
public TestBean convertToModel(String value, | |||
@@ -150,7 +150,7 @@ public class RendererTest { | |||
@Test | |||
public void testDefaultRendererAndConverter() throws Exception { | |||
assertSame(TextRenderer.class, intColumn.getRenderer().getClass()); | |||
assertSame(StringToIntegerConverter.class, intColumn.getConverter() | |||
assertSame(LegacyStringToIntegerConverter.class, intColumn.getConverter() | |||
.getClass()); | |||
assertSame(TextRenderer.class, textColumn.getRenderer().getClass()); | |||
@@ -165,7 +165,7 @@ public class RendererTest { | |||
@Test | |||
public void testFindCompatibleConverter() throws Exception { | |||
intColumn.setRenderer(renderer()); | |||
assertSame(StringToIntegerConverter.class, intColumn.getConverter() | |||
assertSame(LegacyStringToIntegerConverter.class, intColumn.getConverter() | |||
.getClass()); | |||
textColumn.setRenderer(renderer()); |
@@ -7,7 +7,7 @@ import org.junit.Assert; | |||
import org.junit.Before; | |||
import org.junit.Test; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.server.VaadinSession; | |||
import com.vaadin.tests.util.AlwaysLockedVaadinSession; | |||
@@ -36,7 +36,7 @@ public class AbsFieldDataSourceLocaleChangeTest { | |||
public void localeChangesOnAttach() { | |||
TextField tf = new TextField(); | |||
tf.setConverter(new StringToIntegerConverter() { | |||
tf.setConverter(new LegacyStringToIntegerConverter() { | |||
@Override | |||
protected NumberFormat getFormat(Locale locale) { | |||
if (locale == null) { |
@@ -1,15 +1,15 @@ | |||
package com.vaadin.tests.components; | |||
import javax.validation.constraints.Min; | |||
import javax.validation.constraints.NotNull; | |||
import com.vaadin.annotations.Viewport; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.ui.Label; | |||
import com.vaadin.ui.TextField; | |||
import javax.validation.constraints.Min; | |||
import javax.validation.constraints.NotNull; | |||
@Viewport(value = "width=device-width,height=device-height") | |||
public class TouchDevicesTooltip extends AbstractTestUI { | |||
@@ -25,9 +25,9 @@ public class TouchDevicesTooltip extends AbstractTestUI { | |||
private void createTextField(int n) { | |||
TextField textField = new TextField("Value" + n); | |||
textField.setConverter(new StringToIntegerConverter()); | |||
textField.addValidator(new LegacyIntegerRangeValidator(getErrorMessage(n), 0, | |||
100)); | |||
textField.setConverter(new LegacyStringToIntegerConverter()); | |||
textField.addValidator( | |||
new LegacyIntegerRangeValidator(getErrorMessage(n), 0, 100)); | |||
textField.setImmediate(true); | |||
textField.setValue("-5"); | |||
addComponent(textField); |
@@ -2,15 +2,15 @@ package com.vaadin.tests.components.abstractfield; | |||
import java.util.Locale; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
public class Vaadin6ImplicitDoubleConverter implements | |||
Converter<String, Double> { | |||
LegacyConverter<String, Double> { | |||
@Override | |||
public Double convertToModel(String value, | |||
Class<? extends Double> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
if (null == value) { | |||
return null; | |||
} | |||
@@ -20,7 +20,7 @@ public class Vaadin6ImplicitDoubleConverter implements | |||
@Override | |||
public String convertToPresentation(Double 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; | |||
} |
@@ -3,7 +3,7 @@ package com.vaadin.tests.components.datefield; | |||
import java.util.Date; | |||
import com.vaadin.data.Property; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.ui.DateField; | |||
@@ -25,7 +25,7 @@ public class DateFieldUnparsableDate extends TestBase { | |||
@Override | |||
protected Date handleUnparsableDateString(String dateString) | |||
throws Converter.ConversionException { | |||
throws LegacyConverter.ConversionException { | |||
return oldDate; | |||
} | |||
} | |||
@@ -37,7 +37,7 @@ public class DateFieldUnparsableDate extends TestBase { | |||
@Override | |||
protected Date handleUnparsableDateString(String dateString) | |||
throws Converter.ConversionException { | |||
throws LegacyConverter.ConversionException { | |||
return null; | |||
} | |||
} | |||
@@ -49,8 +49,8 @@ public class DateFieldUnparsableDate extends TestBase { | |||
@Override | |||
protected Date handleUnparsableDateString(String dateString) | |||
throws Converter.ConversionException { | |||
throw new Converter.ConversionException( | |||
throws LegacyConverter.ConversionException { | |||
throw new LegacyConverter.ConversionException( | |||
"You should not enter invalid dates!"); | |||
} | |||
} | |||
@@ -62,11 +62,11 @@ public class DateFieldUnparsableDate extends TestBase { | |||
@Override | |||
protected Date handleUnparsableDateString(String dateString) | |||
throws Converter.ConversionException { | |||
throws LegacyConverter.ConversionException { | |||
if (dateString != null && dateString.equals("today")) { | |||
return new Date(); | |||
} | |||
throw new Converter.ConversionException( | |||
throw new LegacyConverter.ConversionException( | |||
"You should not enter invalid dates!"); | |||
} | |||
} |
@@ -8,8 +8,8 @@ import java.util.Locale; | |||
import com.vaadin.data.Property.ValueChangeEvent; | |||
import com.vaadin.data.Property.ValueChangeListener; | |||
import com.vaadin.data.util.BeanItemContainer; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.StringToDoubleConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; | |||
import com.vaadin.tests.components.TestBase; | |||
import com.vaadin.tests.data.bean.Address; | |||
import com.vaadin.tests.data.bean.Country; | |||
@@ -147,12 +147,12 @@ public class DoublesInTable extends TestBase { | |||
} | |||
private void addConverters(Table t) { | |||
t.setConverter("sex", new Converter<String, Sex>() { | |||
t.setConverter("sex", new LegacyConverter<String, Sex>() { | |||
@Override | |||
public Sex convertToModel(String value, | |||
Class<? extends Sex> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
// not used in this test - Table only converts to presentation | |||
return null; | |||
} | |||
@@ -160,7 +160,7 @@ public class DoublesInTable extends TestBase { | |||
@Override | |||
public String convertToPresentation(Sex 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) { | |||
value = Sex.UNKNOWN; | |||
} | |||
@@ -177,7 +177,7 @@ public class DoublesInTable extends TestBase { | |||
return String.class; | |||
} | |||
}); | |||
t.setConverter("deceased", new Converter<String, Boolean>() { | |||
t.setConverter("deceased", new LegacyConverter<String, Boolean>() { | |||
@Override | |||
public Boolean convertToModel(String value, | |||
@@ -207,12 +207,12 @@ public class DoublesInTable extends TestBase { | |||
return String.class; | |||
} | |||
}); | |||
t.setConverter("age", new Converter<String, Integer>() { | |||
t.setConverter("age", new LegacyConverter<String, Integer>() { | |||
@Override | |||
public Integer convertToModel(String value, | |||
Class<? extends Integer> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
// not used in this test - Table only converts from source to | |||
// target | |||
return null; | |||
@@ -221,7 +221,7 @@ public class DoublesInTable extends TestBase { | |||
@Override | |||
public String convertToPresentation(Integer 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; | |||
} | |||
@@ -246,7 +246,7 @@ public class DoublesInTable extends TestBase { | |||
return String.class; | |||
} | |||
}); | |||
t.setConverter("address", new Converter<String, Address>() { | |||
t.setConverter("address", new LegacyConverter<String, Address>() { | |||
@Override | |||
public Address convertToModel(String value, | |||
@@ -276,7 +276,7 @@ public class DoublesInTable extends TestBase { | |||
}); | |||
t.setConverter("rent", new StringToDoubleConverter() { | |||
t.setConverter("rent", new LegacyStringToDoubleConverter() { | |||
@Override | |||
protected NumberFormat getFormat(Locale locale) { | |||
return NumberFormat.getCurrencyInstance(locale); |
@@ -17,8 +17,8 @@ package com.vaadin.tests.components.table; | |||
import java.util.Locale; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.DefaultConverterFactory; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyDefaultConverterFactory; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.ui.Table; | |||
@@ -26,12 +26,12 @@ import com.vaadin.ui.Table; | |||
public class TableWithCustomConverterFactory extends AbstractTestUI { | |||
public static class MyIntegerConverter implements | |||
Converter<String, Integer> { | |||
LegacyConverter<String, Integer> { | |||
@Override | |||
public Integer convertToModel(String value, | |||
Class<? extends Integer> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
@@ -39,7 +39,7 @@ public class TableWithCustomConverterFactory extends AbstractTestUI { | |||
@Override | |||
public String convertToPresentation(Integer value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws com.vaadin.data.util.converter.Converter.ConversionException { | |||
throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { | |||
return "Integer: " + value; | |||
} | |||
@@ -55,9 +55,9 @@ public class TableWithCustomConverterFactory extends AbstractTestUI { | |||
} | |||
public static class MyConverterFactory extends DefaultConverterFactory { | |||
public static class MyConverterFactory extends LegacyDefaultConverterFactory { | |||
@Override | |||
protected Converter<String, ?> createStringConverter(Class<?> sourceType) { | |||
protected LegacyConverter<String, ?> createStringConverter(Class<?> sourceType) { | |||
if (Integer.class.isAssignableFrom(sourceType)) { | |||
return new MyIntegerConverter(); | |||
} else { |
@@ -3,10 +3,10 @@ package com.vaadin.tests.converter; | |||
import java.text.NumberFormat; | |||
import java.util.Locale; | |||
import com.vaadin.data.util.converter.StringToDoubleConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; | |||
public class StringToDoubleConverterWithThreeFractionDigits extends | |||
StringToDoubleConverter { | |||
LegacyStringToDoubleConverter { | |||
@Override | |||
protected NumberFormat getFormat(Locale locale) { |
@@ -6,7 +6,7 @@ import com.vaadin.data.fieldgroup.FieldGroup.CommitEvent; | |||
import com.vaadin.data.fieldgroup.FieldGroup.CommitException; | |||
import com.vaadin.data.fieldgroup.FieldGroup.CommitHandler; | |||
import com.vaadin.data.util.BeanItem; | |||
import com.vaadin.data.util.converter.StringToBooleanConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToBooleanConverter; | |||
import com.vaadin.legacy.data.validator.LegacyEmailValidator; | |||
import com.vaadin.legacy.data.validator.LegacyIntegerRangeValidator; | |||
import com.vaadin.legacy.data.validator.LegacyStringLengthValidator; | |||
@@ -71,8 +71,8 @@ public class BasicPersonForm extends AbstractTestUIWithLog { | |||
confFieldGroup.setBuffered(false); | |||
for (Object propertyId : bi.getItemPropertyIds()) { | |||
((ComponentContainer) getContent()).addComponent(confFieldGroup | |||
.buildAndBind(propertyId)); | |||
((ComponentContainer) getContent()) | |||
.addComponent(confFieldGroup.buildAndBind(propertyId)); | |||
} | |||
} | |||
@@ -161,13 +161,13 @@ public class BasicPersonForm extends AbstractTestUIWithLog { | |||
addComponent(discardButton); | |||
addComponent(showBean); | |||
email.addValidator(new LegacyEmailValidator("Must be a valid address")); | |||
lastName.addValidator(new LegacyStringLengthValidator("Must be min 5 chars", | |||
5, null, true)); | |||
lastName.addValidator(new LegacyStringLengthValidator( | |||
"Must be min 5 chars", 5, null, true)); | |||
age.addValidator(new LegacyIntegerRangeValidator( | |||
"Must be between 0 and 150, {0} is not", 0, 150)); | |||
sex.setPageLength(0); | |||
deceased.setConverter(new StringToBooleanConverter() { | |||
deceased.setConverter(new LegacyStringToBooleanConverter() { | |||
@Override | |||
protected String getTrueString() { | |||
return "YAY!"; |
@@ -19,8 +19,8 @@ import java.text.NumberFormat; | |||
import java.util.Locale; | |||
import com.vaadin.annotations.Theme; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.ui.Grid; | |||
import com.vaadin.ui.Grid.CellReference; | |||
@@ -57,11 +57,11 @@ public class FormattingDataInGrid extends UI { | |||
NumberRenderer poundRenderer = new NumberRenderer(poundformat); | |||
grid.getColumn("amount").setRenderer(poundRenderer); | |||
grid.getColumn("count").setConverter(new StringToIntegerConverter() { | |||
grid.getColumn("count").setConverter(new LegacyStringToIntegerConverter() { | |||
@Override | |||
public String convertToPresentation(Integer value, | |||
Class<? extends String> targetType, Locale locale) | |||
throws Converter.ConversionException { | |||
throws LegacyConverter.ConversionException { | |||
String stringRepresentation = super.convertToPresentation( | |||
value, targetType, locale); | |||
if (value.intValue() % 2 == 0) { |
@@ -3,7 +3,7 @@ package com.vaadin.tests.minitutorials.v7a1; | |||
import java.text.NumberFormat; | |||
import java.util.Locale; | |||
import com.vaadin.data.util.converter.StringToDoubleConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.ui.Table; | |||
@@ -30,14 +30,14 @@ public class FormatTableValue extends AbstractTestUI { | |||
table.getItem(itemId).getItemProperty(DEFAULT_PROPERTY) | |||
.setValue(3.1415); | |||
table.setConverter(PERCENT_PROPERTY, new StringToDoubleConverter() { | |||
table.setConverter(PERCENT_PROPERTY, new LegacyStringToDoubleConverter() { | |||
@Override | |||
protected NumberFormat getFormat(Locale locale) { | |||
return NumberFormat.getPercentInstance(locale); | |||
} | |||
}); | |||
table.setConverter(CURRENCY_PROPERTY, new StringToDoubleConverter() { | |||
table.setConverter(CURRENCY_PROPERTY, new LegacyStringToDoubleConverter() { | |||
@Override | |||
protected NumberFormat getFormat(Locale locale) { | |||
return NumberFormat.getCurrencyInstance(locale); |
@@ -1,7 +1,7 @@ | |||
package com.vaadin.tests.minitutorials.v7a1; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.data.util.converter.StringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.ui.Button; | |||
@@ -16,7 +16,7 @@ public class IntegerTextFieldStandalone extends AbstractTestUI { | |||
@Override | |||
protected void setup(VaadinRequest request) { | |||
final TextField textField = new TextField("Text field"); | |||
textField.setConverter(new StringToIntegerConverter()); | |||
textField.setConverter(new LegacyStringToIntegerConverter()); | |||
Button submitButton = new Button("Submit value", new ClickListener() { | |||
@Override |
@@ -1,15 +1,15 @@ | |||
package com.vaadin.tests.minitutorials.v7a1; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.DefaultConverterFactory; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyDefaultConverterFactory; | |||
public class MyConverterFactory extends DefaultConverterFactory { | |||
public class MyConverterFactory extends LegacyDefaultConverterFactory { | |||
@Override | |||
protected <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> findConverter( | |||
protected <PRESENTATION, MODEL> LegacyConverter<PRESENTATION, MODEL> findConverter( | |||
Class<PRESENTATION> presentationType, Class<MODEL> modelType) { | |||
// Handle String <-> Double | |||
if (presentationType == String.class && modelType == Double.class) { | |||
return (Converter<PRESENTATION, MODEL>) new MyStringToDoubleConverter(); | |||
return (LegacyConverter<PRESENTATION, MODEL>) new MyStringToDoubleConverter(); | |||
} | |||
// Let default factory handle the rest | |||
return super.findConverter(presentationType, modelType); |
@@ -3,9 +3,9 @@ package com.vaadin.tests.minitutorials.v7a1; | |||
import java.text.NumberFormat; | |||
import java.util.Locale; | |||
import com.vaadin.data.util.converter.StringToDoubleConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; | |||
public class MyStringToDoubleConverter extends StringToDoubleConverter { | |||
public class MyStringToDoubleConverter extends LegacyStringToDoubleConverter { | |||
@Override | |||
protected NumberFormat getFormat(Locale locale) { |
@@ -2,8 +2,8 @@ package com.vaadin.tests.minitutorials.v7a1; | |||
import java.util.Locale; | |||
import com.vaadin.data.util.converter.Converter; | |||
import com.vaadin.data.util.converter.Converter.ConversionException; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException; | |||
import com.vaadin.server.VaadinRequest; | |||
import com.vaadin.tests.components.AbstractTestUI; | |||
import com.vaadin.ui.Button; | |||
@@ -50,7 +50,7 @@ public class StringMyTypeConverter extends AbstractTestUI { | |||
} | |||
class StringToNameConverter implements Converter<String, Name> { | |||
class StringToNameConverter implements LegacyConverter<String, Name> { | |||
@Override | |||
public Name convertToModel(String text, Class<? extends Name> targetType, | |||
Locale locale) throws ConversionException { |
@@ -19,7 +19,7 @@ import org.junit.Assert; | |||
import org.junit.Test; | |||
import org.openqa.selenium.WebElement; | |||
import com.vaadin.data.util.converter.StringToEnumConverter; | |||
import com.vaadin.legacy.data.util.converter.LegacyStringToEnumConverter; | |||
import com.vaadin.shared.ui.ui.NotificationRole; | |||
import com.vaadin.testbench.By; | |||
import com.vaadin.testbench.elements.ButtonElement; | |||
@@ -58,7 +58,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { | |||
postfix.clear(); | |||
postfix.sendKeys("- press ESC to close"); | |||
type.selectByText(StringToEnumConverter.enumToString( | |||
type.selectByText(LegacyStringToEnumConverter.enumToString( | |||
NotificationRole.ALERT, null)); | |||
show.click(); | |||
@@ -82,7 +82,7 @@ public class NotificationsWaiAriaTest extends MultiBrowserTest { | |||
notification.close(); | |||
type.selectByText(StringToEnumConverter.enumToString( | |||
type.selectByText(LegacyStringToEnumConverter.enumToString( | |||
NotificationRole.STATUS, null)); | |||
show.click(); |