You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/05/02 05:12:21 UTC

[1/2] git commit: [flex-sdk] [refs/heads/develop] - FLEX-27235 When number (rather than string) is passed to validator and decimal character was not "." incorrect error was being shown

Updated Branches:
  refs/heads/develop ae28ab34c -> 8ec4e1485


FLEX-27235 When number (rather than string) is passed to validator and decimal character was not "." incorrect error was being shown


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/74c49633
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/74c49633
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/74c49633

Branch: refs/heads/develop
Commit: 74c49633cc8d171e654256cccd516520a2407d1e
Parents: ae28ab3
Author: Justin Mclean <jm...@apache.org>
Authored: Thu May 2 13:05:15 2013 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Thu May 2 13:05:15 2013 +1000

----------------------------------------------------------------------
 .../framework/src/mx/validators/NumberValidator.as |   67 ++++++++-------
 1 files changed, 34 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/74c49633/frameworks/projects/framework/src/mx/validators/NumberValidator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/validators/NumberValidator.as b/frameworks/projects/framework/src/mx/validators/NumberValidator.as
index 3fa7980..6faab51 100644
--- a/frameworks/projects/framework/src/mx/validators/NumberValidator.as
+++ b/frameworks/projects/framework/src/mx/validators/NumberValidator.as
@@ -113,15 +113,13 @@ public class NumberValidator extends Validator
 		var minValue:Number = Number(validator.minValue);
 		var precision:int = int(validator.precision);
 		var thousandsSeparator:String = validator.thousandsSeparator;
-
         var input:String = String(value);
         var len:int = input.length;
-
         var isNegative:Boolean = false;
-		
 		var i:int;
 		var c:String;
-
+		var isNumber:Boolean = (value is Number);
+		
         // Make sure the formatting character parameters are unique,
 		// are not digits or the negative sign,
 		// and that the separators are one character.
@@ -266,35 +264,38 @@ public class NumberValidator extends Validator
         var end:int = decimalSeparatorIndex == -1 ?
 					  len :
 					  decimalSeparatorIndex;
-        for (i = 1; i < end; i++)
-        {
-            c = input.charAt(i);
-            if (c == thousandsSeparator)
-            {
-                if (c == thousandsSeparator)
-                {
-                    if ((end - i != 4 &&
-						 input.charAt(i + 4) != thousandsSeparator) ||
-                        DECIMAL_DIGITS.indexOf(input.charAt(i + 1)) == -1 ||
-                        DECIMAL_DIGITS.indexOf(input.charAt(i + 2)) == -1 ||
-                        DECIMAL_DIGITS.indexOf(input.charAt(i + 3)) == -1)
-                    {
-                        results.push(new ValidationResult(
-							true, baseField, "separation",
-							validator.separationError));
-						return results;
-                    }
-                }
-            }
-            else if (DECIMAL_DIGITS.indexOf(c) == -1)
-            {
-                results.push(new ValidationResult(
-					true, baseField,"invalidChar",
-					validator.invalidCharError));
-				return results;
-            }
-        }
-
+		if (!isNumber)
+		{
+	        for (i = 1; i < end; i++)
+	        {
+	            c = input.charAt(i);
+	            if (c == thousandsSeparator)
+	            {
+	                if (c == thousandsSeparator)
+	                {
+	                    if ((end - i != 4 &&
+							 input.charAt(i + 4) != thousandsSeparator) ||
+	                        DECIMAL_DIGITS.indexOf(input.charAt(i + 1)) == -1 ||
+	                        DECIMAL_DIGITS.indexOf(input.charAt(i + 2)) == -1 ||
+	                        DECIMAL_DIGITS.indexOf(input.charAt(i + 3)) == -1)
+	                    {
+	                        results.push(new ValidationResult(
+								true, baseField, "separation",
+								validator.separationError));
+							return results;
+	                    }
+	                }
+	            }
+	            else if (DECIMAL_DIGITS.indexOf(c) == -1)
+	            {
+	                results.push(new ValidationResult(
+						true, baseField,"invalidChar",
+						validator.invalidCharError));
+					return results;
+	            }
+	        }
+		}
+		
         // Make sure the input is within the specified range.
         if (!isNaN(minValue) || !isNaN(maxValue))
         {


[2/2] git commit: [flex-sdk] [refs/heads/develop] - FLEX-27855 Changed value to display ", " when decimal separator is ", "

Posted by jm...@apache.org.
FLEX-27855 Changed value to display "," when decimal separator is ","


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/8ec4e148
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/8ec4e148
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/8ec4e148

Branch: refs/heads/develop
Commit: 8ec4e148539ab7f71e1b19c4bd7b491b9b803a6f
Parents: 74c4963
Author: Justin Mclean <jm...@apache.org>
Authored: Thu May 2 13:11:30 2013 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Thu May 2 13:11:30 2013 +1000

----------------------------------------------------------------------
 .../spark/src/spark/components/NumericStepper.as   |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/8ec4e148/frameworks/projects/spark/src/spark/components/NumericStepper.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/NumericStepper.as b/frameworks/projects/spark/src/spark/components/NumericStepper.as
index 36a1982..6a45b32 100644
--- a/frameworks/projects/spark/src/spark/components/NumericStepper.as
+++ b/frameworks/projects/spark/src/spark/components/NumericStepper.as
@@ -689,7 +689,10 @@ public class NumericStepper extends Spinner
             textDisplay.maxChars = _maxChars;
             // Restrict to digits, minus sign, decimal point, and comma
             textDisplay.restrict = "0-9\\-\\.\\,";
-            textDisplay.text = value.toString();
+			if (dataFormatter != null)
+          		textDisplay.text = dataFormatter.format(value);
+			else
+				textDisplay.text = value.toString();
             // Set the the textDisplay to be wide enough to display
             // widest possible value. 
             textDisplay.widthInChars = calculateWidestValue(); 
@@ -857,8 +860,10 @@ public class NumericStepper extends Spinner
     {
         if (valueFormatFunction != null)
             textDisplay.text = valueFormatFunction(value);
-        else
-            textDisplay.text = value.toString();
+        else if (dataFormatter != null)
+            textDisplay.text = dataFormatter.format(value);
+		else
+			textDisplay.text = value.toString();
     }
     
     //--------------------------------------------------------------------------