aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2015-03-18 15:35:47 +0200
committerJohannes Dahlström <johannesd@vaadin.com>2015-03-20 11:32:06 +0200
commit4a40924cd8715f664cf08ea6bfff7c83d96d14d4 (patch)
treeb49f75d01dac6519c2bf8bc146eddfc47d7d05a4 /server/src/com/vaadin
parent7d4de11c54060286bbc7adfeefa2891f3a461b1d (diff)
downloadvaadin-framework-4a40924cd8715f664cf08ea6bfff7c83d96d14d4.tar.gz
vaadin-framework-4a40924cd8715f664cf08ea6bfff7c83d96d14d4.zip
Fix Declarative support for BigDecimal properties (#17205)
Change-Id: I766172c125b7e771b4bc8e2db1f39d1ae828fea6
Diffstat (limited to 'server/src/com/vaadin')
-rw-r--r--server/src/com/vaadin/ui/declarative/DesignFormatter.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/server/src/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/com/vaadin/ui/declarative/DesignFormatter.java
index cc5071fe9d..728b3d1077 100644
--- a/server/src/com/vaadin/ui/declarative/DesignFormatter.java
+++ b/server/src/com/vaadin/ui/declarative/DesignFormatter.java
@@ -29,6 +29,7 @@ import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
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;
@@ -68,8 +69,8 @@ public class DesignFormatter implements Serializable {
*/
protected void mapDefaultTypes() {
// numbers use standard toString/valueOf approach
- for (Class<?> c : new Class<?>[] { Integer.class, Byte.class,
- Short.class, Long.class, BigDecimal.class }) {
+ for (Class<?> c : new Class<?>[] { Byte.class, Short.class,
+ Integer.class, Long.class }) {
DesignToStringConverter<?> conv = new DesignToStringConverter(c);
converterMap.put(c, conv);
try {
@@ -134,6 +135,16 @@ public class DesignFormatter implements Serializable {
converterMap.put(Double.class, doubleConverter);
converterMap.put(double.class, doubleConverter);
+ final DecimalFormat bigDecimalFmt = new DecimalFormat("0.###", symbols);
+ bigDecimalFmt.setGroupingUsed(false);
+ bigDecimalFmt.setParseBigDecimal(true);
+ converterMap.put(BigDecimal.class, new StringToBigDecimalConverter() {
+ @Override
+ protected NumberFormat getFormat(Locale locale) {
+ return bigDecimalFmt;
+ };
+ });
+
// strings do nothing
converterMap.put(String.class, new Converter<String, String>() {