diff options
author | Matti Hosio <mhosio@vaadin.com> | 2014-12-03 11:43:58 +0200 |
---|---|---|
committer | Matti Hosio <mhosio@vaadin.com> | 2014-12-03 11:43:58 +0200 |
commit | c5bb382ed6622945360732979c772403252935f9 (patch) | |
tree | 63b772ce68a11967626bae032969a8ebf2e2eba2 /server/src/com | |
parent | c82b0c8ed2c2c96ea5b331e6f4867a1df2c121d0 (diff) | |
download | vaadin-framework-c5bb382ed6622945360732979c772403252935f9.tar.gz vaadin-framework-c5bb382ed6622945360732979c772403252935f9.zip |
Declarative: Set used file separators and decimal symbols explicitly
Diffstat (limited to 'server/src/com')
-rw-r--r-- | server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java index a4667fed03..1e5ff47742 100644 --- a/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -18,6 +18,7 @@ package com.vaadin.ui.declarative; import java.io.File; import java.lang.reflect.Method; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -327,7 +328,10 @@ public class DesignAttributeHandler { * @return the formatted number */ public static String formatDesignAttribute(float number) { - DecimalFormat fmt = new DecimalFormat(); + DecimalFormatSymbols symbols = new DecimalFormatSymbols(new Locale( + "en_US")); + DecimalFormat fmt = new DecimalFormat("0.###", symbols); + fmt.setGroupingUsed(false); return fmt.format(number); } @@ -473,7 +477,13 @@ public class DesignAttributeHandler { } else if (value instanceof FontAwesome) { return "font://" + ((FontAwesome) value).name(); } else if (value instanceof FileResource) { - return ((FileResource) value).getSourceFile().getPath(); + String path = ((FileResource) value).getSourceFile().getPath(); + if (File.separatorChar != '/') { + // make sure we use '/' as file separator in templates + return path.replace(File.separatorChar, '/'); + } else { + return path; + } } else { return null; } |