aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r--server/src/com/vaadin/ui/declarative/DesignFormatter.java25
-rw-r--r--server/src/com/vaadin/ui/declarative/converters/DesignToStringConverter.java5
2 files changed, 19 insertions, 11 deletions
diff --git a/server/src/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/com/vaadin/ui/declarative/DesignFormatter.java
index d2fbf2c765..cc5071fe9d 100644
--- a/server/src/com/vaadin/ui/declarative/DesignFormatter.java
+++ b/server/src/com/vaadin/ui/declarative/DesignFormatter.java
@@ -19,6 +19,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
+import java.text.NumberFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Locale;
@@ -110,22 +111,28 @@ public class DesignFormatter implements Serializable {
converterMap.put(boolean.class, booleanConverter);
// floats and doubles use formatters
- DecimalFormatSymbols symbols = new DecimalFormatSymbols(new Locale(
- "en_US"));
+ final DecimalFormatSymbols symbols = new DecimalFormatSymbols(
+ new Locale("en_US"));
final DecimalFormat fmt = new DecimalFormat("0.###", symbols);
fmt.setGroupingUsed(false);
- converterMap.put(Float.class, new StringToFloatConverter() {
+
+ Converter<String, ?> floatConverter = new StringToFloatConverter() {
@Override
- protected java.text.NumberFormat getFormat(Locale locale) {
+ protected NumberFormat getFormat(Locale locale) {
return fmt;
};
- });
- converterMap.put(Double.class, new StringToDoubleConverter() {
+ };
+ converterMap.put(Float.class, floatConverter);
+ converterMap.put(float.class, floatConverter);
+
+ Converter<String, ?> doubleConverter = new StringToDoubleConverter() {
@Override
- protected java.text.NumberFormat getFormat(Locale locale) {
+ protected NumberFormat getFormat(Locale locale) {
return fmt;
};
- });
+ };
+ converterMap.put(Double.class, doubleConverter);
+ converterMap.put(double.class, doubleConverter);
// strings do nothing
converterMap.put(String.class, new Converter<String, String>() {
@@ -169,7 +176,7 @@ public class DesignFormatter implements Serializable {
};
converterMap.put(Character.class, charConverter);
- converterMap.put(Character.TYPE, charConverter);
+ converterMap.put(char.class, charConverter);
converterMap.put(Date.class, new DesignDateConverter());
converterMap.put(ShortcutAction.class,
diff --git a/server/src/com/vaadin/ui/declarative/converters/DesignToStringConverter.java b/server/src/com/vaadin/ui/declarative/converters/DesignToStringConverter.java
index d80119bea1..0c6cf55bed 100644
--- a/server/src/com/vaadin/ui/declarative/converters/DesignToStringConverter.java
+++ b/server/src/com/vaadin/ui/declarative/converters/DesignToStringConverter.java
@@ -64,7 +64,8 @@ public class DesignToStringConverter<TYPE> implements Converter<String, TYPE> {
* must be public and static method that returns an object of
* passed type.
*/
- public DesignToStringConverter(Class<? extends TYPE> type, String staticMethodName) {
+ public DesignToStringConverter(Class<? extends TYPE> type,
+ String staticMethodName) {
this.type = type;
this.staticMethodName = staticMethodName;
}
@@ -81,7 +82,7 @@ public class DesignToStringConverter<TYPE> implements Converter<String, TYPE> {
} catch (IllegalArgumentException e) {
throw new Converter.ConversionException(e);
} catch (InvocationTargetException e) {
- throw new Converter.ConversionException(e);
+ throw new Converter.ConversionException(e.getCause());
} catch (NoSuchMethodException e) {
throw new Converter.ConversionException(e);
} catch (SecurityException e) {