flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject git commit: [flex-sdk] - FLEX-17257 added boolean (default true) to control if date format is added to error message.
Date Sun, 28 Apr 2013 00:32:46 GMT
Updated Branches:
  refs/heads/develop 109f8b13c -> c7d54ed51


FLEX-17257 added boolean (default true) to control if date format is added to error message.


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

Branch: refs/heads/develop
Commit: c7d54ed511818ee4d026932cf2763b8ee26ea596
Parents: 109f8b1
Author: Justin Mclean <jmclean@apache.org>
Authored: Sun Apr 28 10:32:30 2013 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Sun Apr 28 10:32:30 2013 +1000

----------------------------------------------------------------------
 .../framework/src/mx/validators/DateValidator.as   |   57 +++++++++++++--
 1 files changed, 51 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c7d54ed5/frameworks/projects/framework/src/mx/validators/DateValidator.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/validators/DateValidator.as b/frameworks/projects/framework/src/mx/validators/DateValidator.as
index ac50338..065438a 100644
--- a/frameworks/projects/framework/src/mx/validators/DateValidator.as
+++ b/frameworks/projects/framework/src/mx/validators/DateValidator.as
@@ -71,6 +71,7 @@ import mx.resources.ResourceManager;
  *    dayProperty="<i>No default</i>"
  *    daySource="<i>No default</i>"
  *    formatError= "Configuration error: Incorrect formatting string." 
+ *    includeFormatInError="true|false"
  *    inputFormat="MM/DD/YYYY" 
  *    invalidCharError="The date contains invalid characters."
  *    monthListener="<i>Object specified by monthSource</i>"
@@ -350,7 +351,8 @@ public class DateValidator extends Validator
 				{
 					results.push(new ValidationResult(
 						true, baseField, "wrongLength", 
-						validator.wrongLengthError + " " + inputFormat));
+						validator.wrongLengthError
+						+ (DateValidator._includeFormatInError?" " + inputFormat:"")));
 					return results;
 				}
 
@@ -383,7 +385,8 @@ public class DateValidator extends Validator
 				{
 					results.push(new ValidationResult(
 						true, baseField, "wrongLength", 
-						validator.wrongLengthError + " " + inputFormat));	
+						validator.wrongLengthError
+						+ (DateValidator._includeFormatInError?" " + inputFormat:"")));	
 				}
 				// MM or M format
 				if ((monthRequired && monthPart.length == 2 && dateObj.month.length !=
2)
@@ -391,7 +394,8 @@ public class DateValidator extends Validator
 				{
 					results.push(new ValidationResult(
 						true, baseField, "wrongLength", 
-						validator.wrongLengthError + " " + inputFormat));	
+						validator.wrongLengthError
+						+ (DateValidator._includeFormatInError?" " + inputFormat:"")));	
 				}
 				// YY or YYYY format
 				if ((yearRequired && yearPart.length == 2 && dateObj.year.length != 2)
@@ -399,7 +403,8 @@ public class DateValidator extends Validator
 				{
 					results.push(new ValidationResult(
 						true, baseField, "wrongLength", 
-						validator.wrongLengthError + " " + inputFormat));	
+						validator.wrongLengthError
+						+ (DateValidator._includeFormatInError?" " + inputFormat:"")));	
 				}
 						
 				if ((monthRequired && dateObj.month == "") ||
@@ -408,8 +413,8 @@ public class DateValidator extends Validator
 				 {
 				 	results.push(new ValidationResult(
 						true, baseField, "wrongLength", 
-						validator.wrongLengthError + " " +
-						inputFormat));
+						validator.wrongLengthError
+						+ (DateValidator._includeFormatInError?" " + inputFormat:"")));
 					return results;
 				 }
 			}
@@ -774,6 +779,46 @@ public class DateValidator extends Validator
 	}
 	
 	//----------------------------------
+	//  includeFormatInError
+	//----------------------------------
+	
+	/**
+	 *  @private
+	 *  Storage for the includeFormatInError property.
+	 * 
+	 * Note needs to be static as validate methods are static.
+	 */
+	static private var _includeFormatInError:Boolean = true;
+
+	
+	[Inspectable(category="General", defaultValue="true")]
+	
+	/** 
+	 *  If <code>true</code> the date format is shown in some
+	 *  validation error messages. Setting to false changes all
+	 *  DateValidators.
+	 *
+	 *  @default true
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion ApacheFlex 4.10
+	 */
+	public function get includeFormatInError():Boolean
+	{
+		return DateValidator._includeFormatInError;
+	}
+	
+	/**
+	 *  @private
+	 */
+	public function set includeFormatInError(value:Boolean):void
+	{
+		DateValidator._includeFormatInError = value;
+	}
+	
+	//----------------------------------
 	//  inputFormat
 	//----------------------------------
 


Mime
View raw message