Author: jacopoc
Date: Mon Oct  2 02:52:36 2006
New Revision: 451937

URL: http://svn.apache.org/viewvc?view=rev&rev=451937
Log:
This is a fix for rendering of numeric values both in ftl templates and in form 
widget.
The problem was that the number of fractional digit used was the default one 
for the locale (usually 3) and for this reason many numbers were truncated in 
the screens.
I have fixed this by setting the maximum number of digits to 10.

Modified:
    
incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java
    
incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Modified: 
incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java?view=diff&rev=451937&r1=451936&r2=451937
==============================================================================
--- 
incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java
 (original)
+++ 
incubator/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/template/FreeMarkerWorker.java
 Mon Oct  2 02:52:36 2006
@@ -230,6 +230,7 @@
                     Configuration config = new Configuration();            
                     config.setObjectWrapper(BeansWrapper.getDefaultInstance());
                     config.setSetting("datetime_format", "yyyy-MM-dd 
HH:mm:ss.SSS");
+                    config.setSetting("number_format", "0.##########");
                     defaultOfbizConfig = config;
                 }
             }
@@ -241,6 +242,7 @@
         Configuration config = new Configuration();            
         config.setObjectWrapper(BeansWrapper.getDefaultInstance());
         config.setSetting("datetime_format", "yyyy-MM-dd HH:mm:ss.SSS");
+        config.setSetting("number_format", "0.##########");
         if (locationDir != null) {
             File locationDirFile = new File(locationDir);
             if (locationDirFile != null) {

Modified: 
incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?view=diff&rev=451937&r1=451936&r2=451937
==============================================================================
--- 
incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
 (original)
+++ 
incubator/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
 Mon Oct  2 02:52:36 2006
@@ -660,7 +660,9 @@
             if (retVal != null) {
                 // format number based on the user's locale
                 if (retVal instanceof Double || retVal instanceof Float || 
retVal instanceof BigDecimal) {
-                    return NumberFormat.getInstance(locale).format(retVal);
+                    NumberFormat nf = NumberFormat.getInstance(locale);
+                    nf.setMaximumFractionDigits(10);
+                    return nf.format(retVal);
                 } else {
                     return retVal.toString();
                 }


Reply via email to