summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-06-10 20:01:40 +0300
committerVaadin Code Review <review@vaadin.com>2013-06-11 12:40:09 +0000
commit3d9d47d222a53e33267cb3f26112782fe9f12caf (patch)
treea8fdc3a5bcaecf535673f957f8ef1bb7254d1f73 /uitest
parent5793a1c3a2da2c9771bd1721483a4689100d4bc3 (diff)
downloadvaadin-framework-3d9d47d222a53e33267cb3f26112782fe9f12caf.tar.gz
vaadin-framework-3d9d47d222a53e33267cb3f26112782fe9f12caf.zip
Added type parameter to converter methods (#11895)
Change-Id: I6562c537d9e5a0745eb67bc613123a265578ae00
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java6
-rw-r--r--uitest/src/com/vaadin/tests/components/table/DoublesInTable.java24
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java6
-rw-r--r--uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java3
-rw-r--r--uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java7
5 files changed, 30 insertions, 16 deletions
diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java b/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java
index a9aa4d2a43..33359cc2c6 100644
--- a/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java
+++ b/uitest/src/com/vaadin/tests/components/abstractfield/Vaadin6ImplicitDoubleConverter.java
@@ -8,7 +8,8 @@ public class Vaadin6ImplicitDoubleConverter implements
Converter<String, Double> {
@Override
- public Double convertToModel(String value, Locale locale)
+ public Double convertToModel(String value,
+ Class<? extends Double> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
if (null == value) {
return null;
@@ -17,7 +18,8 @@ public class Vaadin6ImplicitDoubleConverter implements
}
@Override
- public String convertToPresentation(Double value, Locale locale)
+ public String convertToPresentation(Double value,
+ Class<? extends String> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
if (value == null) {
return null;
diff --git a/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java b/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java
index 920ccc2038..355cd43d37 100644
--- a/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java
+++ b/uitest/src/com/vaadin/tests/components/table/DoublesInTable.java
@@ -150,14 +150,16 @@ public class DoublesInTable extends TestBase {
t.setConverter("sex", new Converter<String, Sex>() {
@Override
- public Sex convertToModel(String value, Locale locale)
+ public Sex convertToModel(String value,
+ Class<? extends Sex> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
// not used in this test - Table only converts to presentation
return null;
}
@Override
- public String convertToPresentation(Sex value, Locale locale)
+ public String convertToPresentation(Sex value,
+ Class<? extends String> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
if (value == null) {
value = Sex.UNKNOWN;
@@ -178,14 +180,16 @@ public class DoublesInTable extends TestBase {
t.setConverter("deceased", new Converter<String, Boolean>() {
@Override
- public Boolean convertToModel(String value, Locale locale) {
+ public Boolean convertToModel(String value,
+ Class<? extends Boolean> targetType, Locale locale) {
// not used in this test - Table only converts from source to
// target
return null;
}
@Override
- public String convertToPresentation(Boolean value, Locale locale) {
+ public String convertToPresentation(Boolean value,
+ Class<? extends String> targetType, Locale locale) {
if (value == null || value) {
return "YES, DEAD!";
} else {
@@ -206,7 +210,8 @@ public class DoublesInTable extends TestBase {
t.setConverter("age", new Converter<String, Integer>() {
@Override
- public Integer convertToModel(String value, Locale locale)
+ public Integer convertToModel(String value,
+ Class<? extends Integer> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
// not used in this test - Table only converts from source to
// target
@@ -214,7 +219,8 @@ public class DoublesInTable extends TestBase {
}
@Override
- public String convertToPresentation(Integer value, Locale locale)
+ public String convertToPresentation(Integer value,
+ Class<? extends String> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
if (value == null) {
return null;
@@ -243,14 +249,16 @@ public class DoublesInTable extends TestBase {
t.setConverter("address", new Converter<String, Address>() {
@Override
- public Address convertToModel(String value, Locale locale)
+ public Address convertToModel(String value,
+ Class<? extends Address> targetType, Locale locale)
throws ConversionException {
// not used in this test - Table only converts to presentation
return null;
}
@Override
- public String convertToPresentation(Address value, Locale locale)
+ public String convertToPresentation(Address value,
+ Class<? extends String> targetType, Locale locale)
throws ConversionException {
return value.getStreetAddress() + ", " + value.getCity() + " ("
+ value.getCountry() + ")";
diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java b/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java
index 60be786e8b..a3f0ce2f13 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableWithCustomConverterFactory.java
@@ -29,14 +29,16 @@ public class TableWithCustomConverterFactory extends AbstractTestUI {
Converter<String, Integer> {
@Override
- public Integer convertToModel(String value, Locale locale)
+ public Integer convertToModel(String value,
+ Class<? extends Integer> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
// TODO Auto-generated method stub
return null;
}
@Override
- public String convertToPresentation(Integer value, Locale locale)
+ public String convertToPresentation(Integer value,
+ Class<? extends String> targetType, Locale locale)
throws com.vaadin.data.util.converter.Converter.ConversionException {
return "Integer: " + value;
}
diff --git a/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java
index 6158092591..a37aa521ba 100644
--- a/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java
+++ b/uitest/src/com/vaadin/tests/converter/ConverterThatEnforcesAFormat.java
@@ -28,7 +28,8 @@ public class ConverterThatEnforcesAFormat extends TestBase {
+ "). Two-way conversion gives: "
+ tf.getConverter().convertToPresentation(
tf.getConverter().convertToModel(tf.getValue(),
- tf.getLocale()), tf.getLocale()) + ")");
+ Double.class, tf.getLocale()),
+ String.class, tf.getLocale()) + ")");
}
});
tf.setImmediate(true);
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java
index 9ec7a82580..8197cd82ae 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/StringMyTypeConverter.java
@@ -52,8 +52,8 @@ public class StringMyTypeConverter extends AbstractTestUI {
class StringToNameConverter implements Converter<String, Name> {
@Override
- public Name convertToModel(String text, Locale locale)
- throws ConversionException {
+ public Name convertToModel(String text, Class<? extends Name> targetType,
+ Locale locale) throws ConversionException {
if (text == null) {
return null;
}
@@ -66,7 +66,8 @@ class StringToNameConverter implements Converter<String, Name> {
}
@Override
- public String convertToPresentation(Name name, Locale locale)
+ public String convertToPresentation(Name name,
+ Class<? extends String> targetType, Locale locale)
throws ConversionException {
if (name == null) {
return null;