myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r1333643 - /myfaces/trinidad/branches/1.2.12.6.3-branch/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js
Date Thu, 03 May 2012 21:50:23 GMT
Author: jwaldman
Date: Thu May  3 21:50:23 2012
New Revision: 1333643

URL: http://svn.apache.org/viewvc?rev=1333643&view=rev
Log:
TRINIDAD-2139 Client NumberConverter with type=percent ignores maxfractiondigits when formatting
Thanks to Yee-Wah for the patch
commit on 1.2.12.6.3-branch

Modified:
    myfaces/trinidad/branches/1.2.12.6.3-branch/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js

Modified: myfaces/trinidad/branches/1.2.12.6.3-branch/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.12.6.3-branch/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js?rev=1333643&r1=1333642&r2=1333643&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.12.6.3-branch/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js
(original)
+++ myfaces/trinidad/branches/1.2.12.6.3-branch/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/NumberFormat.js
Thu May  3 21:50:23 2012
@@ -140,6 +140,7 @@ TrNumberFormat.prototype.setMaximumFract
     {
       this._minFractionDigits = this._maxFractionDigits;
     }
+    this._isMaxFractionDigitsSet  = true;     
   }
 } 
 
@@ -395,7 +396,15 @@ TrNumberFormat.prototype.currencyToStrin
 TrNumberFormat.prototype.percentageToString = function(number)
 {
   number = number * 100;
-  number = this.getRounded(number);
+  
+  // TRINIDAD-2139: getRounded calls Math.round() on number. Since number is
+  // multiplied by 100 before this call and later divided, the result will 
+  // have at most 2 fractional digits, regardless of the value of maxFractionDigits. 
+  // Hence, if maxFractionDigits is set, don't call this method and let 
+  // numberToString format the string appropriately. 
+  if (this._isMaxFractionDigitsSet == null)
+    number = this.getRounded(number);  
+  
   if (isNaN(number))
   {
     throw new TrParseException("not able to parse number");



Mime
View raw message