Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6791D1040F for ; Sun, 28 Apr 2013 00:32:47 +0000 (UTC) Received: (qmail 79557 invoked by uid 500); 28 Apr 2013 00:32:47 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 79516 invoked by uid 500); 28 Apr 2013 00:32:47 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 79509 invoked by uid 99); 28 Apr 2013 00:32:47 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Apr 2013 00:32:47 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BDF77882E16; Sun, 28 Apr 2013 00:32:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jmclean@apache.org To: commits@flex.apache.org Message-Id: <82c0f5f36bc040a28f93a94a06f8ae34@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) 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 Authored: Sun Apr 28 10:32:30 2013 +1000 Committer: Justin Mclean 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="No default" * daySource="No default" * formatError= "Configuration error: Incorrect formatting string." + * includeFormatInError="true|false" * inputFormat="MM/DD/YYYY" * invalidCharError="The date contains invalid characters." * monthListener="Object specified by monthSource" @@ -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 true 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 //----------------------------------