Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1263082 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/validators/DateValidator.as
+++ frameworks/projects/framework/src/mx/validators/DateValidator.as
@@ -0,0 +1,1329 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2003-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.validators
+{
+
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+
+[ResourceBundle("SharedResources")]
+[ResourceBundle("validators")]
+
+/**
+ *  The DateValidator class validates that a String, Date, or Object contains a
+ *  proper date and matches a specified format. Users can enter a single
+ *  digit or two digits for month, day, and year.
+ *  By default, the validator ensures the following formats:
+ *
+ *

+ *
The month is between 1 and 12 (or 0-11 for Date objects)

+ *
The day is between 1 and 31

+ *
The year is a number

+ *

+ *
+ *
You can specify the date in the DateValidator class in two ways:

+ *

+ *
Single String containing the date - Use the source
+ *    and property properties to specify the String.
+ *    The String can contain digits and the formatting characters
+ *    specified by the allowedFormatChars property,
+ *    which include the "/\-. " characters.
+ *    By default, the input format of the date in a String field
+ *    is "MM/DD/YYYY" where "MM" is the month, "DD" is the day,
+ *    and "YYYY" is the year.
+ *    You can use the inputFormat property
+ *    to specify a different format.

+ *
Date object.

+ *
Object or multiple fields containing the day, month, and year.
+ *    Use all of the following properties to specify the day, month,
+ *    and year inputs: daySource, dayProperty,
+ *    monthSource, monthProperty,
+ *    yearSource, and yearProperty.

+ *

+ *
+ *  @mxml
+ *
+ *
The <mx:DateValidator> tag
+ *  inherits all of the tag attributes of its superclass,
+ *  and adds the following tag attributes:

+ *
+ *

+ *  <mx:DateValidator
+ *    allowedFormatChars="/\-. "
+ *    dayListener="Object specified by daySource"
+ *    dayProperty="No default"
+ *    daySource="No default"
+ *    formatError= "Configuration error: Incorrect formatting string."
+ *    inputFormat="MM/DD/YYYY"
+ *    invalidCharError="The date contains invalid characters."
+ *    monthListener="Object specified by monthSource"
+ *    monthProperty="No default"
+ *    monthSource="No default"
+ *    validateAsString="true|false"
+ *    wrongDayError="Enter a valid day for the month."
+ *    wrongLengthError="Type the date in the format inputFormat."
+ *    wrongMonthError="Enter a month between 1 and 12."
+ *    wrongYearError="Enter a year between 0 and 9999."
+ *    yearListener="Object specified by yearSource"
+ *    yearProperty="No default"
+ *    yearSource="No default"
+ *  />
+ *

+ *
+ *  @includeExample examples/DateValidatorExample.mxml
+ */
+public class DateValidator extends Validator
+{
+	include "../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Convenience method for calling a validator
+	 *  from within a custom validation function.
+	 *  Each of the standard Flex validators has a similar convenience method.
+	 *
+	 *  @param validator The DateValidator instance.
+	 *
+	 *  @param value A field to validate.
+	 *
+	 *  @param baseField Text representation of the subfield
+	 *  specified in the value parameter.
+	 *  For example, if the value parameter
+	 *  specifies value.date, the baseField value is "date".
+	 *
+	 *  @return An Array of ValidationResult objects, with one ValidationResult
+	 *  object for each field examined by the validator.
+	 *
+	 *  @see mx.validators.ValidationResult
+	 */
+	public static function validateDate(validator:DateValidator,
+									    value:Object,
+										baseField:String):Array
+	{
+		var results:Array = [];
+
+		// Resource-backed properties of the validator.
+		var allowedFormatChars:String = validator.allowedFormatChars;
+		var inputFormat:String = validator.inputFormat;
+		var validateAsString:Boolean = validator.validateAsString;
+
+		var resourceManager:IResourceManager = ResourceManager.getInstance();
+
+		var validInput:String = DECIMAL_DIGITS + allowedFormatChars;
+
+		var dateObj:Object = {};
+		dateObj.month = "";
+		dateObj.day = "";
+		dateObj.year = "";
+
+		var dayProp:String = baseField;
+		var yearProp:String = baseField;
+		var monthProp:String = baseField;
+
+		var advanceValueCounter:Boolean = true;
+		var monthRequired:Boolean = false;
+		var dayRequired:Boolean = false
+		var yearRequired:Boolean = false;
+		var valueIsString:Boolean = false;
+		var foundMonth:Boolean = false;
+		var foundYear:Boolean = false;
+
+		var objValue:Object;
+		var stringValue:Object;
+
+		var n:int;
+		var i:int;
+		var temp:String;
+
+		n = allowedFormatChars.length;
+		for (i = 0; i < n; i++)
+		{
+			if (DECIMAL_DIGITS.indexOf(allowedFormatChars.charAt(i)) != -1)
+			{
+				var message:String = resourceManager.getString(
+					"validators", "invalidFormatChars");
+				throw new Error(message);
+			}
+		}
+
+		if (value is String)
+		{
+			valueIsString = true;
+			stringValue = String(value);
+		}
+		else if (value is Number)
+		{
+			valueIsString = true;
+			stringValue = String(value);
+		}
+		else if (value is Date)
+		{
+			var date:Date = value as Date;
+			objValue = {year: date.fullYear,
+						month: date.month + 1,
+						day: date.date};
+		}
+		else
+		{
+			objValue = value;
+		}
+
+		// Check if the validator is an object or a string.
+		if (!validateAsString || !valueIsString)
+		{
+    		var baseFieldDot:String = baseField ? baseField + "." : "";
+			dayProp = baseFieldDot + "day";
+			yearProp = baseFieldDot + "year";
+			monthProp = baseFieldDot + "month";
+
+            if (validator.required && (!objValue.month || objValue.month == ""))
+            {
+                results.push(new ValidationResult(
+					true, monthProp,"requiredField",
+					validator.requiredFieldError));
+            }
+            else if (isNaN(objValue.month))
+			{
+				results.push(new ValidationResult(
+					true, monthProp, "wrongMonth",
+					validator.wrongMonthError));
+			}
+			else
+			{
+				monthRequired = true;
+			}
+
+            if (validator.required && (!objValue.year || objValue.year == ""))
+            {
+                results.push(new ValidationResult(
+					true, yearProp, "requiredField",
+					validator.requiredFieldError));
+            }
+            else if (isNaN(objValue.year))
+			{
+				results.push(new ValidationResult(
+					true, yearProp, "wrongYear",
+					validator.wrongYearError));
+			}
+			else
+			{
+				yearRequired = true;
+			}
+
+			var dayMissing:Boolean = (!objValue.day || objValue.day == "");
+			var dayInvalid:Boolean = dayMissing || isNaN(objValue.day);
+			var dayWrong:Boolean = !dayMissing && isNaN(objValue.day);
+			var dayOptional:Boolean = yearRequired && monthRequired;
+
+			// If the validator is required and there is no day specified
+            if (validator.required && dayMissing)
+            {
+                results.push(new ValidationResult(
+					true, dayProp, "requiredField",
+					validator.requiredFieldError));
+            }
+			else if (!dayInvalid) // The day is valid (a number).
+			{
+				dayRequired = true;
+			}
+			else if (!dayOptional || dayWrong) // Day is not optional and is NaN.
+			{
+				results.push(new ValidationResult(
+					true, dayProp, "wrongDay",
+					validator.wrongDayError));
+			}
+
+			dateObj.month = objValue.month ? String(objValue.month) : "";
+			dateObj.day = objValue.day ? String(objValue.day) : "";
+			dateObj.year = objValue.year ? String(objValue.year) : "";
+		}
+		else
+		{
+			var result:ValidationResult = DateValidator.validateFormatString(
+				validator, inputFormat, baseField);
+			if (result != null)
+			{
+				results.push(result);
+				return results;
+			}
+			else
+			{
+				var len:Number = stringValue.length;
+				if (len > inputFormat.length ||
+					len + 2 < inputFormat.length)
+				{
+					results.push(new ValidationResult(
+						true, baseField, "wrongLength",
+						validator.wrongLengthError + " " + inputFormat));
+					return results;
+				}
+
+ 				var j:int = 0;
+				n = inputFormat.length;
+				for (i = 0; i < n; i++)
+				{
+					temp = "" + stringValue.substring(j, j + 1);
+					var mask:String = "" + inputFormat.substring(i, i + 1);
+
+					// Check each character to see if it is allowed.
+					if (validInput.indexOf(temp) == -1)
+					{
+						results.push(new ValidationResult(
+							true, baseField, "invalidChar",
+							validator.invalidCharError));
+						return results;
+					}
+					if (mask == "m" || mask == "M")
+					{
+						monthRequired = true;
+						if (isNaN(Number(temp)))
+							advanceValueCounter = false;
+						else
+							dateObj.month += temp;
+					}
+					else if (mask == "d" || mask == "D")
+					{
+						dayRequired = true;
+						if (isNaN(Number(temp)))
+							advanceValueCounter = false;
+						else
+							dateObj.day += temp;
+					}
+					else if (mask == "y" || mask == "Y")
+					{
+						yearRequired = true;
+						if (isNaN(Number(temp)))
+						{
+							results.push(new ValidationResult(
+								true, baseField, "wrongLength",
+								validator.wrongLengthError + " " +
+								inputFormat));
+							return results;
+						}
+						else
+						{
+							dateObj.year += temp;
+						}
+					}
+					else if (allowedFormatChars.indexOf(temp) == -1)
+					{
+						results.push(new ValidationResult(
+							true, baseField, "invalidChar",
+							validator.invalidCharError));
+						return results;
+					}
+
+					if (advanceValueCounter)
+						j++;
+					advanceValueCounter = true;
+				}
+
+				if ((monthRequired && dateObj.month == "") ||
+					(dayRequired && dateObj.day == "") ||
+					(yearRequired && dateObj.year == "") ||
+					(j != len))
+				 {
+				 	results.push(new ValidationResult(
+						true, baseField, "wrongLength",
+						validator.wrongLengthError + " " +
+						inputFormat));
+					return results;
+				 }
+			}
+		}
+
+		// Now, validate the sub-elements, which may have been set directly.
+		n = dateObj.month.length;
+		for (i = 0; i < n; i++)
+		{
+			temp = "" + dateObj.month.substring(i, i + 1);
+			if (DECIMAL_DIGITS.indexOf(temp) == -1)
+			{
+				results.push(new ValidationResult(
+					true, monthProp, "invalidChar",
+					validator.invalidCharError));
+			}
+		}
+		n = dateObj.day.length;
+		for (i = 0; i < n; i++)
+		{
+			temp = "" + dateObj.day.substring(i, i + 1);
+			if (DECIMAL_DIGITS.indexOf(temp) == -1)
+			{
+				results.push(new ValidationResult(
+					true, dayProp, "invalidChar",
+					validator.invalidCharError));
+			}
+		}
+		n = dateObj.year.length;
+		for (i = 0; i < n; i++)
+		{
+			temp = "" + dateObj.year.substring(i, i + 1);
+			if (DECIMAL_DIGITS.indexOf(temp) == -1)
+			{
+				results.push(new ValidationResult(
+					true, yearProp, "invalidChar",
+					validator.invalidCharError));
+			}
+		}
+
+		if (results.length > 0)
+			return results;
+
+		var monthNum:Number = Number(dateObj.month);
+		var dayNum:Number = Number(dateObj.day);
+		var yearNum:Number = Number(dateObj.year).valueOf();
+
+		if (monthNum > 12 || monthNum < 1)
+		{
+			results.push(new ValidationResult(
+				true, monthProp, "wrongMonth",
+				validator.wrongMonthError));
+			return results;
+		}
+
+		var maxDay:Number = 31;
+
+		if (monthNum == 4 || monthNum == 6 ||
+			monthNum == 9 || monthNum == 11)
+		{
+			maxDay = 30;
+		}
+		else if (monthNum == 2)
+		{
+			if (yearNum % 4 > 0)
+				maxDay = 28;
+			else if (yearNum % 100 == 0 && yearNum % 400 > 0)
+				maxDay = 28;
+			else
+				maxDay = 29;
+		}
+
+		if (dayRequired && (dayNum > maxDay || dayNum < 1))
+		{
+			results.push(new ValidationResult(
+				true, dayProp, "wrongDay",
+				validator.wrongDayError));
+			return results;
+		}
+
+		if (yearRequired && (yearNum > 9999 || yearNum < 0))
+		{
+			results.push(new ValidationResult(
+				true, yearProp, "wrongYear",
+				validator.wrongYearError));
+			return results;
+		}
+
+		return results;
+	}
+
+	/**
+	 *  @private
+	 */
+	private static function validateFormatString(
+								validator:DateValidator,
+								format:String,
+								baseField:String):ValidationResult
+	{
+		var monthCounter:Number = 0;
+		var dayCounter:Number = 0;
+		var yearCounter:Number = 0;
+
+		var n:int = format.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			var mask:String = "" + format.substring(i, i + 1);
+
+			// Check for upper and lower case to maintain backwards compatibility.
+			if (mask == "m" || mask == "M")
+				monthCounter++;
+			else if (mask == "d" || mask == "D")
+				dayCounter++;
+			else if (mask == "y" || mask == "Y")
+				yearCounter++;
+		}
+
+		if ((monthCounter == 2 &&
+			 (yearCounter == 2 || yearCounter == 4)) ||
+			(monthCounter == 2 && dayCounter == 2 &&
+			 (yearCounter == 0 || yearCounter == 2 || yearCounter == 4)))
+		{
+			return null; // Passes format validation
+		}
+		else
+		{
+			return new ValidationResult(
+				true, baseField, "format",
+				validator.formatError);
+		}
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor.
+	 */
+	public function DateValidator()
+	{
+		super();
+
+		subFields = [ "day", "month", "year" ];
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Overridden properties
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  actualListeners
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Returns either the listener or the source
+	 *  for the day, month and year subfields.
+	 */
+	override protected function get actualListeners():Array
+	{
+		var results:Array = [];
+
+		var dayResult:Object;
+		if (_dayListener)
+			dayResult = _dayListener;
+		else if (_daySource)
+			dayResult = _daySource;
+
+		if (dayResult)
+		{
+			results.push(dayResult);
+			if (dayResult is IValidatorListener)
+				IValidatorListener(dayResult).validationSubField = "day";
+		}
+
+		var monthResult:Object;
+		if (_monthListener)
+			monthResult = _monthListener;
+		else if (_monthSource)
+			monthResult = _monthSource;
+
+		if (monthResult)
+		{
+			results.push(monthResult);
+			if (monthResult is IValidatorListener)
+				IValidatorListener(monthResult).validationSubField = "month";
+		}
+
+		var yearResult:Object;
+		if (_yearListener)
+			yearResult = _yearListener;
+		else if (_yearSource)
+			yearResult = _yearSource;
+
+		if (yearResult)
+		{
+			results.push(yearResult);
+			if (yearResult is IValidatorListener)
+				IValidatorListener(yearResult).validationSubField = "year";
+		}
+
+		if (results.length > 0 && listener)
+			results.push(listener);
+		else
+			results = results.concat(super.actualListeners);
+
+		return results;
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  allowedFormatChars
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Storage for the allowedFormatChars property.
+	 */
+	private var _allowedFormatChars:String;
+
+    /**
+	 *  @private
+	 */
+	private var allowedFormatCharsOverride:String;
+
+	[Inspectable(category="General", defaultValue="null")]
+
+	/**
+	 *  The set of formatting characters allowed for separating
+	 *  the month, day, and year values.
+	 *
+	 *  @default "/\-. "
+	 */
+	public function get allowedFormatChars():String
+	{
+		return _allowedFormatChars;
+	}
+
+    /**
+	 *  @private
+	 */
+	public function set allowedFormatChars(value:String):void
+	{
+		if (value != null)
+		{
+			var n:int = value.length;
+			for (var i:int = 0; i < n; i++)
+			{
+				if (DECIMAL_DIGITS.indexOf(value.charAt(i)) != -1)
+				{
+					var message:String = resourceManager.getString(
+						"validators", "invalidFormatChars");
+					throw new Error(message);
+				}
+			}
+		}
+
+		allowedFormatCharsOverride = value;
+
+		_allowedFormatChars = value != null ?
+							  value :
+							  resourceManager.getString(
+							      "validators",
+								  "dateValidatorAllowedFormatChars");
+	}
+
+	//----------------------------------
+	//  dayListener
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Storage for the dayListener property.
+	 */
+	private var _dayListener:IValidatorListener;
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  The component that listens for the validation result
+	 *  for the day subfield.
+	 *  If none is specified, use the value specified
+	 *  for the daySource property.
+	 */
+	public function get dayListener():IValidatorListener
+	{
+		return _dayListener;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set dayListener(value:IValidatorListener):void
+	{
+		if (_dayListener == value)
+			return;
+
+		removeListenerHandler();
+
+		_dayListener = value;
+
+		addListenerHandler();
+	}
+
+	//----------------------------------
+	//  dayProperty
+	//----------------------------------
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  Name of the day property to validate.
+	 *  This property is optional, but if you specify the
+	 *  daySource property, you should also set this property.
+	 */
+	public var dayProperty:String;
+
+	//----------------------------------
+	//  daySource
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Storage for the daySource property.
+	 */
+	private var _daySource:Object;
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  Object that contains the value of the day field.
+	 *  If you specify a value for this property, you must also
+	 *  specify a value for the dayProperty property.
+	 *  Do not use this property if you set the source
+	 *  and property properties.
+	 */
+	public function get daySource():Object
+	{
+		return _daySource;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set daySource(value:Object):void
+	{
+		if (_daySource == value)
+			return;
+
+		if (value is String)
+		{
+			var message:String = resourceManager.getString(
+				"validators", "DSAttribute", [ value ]);
+			throw new Error(message);
+		}
+
+		removeListenerHandler();
+
+		_daySource = value;
+
+		addListenerHandler();
+	}
+
+	//----------------------------------
+	//  inputFormat
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the inputFormat property.
+	 */
+	private var _inputFormat:String;
+
+    /**
+	 *  @private
+	 */
+	private var inputFormatOverride:String;
+
+	[Inspectable(category="General", defaultValue="null")]
+
+	/**
+	 *  The date format to validate the value against.
+	 *  "MM" is the month, "DD" is the day, and "YYYY" is the year.
+	 *  This String is case-sensitive.
+	 *
+	 *  @default "MM/DD/YYYY"
+	 */
+	public function get inputFormat():String
+	{
+		return _inputFormat;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set inputFormat(value:String):void
+	{
+		inputFormatOverride = value;
+
+		_inputFormat = value != null ?
+					   value :
+					   resourceManager.getString(
+					      "SharedResources", "dateFormat");
+	}
+
+	//----------------------------------
+	//  monthListener
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Storage for the monthListener property.
+	 */
+	private var _monthListener:IValidatorListener;
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  The component that listens for the validation result
+	 *  for the month subfield.
+	 *  If none is specified, use the value specified
+	 *  for the monthSource property.
+	 */
+	public function get monthListener():IValidatorListener
+	{
+		return _monthListener;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set monthListener(value:IValidatorListener):void
+	{
+		if (_monthListener == value)
+			return;
+
+		removeListenerHandler();
+
+		_monthListener = value;
+
+		addListenerHandler();
+	}
+
+	//----------------------------------
+	//  monthProperty
+	//----------------------------------
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  Name of the month property to validate.
+	 *  This property is optional, but if you specify the
+	 *  monthSource property, you should also set this property.
+	 */
+	public var monthProperty:String;
+
+	//----------------------------------
+	//  monthSource
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Storage for the monthSource property.
+	 */
+	private var _monthSource:Object;
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  Object that contains the value of the month field.
+	 *  If you specify a value for this property, you must also specify
+	 *  a value for the monthProperty property.
+	 *  Do not use this property if you set the source
+	 *  and property properties.
+	 */
+	public function get monthSource():Object
+	{
+		return _monthSource;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set monthSource(value:Object):void
+	{
+		if (_monthSource == value)
+			return;
+
+		if (value is String)
+		{
+			var message:String = resourceManager.getString(
+				"validators", "MSAttribute", [ value ]);
+			throw new Error(message);
+		}
+
+		removeListenerHandler();
+
+		_monthSource = value;
+
+		addListenerHandler();
+	}
+
+	//----------------------------------
+	//  validateAsString
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the validateAsString property.
+	 */
+	private var _validateAsString:Object;
+
+    /**
+	 *  @private
+	 */
+	private var validateAsStringOverride:Object;
+
+	[Inspectable(category="General", defaultValue="null")]
+
+	/**
+	 *  Determines how to validate the value.
+	 *  If set to true, the validator evaluates the value
+	 *  as a String, unless the value has a month,
+	 *  day, or year property.
+	 *  If false, the validator evaluates the value
+	 *  as a Date object.
+	 *
+	 *  @default true
+	 */
+	public function get validateAsString():Object
+	{
+		return _validateAsString;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set validateAsString(value:Object):void
+	{
+		validateAsStringOverride = value;
+
+		_validateAsString = value != null ?
+							Boolean(value) :
+							resourceManager.getBoolean(
+								"validators", "validateAsString");
+	}
+
+	//----------------------------------
+	//  yearListener
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Storage for the yearListener property.
+	 */
+	private var _yearListener:IValidatorListener;
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  The component that listens for the validation result
+	 *  for the year subfield.
+	 *  If none is specified, use the value specified
+	 *  for the yearSource property.
+	 */
+	public function get yearListener():IValidatorListener
+	{
+		return _yearListener;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set yearListener(value:IValidatorListener):void
+	{
+		if (_yearListener == value)
+			return;
+
+		removeListenerHandler();
+
+		_yearListener = value;
+
+		addListenerHandler();
+	}
+
+	//----------------------------------
+	//  yearProperty
+	//----------------------------------
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  Name of the year property to validate.
+	 *  This property is optional, but if you specify the
+	 *  yearSource property, you should also set this property.
+	 */
+	 public var yearProperty:String;
+
+	//----------------------------------
+	//  yearSource
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *  Storage for the yearSource property.
+	 */
+	private var _yearSource:Object;
+
+	[Inspectable(category="General")]
+
+	/**
+	 *  Object that contains the value of the year field.
+	 *  If you specify a value for this property, you must also specify
+	 *  a value for the yearProperty property.
+	 *  Do not use this property if you set the source
+	 *  and property properties.
+	 */
+	public function get yearSource():Object
+	{
+		return _yearSource;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set yearSource(value:Object):void
+	{
+		if (_yearSource == value)
+			return;
+
+		if (value is String)
+		{
+			var message:String = resourceManager.getString(
+				"validators", "YSAttribute", [ value ]);
+			throw new Error(message);
+		}
+
+		removeListenerHandler();
+
+		_yearSource = value;
+
+		addListenerHandler();
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Properties: Errors
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  formatError
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the formatError property.
+	 */
+	private var _formatError:String;
+
+    /**
+	 *  @private
+	 */
+	private var formatErrorOverride:String;
+
+	[Inspectable(category="Errors", defaultValue="null")]
+
+	/**
+	 *  Error message when the inputFormat property
+	 *  is not in the correct format.
+	 *
+	 *  @default "Configuration error: Incorrect formatting string."
+	 */
+	public function get formatError():String
+	{
+		return _formatError;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set formatError(value:String):void
+	{
+		formatErrorOverride = value;
+
+		_formatError = value != null ?
+					   value :
+					   resourceManager.getString(
+					       "validators", "formatError");
+	}
+
+	//----------------------------------
+	//  invalidCharError
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the invalidCharError property.
+	 */
+	private var _invalidCharError:String;
+
+    /**
+	 *  @private
+	 */
+	private var invalidCharErrorOverride:String;
+
+	[Inspectable(category="Errors", defaultValue="null")]
+
+	/**
+	 *  Error message when there are invalid characters in the date.
+	 *
+	 *  @default "Invalid characters in your date."
+	 */
+	public function get invalidCharError():String
+	{
+		return _invalidCharError;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set invalidCharError(value:String):void
+	{
+		invalidCharErrorOverride = value;
+
+		_invalidCharError = value != null ?
+							value :
+							resourceManager.getString(
+							    "validators", "invalidCharErrorDV");
+	}
+
+	//----------------------------------
+	//  wrongDayError
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the wrongDayError property.
+	 */
+	private var _wrongDayError:String;
+
+    /**
+	 *  @private
+	 */
+	private var wrongDayErrorOverride:String;
+
+	[Inspectable(category="Errors", defaultValue="null")]
+
+	/**
+	 *  Error message when the day is invalid.
+	 *
+	 *  @default "Enter a valid day for the month."
+	 */
+	public function get wrongDayError():String
+	{
+		return _wrongDayError;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set wrongDayError(value:String):void
+	{
+		wrongDayErrorOverride = value;
+
+		_wrongDayError = value != null ?
+						 value :
+						 resourceManager.getString(
+						     "validators", "wrongDayError");
+	}
+
+	//----------------------------------
+	//  wrongLengthError
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the wrongLengthError property.
+	 */
+	private var _wrongLengthError:String;
+
+    /**
+	 *  @private
+	 */
+	private var wrongLengthErrorOverride:String;
+
+	[Inspectable(category="Errors", defaultValue="null")]
+
+	/**
+	 *  Error message when the length of the date
+	 *  doesn't match that of the inputFormat property.
+	 *
+	 *  @default "Type the date in the format inputFormat."
+	 */
+	public function get wrongLengthError():String
+	{
+		return _wrongLengthError;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set wrongLengthError(value:String):void
+	{
+		wrongLengthErrorOverride = value;
+
+		_wrongLengthError = value != null ?
+							value :
+							resourceManager.getString(
+							    "validators", "wrongLengthErrorDV");
+	}
+
+	//----------------------------------
+	//  wrongMonthError
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the wrongMonthError property.
+	 */
+	private var _wrongMonthError:String;
+
+    /**
+	 *  @private
+	 */
+	private var wrongMonthErrorOverride:String;
+
+	[Inspectable(category="Errors", defaultValue="null")]
+
+	/**
+	 *  Error message when the month is invalid.
+	 *
+	 *  @default "Enter a month between 1 and 12."
+	 */
+	public function get wrongMonthError():String
+	{
+		return _wrongMonthError;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set wrongMonthError(value:String):void
+	{
+		wrongMonthErrorOverride = value;
+
+		_wrongMonthError = value != null ?
+						   value :
+						   resourceManager.getString(
+						       "validators", "wrongMonthError");
+	}
+
+	//----------------------------------
+	//  wrongYearError
+	//----------------------------------
+
+    /**
+	 *  @private
+	 *  Storage for the wrongYearError property.
+	 */
+	private var _wrongYearError:String;
+
+    /**
+	 *  @private
+	 */
+	private var wrongYearErrorOverride:String;
+
+	[Inspectable(category="Errors", defaultValue="null")]
+
+	/**
+	 *  Error message when the year is invalid.
+	 *
+	 *  @default "Enter a year between 0 and 9999."
+	 */
+	public function get wrongYearError():String
+	{
+		return _wrongYearError;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function set wrongYearError(value:String):void
+	{
+		wrongYearErrorOverride = value;
+
+		_wrongYearError = value != null ?
+						  value :
+						  resourceManager.getString(
+						      "validators", "wrongYearError");
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Overridden methods
+	//
+	//--------------------------------------------------------------------------
+
+    /**
+	 *  @private
+     */
+	override protected function resourcesChanged():void
+	{
+		super.resourcesChanged();
+
+		allowedFormatChars = allowedFormatCharsOverride;
+		inputFormat = inputFormatOverride;
+		validateAsString = validateAsStringOverride;
+
+		invalidCharError = invalidCharErrorOverride;
+		wrongLengthError = wrongLengthErrorOverride;
+		wrongMonthError = wrongMonthErrorOverride;
+		wrongDayError = wrongDayErrorOverride;
+		wrongYearError = wrongYearErrorOverride;
+		formatError = formatErrorOverride;
+	}
+
+	/**
+     *  Override of the base class doValidation() method
+     *  to validate a date.
+	 *
+	 *
You do not call this method directly;
+	 *  Flex calls it as part of performing a validation.
+	 *  If you create a custom validator class, you must implement this method.

+	 *
+	 *  @param value Either a String or an Object to validate.
+     *
+	 *  @return An Array of ValidationResult objects, with one ValidationResult
+	 *  object for each field examined by the validator.
+	 */
+	override protected function doValidation(value:Object):Array
+    {
+		var results:Array = super.doValidation(value);
+
+		// Return if there are errors
+		// or if the required property is set to false and length is 0.
+		var val:String = value ? String(value) : "";
+		if (results.length > 0 || ((val.length == 0) && !required))
+			return results;
+		else
+		    return DateValidator.validateDate(this, value, null);
+    }
+
+	/**
+	 *  @private
+	 *  Grabs the data for the validator from three different sources.
+	 */
+	override protected function getValueFromSource():Object
+	{
+		var useValue:Boolean = false;
+
+		var value:Object = {};
+
+		if (daySource && dayProperty)
+		{
+			value.day = daySource[dayProperty];
+			useValue = true;
+		}
+
+		if (monthSource && monthProperty)
+		{
+			value.month = monthSource[monthProperty];
+			useValue = true;
+		}
+
+		if (yearSource && yearProperty)
+		{
+			value.year = yearSource[yearProperty];
+			useValue = true;
+		}
+
+		return useValue ? value : super.getValueFromSource();
+	}
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1268610 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
+++ frameworks/projects/mx/src/mx/controls/alertClasses/AlertForm.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2003-2007 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

 package mx.controls.alertClasses
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 23246
Author:   cframpto@adobe.com
Date:     2011-12-20T17:40:08.069454Z

Log Message:
-----------
Rollback 23243.  If comment followed header it was stripped as well.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1273847 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/rpc/src/mx/messaging/management/Attribute.as
+++ frameworks/projects/rpc/src/mx/messaging/management/Attribute.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2005-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////

 package mx.messaging.management
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 8093
Author:   mhorn@adobe.com
Date:     2009-06-23T16:04:26.466100Z

Log Message:
-----------
ASDoc updates

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/filters/ConvolutionFilter.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1284700 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/filters/ConvolutionFilter.as
+++ frameworks/projects/spark/src/spark/filters/ConvolutionFilter.as
@@ -290,7 +290,7 @@
 	private var _matrixX:Number = 0;

 	/**
-	 * The x dimension of the matrix (the number of columns in the matrix).
+	 * The x dimension of the matrix (the number of rows in the matrix).
 	 * @default 0
 	 *
 	 *  @langversion 3.0


Forgot to remove trace statement.

Forgot to remove trace statement.

Change-Id: I7db34ea710f4ba3f26b7d218a694d865f6c9a637

--- WeaveUI/src/weave/visualization/layers/InteractiveVisualization.as
+++ WeaveUI/src/weave/visualization/layers/InteractiveVisualization.as
@@ -542,7 +542,6 @@
 				else
 					startCorner = DashedLine.TOP_LEFT;
 			}
-			trace(startCorner);

 			var xStart:Number = tempScreenBounds.getXMin();
 			var yStart:Number = tempScreenBounds.getYMin();


Transferred from the Adobe Open Source Subversion Repository

Revision: 5101
Author:   gauravj@adobe.com
Date:     2009-02-27T05:22:45.887116Z

Log Message:
-----------
Update action script files with asdoc version tags.

QE Notes: None.
Doc Notes: Please review and update as necessary.
tests: checkintests

Modified Paths:
--------------
663 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1268448 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/controls/RadioButtonGroup.as
+++ frameworks/projects/mx/src/mx/controls/RadioButtonGroup.as
@@ -36,6 +36,11 @@
  *  this group changes.
  *
  *  @eventType flash.events.Event.CHANGE
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
  */
 [Event(name="change", type="flash.events.Event")]

@@ -44,6 +49,11 @@
  *  You can also set a handler for individual RadioButton controls.
  *
  *  @eventType mx.events.ItemClickEvent.ITEM_CLICK
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
  */
 [Event(name="itemClick", type="mx.events.ItemClickEvent")]

@@ -99,6 +109,11 @@
  *  @includeExample examples/RadioButtonGroupExample.mxml
  *
  *  @see mx.controls.RadioButton
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
  */
 public class RadioButtonGroup extends EventDispatcher implements IMXMLObject
 {
@@ -117,6 +132,11 @@
      *  the document parameter should not be used.
      *
      *  @see flash.events.EventDispatcher
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function RadioButtonGroup(document:IFlexDisplayObject = null)
     {
@@ -158,6 +178,11 @@
      *  Determines whether selection is allowed.
      *
      *  @default true
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function get enabled():Boolean
     {
@@ -218,6 +243,11 @@
      *  ButtonLabelPlacement.BOTTOM, and ButtonLabelPlacement.TOP.

      *
      *  @default "right"
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function get labelPlacement():String
     {
@@ -248,6 +278,11 @@
      *  The number of RadioButtons that belong to this RadioButtonGroup.
      *
      *  @default "undefined"
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function get numRadioButtons():int
     {
@@ -281,6 +316,11 @@
      *  label property matches this value.

      *
      *  @default null
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function get selectedValue():Object
     {
@@ -338,6 +378,11 @@
      *  Setting this property to null deselects the currently selected RadioButton control.
      *
      *  @default null
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function get selection():RadioButton
     {
@@ -369,6 +414,11 @@
      *  If the object is a deep property on document, id is null.
      *
      *  @see mx.core.IMXMLObject
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function initialized(document:Object, id:String):void
     {
@@ -384,6 +434,11 @@
      *  RadioButtonGroup control, where the index of the first control is 0.
      *
      *  @return The specified RadioButton control.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
      */
     public function getRadioButtonAt(index:int):RadioButton
     {


Transferred from the Adobe Open Source Subversion Repository

Revision: 11532
Author:   jszeto@adobe.com
Date:     2009-11-06T21:32:37.933910Z

Log Message:
-----------
ComboBox user interactions

Added support for an improved user interaction. When the user starts typing in the textInput, ComboBox will now update the textInput with the rest of the matching item. It will then select the non-typed text. When using the navigation keys, the textInput will change to the new highlighted item.

QE notes: Tests need updating to account for new user interaction
Doc notes: We should update the docs to describe the user interaction
Bugs: N/A
Reviewer: Glenn
Tests run: DropDownList, ComboBox
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ComboBox.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1278475 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/ComboBox.as
+++ frameworks/projects/spark/src/spark/components/ComboBox.as
@@ -17,13 +17,19 @@
 import flash.events.Event;
 import flash.events.FocusEvent;
 import flash.events.KeyboardEvent;
+import flash.events.MouseEvent;
 import flash.ui.Keyboard;
+
+import flashx.textLayout.operations.CutOperation;
+import flashx.textLayout.operations.DeleteTextOperation;
+import flashx.textLayout.operations.FlowOperation;
+import flashx.textLayout.operations.InsertTextOperation;

 import mx.core.mx_internal;
 import mx.styles.StyleProxy;

+import spark.components.supportClasses.ListBase;
 import spark.core.NavigationUnit;
-import spark.components.supportClasses.ListBase;
 import spark.events.DropDownEvent;
 import spark.events.TextOperationEvent;
 import spark.utils.LabelUtil;
@@ -243,14 +249,16 @@

     private var isTextInputInFocus:Boolean;

-    private var actualProposedSelectedIndex:Number = -1;
+    private var actualProposedSelectedIndex:Number = NO_SELECTION;
+
+    private var userTypedIntoText:Boolean;

     //--------------------------------------------------------------------------
     //
     //  Properties
     //
     //--------------------------------------------------------------------------
-
+
     //--------------------------------------------------------------------------
     //  itemMatchingFunction
     //--------------------------------------------------------------------------
@@ -452,8 +460,7 @@

         // If the textInput has been changed, then use the input string as the selectedItem
         actualProposedSelectedIndex = CUSTOM_SELECTED_ITEM;
-
-
+
         if (textInput.text != "")
         {
             if (itemMatchingFunction != null)
@@ -461,16 +468,39 @@
             else
                 matchingItems = findMatchingItems(textInput.text);

-            //trace("CB.processInputField matchingItems:");
-           // for (var i:int = 0; i < matchingItems.length; i++)
-                //trace("    ["+i+"]",matchingItems[i]);
+            /*trace("CB.processInputField matchingItems:");
+            for (var i:int = 0; i < matchingItems.length; i++)
+                trace("    ["+i+"]",matchingItems[i]);*/

             if (matchingItems.length > 0)
             {
+                super.changeHighlightedSelection(matchingItems[0]);
+
+                var typedLength:int = textInput.text.length;
+                var item:Object = dataProvider ? dataProvider.getItemAt(matchingItems[0]) : undefined;
+                if (item)
+                {
+                    // If we found a match, then replace the textInput text with the match and
+                    // select the non-typed characters
+                    var itemString:String = itemToLabel(item);
+                    /*trace("CB.applyIndexToTextInput typed",textInput.text,"match",itemString,
+                        "selectRange start",typedLength,"end",itemString.length);*/
+                    /*if (ignoreCase)
+                    {*/
+                        textInput.selectAll();
+                        textInput.insertText(itemString);
+                    /*}
+                    else
+                    {
+                        textInput.insertText(itemString.substring(typedLength));
+                    }*/
+                    textInput.selectRange(typedLength, itemString.length);
+                }
+            }
+            else
+            {
                 itemSelected(userProposedSelectedIndex, false);
-                super.userProposedSelectedIndex = matchingItems[0];
-                ensureIndexIsVisible(userProposedSelectedIndex);
-                itemSelected(userProposedSelectedIndex, true);
+                super.userProposedSelectedIndex = NO_SELECTION;
             }
         }
         else
@@ -487,30 +517,13 @@
     // Returns an array of possible values
     private function findMatchingItems(input:String):Vector.<int>
     {
-
         // For now, just select the first match
         var startIndex:int;
         var stopIndex:int;
         var retVal:int;
         var retVector:Vector.<int> = new Vector.<int>;

-        if (selectedIndex == NO_SELECTION || selectedIndex == CUSTOM_SELECTED_ITEM)
-        {
-            startIndex = 0;
-            stopIndex = dataProvider.length;
-            retVal = findStringLoop(input, startIndex, stopIndex);
-        }
-        else
-        {
-            startIndex = selectedIndex + 1;
-            stopIndex = dataProvider.length;
-            retVal = findStringLoop(input, startIndex, stopIndex);
-            // We didn't find the item, loop back to the top
-            if (retVal == -1)
-            {
-                retVal = findStringLoop(input, 0, selectedIndex);
-            }
-        }
+        retVal = findStringLoop(input, 0, dataProvider.length);

         if (retVal != -1)
             retVector.push(retVal);
@@ -532,6 +545,32 @@
             return input;
     }

+    /**
+     *  @private
+     *  Helper function to apply the textInput text to selectedItem
+     */
+    mx_internal function applySelection():void
+    {
+        if (actualProposedSelectedIndex == CUSTOM_SELECTED_ITEM)
+        {
+            var itemFromInput:* = getCustomSelectedItem();
+            if (itemFromInput != undefined)
+                selectedItem = itemFromInput;
+            else
+                selectedIndex = NO_SELECTION;
+        }
+        else
+        {
+            selectedIndex = actualProposedSelectedIndex;
+        }
+
+        //trace("CB.applySelection selectRange -1, -1");
+        // TODO (jszeto) Should we always be turning off selection?
+        textInput.selectRange(-1, -1);
+
+        userTypedIntoText = false;
+    }
+
     //--------------------------------------------------------------------------
     //
     //  Overridden methods
@@ -542,9 +581,7 @@
      *  @private
      */
     override protected function commitProperties():void
-    {
-        //trace("CB.commitProperties selectedIndex",selectedIndex,"input string", textInput.text);
-
+    {
         // Keep track of whether selectedIndex was programmatically changed
         var selectedIndexChanged:Boolean = _proposedSelectedIndex != NO_PROPOSED_SELECTION;

@@ -591,7 +628,7 @@
         {
             if (selectedItem != null && selectedItem != undefined)
             {
-                //trace("CB.updateLabelDisplay",LabelUtil.itemToLabel(selectedItem, labelField, labelFunction));
+                //trace("CB.updateLabelDisplay [",LabelUtil.itemToLabel(selectedItem, labelField, labelFunction),"]");
                 textInput.text = LabelUtil.itemToLabel(selectedItem, labelField, labelFunction);
             }
         }
@@ -613,6 +650,43 @@
             textInput.maxChars = maxChars;
             textInput.restrict = restrict;
             textInput.focusEnabled = false;
+
+            textInput.textDisplay.batchTextInput = false;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override protected function partRemoved(partName:String, instance:Object):void
+    {
+        super.partRemoved(partName, instance);
+
+        if (instance == textInput)
+        {
+            textInput.removeEventListener(TextOperationEvent.CHANGE, textInput_changeHandler);
+            textInput.removeEventListener(FocusEvent.FOCUS_IN, textInput_focusInHandler, true);
+            textInput.removeEventListener(FocusEvent.FOCUS_OUT, textInput_focusOutHandler, true);
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override mx_internal function changeHighlightedSelection(newIndex:int):void
+    {
+        super.changeHighlightedSelection(newIndex);
+
+        var item:Object = dataProvider ? dataProvider.getItemAt(newIndex) : undefined;
+        if (item)
+        {
+            var itemString:String = itemToLabel(item);
+            //trace("CB.changeHighlightedSelection item",itemString);
+            textInput.selectAll();
+            textInput.insertText(itemString);
+            textInput.selectAll();
+
+            userTypedIntoText = false;
         }
     }

@@ -628,7 +702,7 @@
         if (!isTextInputInFocus)
         {
             //trace("ComboBox.keyDownHandler code",event.keyCode,"IGNORED");
-            super.keyDownHandler(event);
+            keyDownHandlerHelper(event);
         }

         // No op. ComboBox listens for keyboard events in the capture phase
@@ -642,7 +716,26 @@
         if (isTextInputInFocus)
         {
             //trace("ComboBox.capture_keyDownHandler code",event.keyCode);
-            super.keyDownHandler(event);
+            keyDownHandlerHelper(event);
+        }
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function keyDownHandlerHelper(event:KeyboardEvent):void
+    {
+        super.keyDownHandler(event);
+
+        if (event.keyCode == Keyboard.ENTER && !isDropDownOpen)
+        {
+            // commit the current text
+            applySelection();
+        }
+        else if (event.keyCode == Keyboard.ESCAPE)
+        {
+            // Restore the previous selectedItem
+            textInput.text = itemToLabel(selectedItem);
         }
     }

@@ -652,129 +745,149 @@
     override public function setFocus():void
     {
         if (stage)
-        {
-            stage.focus = textInput.textDisplay;
+        {
+            stage.focus = textInput.textDisplay;
+        }
+    }
+
+    /**
+     *  @private
+     */
+    override protected function isOurFocus(target:DisplayObject):Boolean
+    {
+        return target == textInput.textDisplay;
+    }
+
+    /**
+     *  @private
+     */
+    override protected function focusInHandler(event:FocusEvent):void
+    {
+        super.focusInHandler(event);
+
+        // Since the API ignores the visual editable and selectable
+        // properties make sure the selection should be set first.
+        if (textInput &&
+            (textInput.editable || textInput.selectable))
+        {
+            // Workaround RET handling the mouse and performing its own selection logic
+            callLater(textInput.selectAll);
+        }
+
+        userTypedIntoText = false;
+    }
+
+    /**
+     *  @private
+     */
+    override protected function focusOutHandler(event:FocusEvent):void
+    {
+        // always commit the selection if we focus out
+        if (!isDropDownOpen)
+        {
+            if (textInput.text != itemToLabel(selectedItem))
+                applySelection();
+        }

-            // Since the API ignores the visual editable and selectable
-            // properties make sure the selection should be set first.
-            if (textInput.textDisplay &&
-                (textInput.textDisplay.editable || textInput.textDisplay.selectable))
+        super.focusOutHandler(event);
+    }
+
+    /**
+     *  @private
+     */
+    override mx_internal function dropDownController_openHandler(event:DropDownEvent):void
+    {
+        super.dropDownController_openHandler(event);
+
+        // If the user typed in text, start off by not showing any selection
+        // If this does match, then processInputField will highlight the match
+        userProposedSelectedIndex = userTypedIntoText ? NO_SELECTION : selectedIndex;
+    }
+
+    /**
+     *  @private
+     */
+    override protected function dropDownController_closeHandler(event:DropDownEvent):void
+    {
+        super.dropDownController_closeHandler(event);
+
+        // Commit the textInput text as the selection
+        if (!event.isDefaultPrevented())
+        {
+            applySelection();
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event Handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    private function textInput_focusInHandler(event:FocusEvent):void
+    {
+        isTextInputInFocus = true;
+    }
+
+    /**
+     *  @private
+     */
+    private function textInput_focusOutHandler(event:FocusEvent):void
+    {
+        isTextInputInFocus = false;
+    }
+
+    /**
+     *  @private
+     */
+    protected function textInput_changeHandler(event:TextOperationEvent):void
+    {
+
+        userTypedIntoText = true;
+
+        //var ito:InsertTextOperation = event.operation as InsertTextOperation;
+
+        //trace("CB.textInput_changeHandler flow operation",event.operation,"text", ito ? ito.text : '');
+
+        var operation:FlowOperation = event.operation;
+
+        // Close the dropDown if we press delete or cut the selected text
+        if (operation is DeleteTextOperation || operation is CutOperation)
+        {
+            closeDropDown(false);
+        }
+        else
+        {
+            if (openOnInput)
             {
-                textInput.textDisplay.selectAll();
+                if (!isDropDownOpen)
+                {
+                    // Open the dropDown if it isn't already open
+                    //trace("CB dropDown closed. processInputField delayed");
+                    openDropDown();
+                    addEventListener(DropDownEvent.OPEN, editingOpenHandler);
+                    return;
+                }
+
+                processInputField();
             }
         }
     }

     /**
-     *  @private
-     */
-    override protected function isOurFocus(target:DisplayObject):Boolean
-    {
-        return target == textInput.textDisplay;
-    }
-
-    /**
-     *  @private
-     */
-    override protected function dropDownController_closeHandler(event:DropDownEvent):void
-    {
-        super.dropDownController_closeHandler(event);
-
-        if (!event.isDefaultPrevented())
-        {
-            if (actualProposedSelectedIndex == CUSTOM_SELECTED_ITEM)
-            {
-                var itemFromInput:* = getCustomSelectedItem();
-                if (itemFromInput != undefined)
-                    selectedItem = itemFromInput;
-                else
-                    selectedIndex = NO_SELECTION;
-            }
-            else
-            {
-                selectedIndex = actualProposedSelectedIndex;
-            }
-        }
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Event Handlers
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     */
-    private function textInput_focusInHandler(event:FocusEvent):void
-    {
-        isTextInputInFocus = true;
-    }
-
-    /**
-     *  @private
-     */
-    private function textInput_focusOutHandler(event:FocusEvent):void
-    {
-        isTextInputInFocus = false;
-    }
-
-    /**
-     *  @private
-     */
-    protected function textInput_changeHandler(event:Event):void
-    {
-        // Ignore the ENTER key
-        /*if (isEnterKeyDown)
-            return;*/
-        //trace("CB.textInput_changeHandler");
-        /* TODO (jszeto) Figure out how to find the new text
-
-        Two ways of doing the interaction:
-
-        1. DropDown shows set of possible choices
-
-        - Behavior as defined in XD spec
-        - Create new function that takes an input string and returns the array of data items
-        that match string
-        - Figure out how to only display a subset of the dataProvider. Use collection filters?
-
-        2. DropDown highlights first match
-
-        - DropDown opens if we find a match
-        - Match is highlighted, but not selected until Enter or mouse click selects the item
-        - Can use arrows to change selection
-        - Behavior of Halo ComboBox
-
-        */
-
-
-        // Open the dropDown if it isn't already open
-        if (openOnInput)
-        {
-            if (!isDropDownOpen)
-            {
-                openDropDown();
-                addEventListener(DropDownEvent.OPEN, editingOpenHandler);
-                return;
-            }
-
-            processInputField();
-        }
-    }
-
-    /**
      *  @private
      */
     private function editingOpenHandler(event:DropDownEvent):void
     {
+        //trace("CB calling delayed processInputField");
         removeEventListener(DropDownEvent.OPEN, editingOpenHandler);
         processInputField();
     }

-
-

 }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 4163
Author:   gosmith@adobe.com
Date:     2008-11-21T23:05:07.953326Z

Log Message:
-----------
Coding conventions: All [SkinPart] metadata now explicitly states required="true" or required="false".

QE Notes: None
Doc Notes: None
Bugs: None
Reviewer: Evtim

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxScroller.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/FxTrackBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxDataContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxSpinner.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxPanel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxButtonBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/FxContainer.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1280425 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/Scroller.as
+++ frameworks/projects/spark/src/spark/components/Scroller.as
@@ -86,7 +86,8 @@
     //  horizontalScrollBar
     //----------------------------------

-    [SkinPart]
+    [SkinPart(required="true")]
+
     /**
      * A skin part that defines the horizontal scrollbar.
      */
@@ -96,7 +97,8 @@
     //  verticalScrollBar
     //----------------------------------

-    [SkinPart]
+    [SkinPart(required="true")]
+
     /**
      * A skin part that defines the vertical scrollbar.
      */


Transferred from the Adobe Open Source Subversion Repository

Revision: 22658
Author:   eday@adobe.com
Date:     2011-09-21T18:20:22.537923Z

Log Message:
-----------
More ItemSnapping fixes for orientation change support

Accounts for behavioral differences between iOS/Android and ADL/device.  Also fixes issue with stale virtual layout cache.

QE notes:
Doc notes:
Bugs: SDK-31607, SDK-31002
Reviewer: Jazon Sz
Tests run: checkintests, full mobile List suite, Cyclone assist
Is noteworthy for integration: no

Modified Paths:
--------------
/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/Scroller.as

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1280550 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/Scroller.as
+++ frameworks/projects/spark/src/spark/components/Scroller.as
@@ -1408,7 +1408,7 @@
             // clipped/obscured by the soft keyboard
             var topLevelApp:Application = FlexGlobals.topLevelApplication as Application;
             var eltBounds:Rectangle;
-            var adjustForSoftKeyboard:Boolean = topLevelApp &&
+            var adjustForSoftKeyboard:Boolean = topLevelApp &&
                                                 (!topLevelApp.resizeForSoftKeyboard) &&
                                                 (stage && stage.softKeyboardRect.height > 0);

@@ -1759,7 +1759,7 @@
     /**
      *  @private
      */
-    private function handleContentSizeChange():void
+    private function handleSizeChange():void
     {
         // The content size has changed, so the current scroll
         // position and/or any in-progress throw may need to be adjusted.
@@ -2040,12 +2040,12 @@
     /**
      *  @private
      */
-    private function handleContentSizeChangeOnUpdateComplete(event:FlexEvent):void
+    private function handleSizeChangeOnUpdateComplete(event:FlexEvent):void
     {
         viewport.removeEventListener(FlexEvent.UPDATE_COMPLETE,
-            handleContentSizeChangeOnUpdateComplete);
-
-        handleContentSizeChange();
+            handleSizeChangeOnUpdateComplete);
+
+        handleSizeChange();
     }

     /**
@@ -2056,11 +2056,9 @@
         if (getStyle("interactionMode") == InteractionMode.TOUCH)
         {
             // If the viewport dimensions have changed, then we may need to update the
-            // scroll ranges per the new viewport size.
-            // Note that the orientationChangeHandler serves the same purpose, but on
-            // some platforms (i.e. Android) the runtime sends the "orientationChange"
-            // event before the new viewport dimensions are set.
-            determineScrollRanges();
+            // scroll ranges and snap the scroll position per the new viewport size.
+            viewport.addEventListener(FlexEvent.UPDATE_COMPLETE,
+                handleSizeChangeOnUpdateComplete);
         }
     }

@@ -2080,7 +2078,7 @@
                     // may have changed.  In this case, we need to schedule an updateComplete
                     // handler to check and potentially correct the scroll positions.
                     viewport.addEventListener(FlexEvent.UPDATE_COMPLETE,
-                        handleContentSizeChangeOnUpdateComplete);
+                        handleSizeChangeOnUpdateComplete);
                 }
                 break;

@@ -2175,7 +2173,7 @@
             // Remember the page count so we'll know whether it changed.
             previousOrientationPageCount = getCurrentPageCount();
         }
-        else
+        else if (scrollSnappingMode != ScrollSnappingMode.NONE)
         {
             // For item snapping, we remember which specific element is currently snapped.

@@ -2187,19 +2185,12 @@
             // lastSnappedElement was set as a side-effect of the call to getSnappedPosition above.
             orientationChangeSnapElement = lastSnappedElement;
         }
-    }
-
-    /**
-     *  @private
-     */
-    private function orientationChangeHandler(event:Event):void
-    {
-        if (getStyle("interactionMode") == InteractionMode.TOUCH)
-        {
-            // When the orientation (landscape/portrait) changes, then the valid
-            // scroll position ranges may have changed.
-            checkScrollPosition();
-        }
+
+        // Force the viewport layout to clear its cache of element
+        // dimensions so it can be repopulated with correct values
+        // after the orientation change is complete.
+        if (viewportLayout)
+            viewportLayout.clearVirtualLayoutCache();
     }

     //--------------------------------------------------------------------------
@@ -3207,19 +3198,21 @@
      */
     private function snapContentScrollPosition(snapHorizontal:Boolean = true, snapVertical:Boolean = true):void
     {
-        if (snapHorizontal)
-        {
-            viewport.horizontalScrollPosition = getSnappedPosition(
-                Math.min(Math.max(minHorizontalScrollPosition, viewport.horizontalScrollPosition), maxHorizontalScrollPosition),
-                HORIZONTAL_SCROLL_POSITION);
-        }
-
-        if (snapVertical)
-        {
-            viewport.verticalScrollPosition = getSnappedPosition(
-                Math.min(Math.max(minVerticalScrollPosition, viewport.verticalScrollPosition), maxVerticalScrollPosition),
-                VERTICAL_SCROLL_POSITION);
-        }
+        // Note that we only snap the scroll position if content is present.  This allows existing scroll position
+        // values to be retained before content is added or when it is removed/readded.
+        if (snapHorizontal && viewport.contentWidth != 0)
+    {
+        viewport.horizontalScrollPosition = getSnappedPosition(
+            Math.min(Math.max(minHorizontalScrollPosition, viewport.horizontalScrollPosition), maxHorizontalScrollPosition),
+            HORIZONTAL_SCROLL_POSITION);
+        }
+
+        if (snapVertical && viewport.contentHeight != 0)
+        {
+        viewport.verticalScrollPosition = getSnappedPosition(
+            Math.min(Math.max(minVerticalScrollPosition, viewport.verticalScrollPosition), maxVerticalScrollPosition),
+            VERTICAL_SCROLL_POSITION);
+    }
     }

     /**
@@ -3647,8 +3640,10 @@
     {
         if (getStyle("interactionMode") == InteractionMode.TOUCH)
         {
-            systemManager.stage.addEventListener("orientationChange",orientationChangeHandler);
-            systemManager.stage.addEventListener("orientationChanging", orientationChangingHandler);
+            // Note that we listen for orientationChanging in the capture phase.  This is done so we get the event
+            // before Application does to ensure that the pre-orientation-change dimensions are still in effect.
+            // On iOS, Application swaps the dimensions and forces a validation in its orientationChanging handler.
+            systemManager.stage.addEventListener("orientationChanging", orientationChangingHandler, true);
         }
     }

@@ -3658,10 +3653,7 @@
     private function removedFromStageHandler(event:Event):void
     {
         if (getStyle("interactionMode") == InteractionMode.TOUCH)
-        {
-            systemManager.stage.removeEventListener("orientationChange",orientationChangeHandler);
-            systemManager.stage.removeEventListener("orientationChanging", orientationChangingHandler);
-        }
+            systemManager.stage.removeEventListener("orientationChanging", orientationChangingHandler, true);
     }

     /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 10005
Author:   srahim@adobe.com
Date:     2009-09-03T22:02:13.503554Z

Log Message:
-----------
ASDocs edits
QE notes: None
Doc notes:  None
Bugs: None
Reviewer: None
Tests run: Checkin
Is noteworthy for integration: No

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextArea.as

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1280892 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/TextArea.as
+++ frameworks/projects/spark/src/spark/components/TextArea.as
@@ -95,111 +95,113 @@

 /**
  *  TextArea is a text-entry control that lets users enter and edit
- *  multiple lines of richly-formatted text.
- *
- *
It can display horizontal and vertical scrollbars
- *  for scrolling through the text,
- *  and also supports vertical scrolling with the mouse wheel.

+ *  multiple lines of richly formatted text. It can display horizontal and vertical scrollbars
+ *  for scrolling through the text and supports vertical scrolling with the mouse wheel.
  *
  *
It does not include any user interface for changing
- *  the formatting of the text.
- *  But it offers APIs which can do this programmatically;
- *  these make it possible, for example, for you to create
- *  a Bold button that makes the selected text bold.

- *
- *
This Spark version of TextArea, which is new with Flex 4,
- *  makes use of the new Text Layout Framework (TLF) library,
- *  which in turn builds on the new Flash Text Engine (FTE)
+ *  the formatting of the text but contains
+ *  APIs that you can use to programmatically format text.
+ *  For example, you can create a
+ *  a button that, when clicked, makes the selected text bold.

+ *
+ *
The Spark version of TextArea
+ *  uses the Text Layout Framework (TLF) library,
+ *  which builds on the Flash Text Engine (FTE)
  *  in Flash Player 10.
  *  In combination, these layers provide text editing with
  *  high-quality international typography and layout.
  *  The older MX version of TextArea displays text using the older
  *  TextField class.

  *
- *
The most important differences to understand are:
+ *
The most important differences between Spark TextArea and the
+ *  MX TextArea control are as follows:
  *

- *
The Spark version offers better typography, better support
+ *
Spark TextArea offers better typography, better support
  *        for international languages, and better text layout.

- *
The Spark version has an object-oriented model of rich text,
+ *
Spark TextArea has an object-oriented model of rich text,
  *        while the MX version does not.

- *
The Spark version has better support for displaying
+ *
Spark TextArea has better support for displaying
  *        large amounts of text.

- *
The Spark version requires that fonts be embedded
+ *
Spark TextArea requires that fonts be embedded
  *        differently than the MX version.
- *        Consult the documentation regarding how to use the
- *        embedAsCFF attribute when you embed a font.

+ *        To learn how to use the
+ *        embedAsCFF attribute when you embed a font,
+ *    see the topic "Using embedded fonts" in Using Flex SDK.

  *

  *
- *
The Spark TextArea uses TLF's object-oriented model of rich text,
+ *
The Spark TextArea control uses the TLF object-oriented model of rich text,
  *  in which text layout elements such as divisions, paragraphs, spans,
  *  hyperlinks, and images are represented at runtime by ActionScript
- *  objects which can be programmatically accessed and manipulated.
+ *  objects. You can programmatically access and manipulate these objects.
  *  The central object in TLF for representing rich text is a
- *  TextFlow, so you specify rich text for the Spark TextArea to display
- *  by setting its textFlow property to a TextFlow instance.
- *  Please see the description of the textFlow
+ *  TextFlow. Specify rich text for a TextArea control
+ *  by setting its textFlow property to a TextFlow instance.
+ *  See the description of the textFlow
  *  property for information about how to create one,
- *  such as by importing TLF markup.
- *  If you don't need to display text that has multiple formats,
- *  simply set the text property to a "plain text" String.
- *  See the description of the text and textFlow
+ *  such as by importing TLF markup.

+ *
+ *
If you don't need to display text that has multiple formats,
+ *  set the TextArea text property to a plain text string.
+ *  See the descriptions of the text and textFlow
  *  properties for information about how they interact;
  *  for example, you can set one and get the other.

  *
- *
At compile time, you can simply put TLF markup tags inside
- *  the TextArea tag, as in
+ *
At compile time, you can put TLF markup tags inside
+ *  the TextArea tag, as in the following example:
  *

  *  <s:TextArea>Hello <s:span fontWeight="bold">World!</s:span></s:TextArea>
  *

- *  In this case, the MXML compiler sets the content
+ *  In this example, the MXML compiler sets the TextArea content
  *  property, causing a TextFlow to be automatically created
  *  from the FlowElements that you specify.

  *
  *
The default text formatting is determined by CSS styles
- *  such as fontFamily, fontSize.
+ *  such as fontFamily and fontSize.
  *  Any formatting information in the TextFlow overrides
  *  the default formatting provided by the CSS styles.

  *
- *
You can control the spacing between lines with the
- *  lineHeight style and the spacing between
- *  paragraphs with the paragraphSpaceBefore
- *  and paragraphSpaceAfter styles.
- *  You can align or justify the text using the textAlign
- *  and textAlignLast styles.
- *  You can inset the text from the controls border using the
- *  paddingLeft, paddingTop,
- *  paddingRight, and paddingBottom styles.

- *
- *
By default, the text wraps at the right edge of the control
- *  and a vertical scrollbar appears automatically when there is more
- *  text than fits.
+ *
You can control many characteristics of TextArea content with styles. Here
+ *  are a few popular ones:

+ *
+ *

Control spacing between lines with the
+ *  lineHeight style.

+ *
Control the spacing between paragraphs with the
+ *  paragraphSpaceBefore and paragraphSpaceAfter styles.

+ *
Align or justify text using the textAlign and textAlignLast styles.

+ *
Inset text from the border of the control using the paddingLeft, paddingTop,
+ *  paddingRight, and paddingBottom styles.

+ *

+ *
+ *
By default, the text wraps at the right edge of the control.
+ *  A vertical scrollbar automatically appears when there is more
+ *  text than fits in the TextArea.
  *  If you set the lineBreak style to "explicit",
- *  new lines will start only at explicit lines breaks, such as
+ *  new lines start only at explicit line breaks, such as
  *  if you use CR ("\r"), LF ("\n"),
  *  or CR+LF ("\r\n") in text
  *  or if you use <p> and <br/>
  *  in TLF markup.
- *  In that case, a horizontal scrollbar will automatically appear
- *  if any lines are wider than the control,

+ *  In those cases, a horizontal scrollbar automatically appears
+ *  if any lines of text are wider than the control.

  *
  *
The widthInChars and heightInChars
- *  properties provide a convenient way to specify the width and height
+ *  properties let you specify the width and height of the TextArea
  *  in a way that scales with the font size.
- *  Of course, you can also specify an explicit width or height in pixels,
- *  or use a percent width and height, or use constraints such as
+ *  You can also specify an explicit width or height in pixels,
+ *  or use a percent width and height or constraints such as
  *  left and right
  *  or top and bottom.

  *
  *
You can use the maxChars property to limit the number
- *  of character that the user can enter, and the restrict
+ *  of character that the user can enter and the restrict
  *  to limit which characters the user can enter.

  *
  *
When the user presses the Enter key, a new paragraph is started;
  *  it does not cause a line break within the current paragraph.

  *
- *
If you don't want the text to be editable,
+ *
If you don't want text to be editable,
  *  set the editable property to false.
- *  If you don't even want it to be selectable,
+ *  If you don't want it to be selectable,
  *  set the selectable property to false.

  *
  *
This control is a skinnable control whose skin uses a
@@ -269,6 +271,8 @@
  *  />
  *

  *
+ *  @see #text
+ *  @see #textFlow
  *  @see spark.components.TextInput
  *  @see spark.skins.spark.TextAreaSkin
  *  @see spark.components.RichText


Transferred from the Adobe Open Source Subversion Repository

Revision: 12539
Author:   mhorn@adobe.com
Date:     2009-12-04T18:26:28.712292Z

Log Message:
-----------
asdoc updates in prep for l10n

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextArea.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextSelectionHighlighting.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextInput.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/events/TextOperationEvent.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1280904 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/components/TextArea.as
+++ frameworks/projects/spark/src/spark/components/TextArea.as
@@ -41,7 +41,7 @@
 [Style(name="symbolColor", type="uint", format="Color", inherit="yes", theme="spark")]

 /**
- *  @copy spark.components.Scroller#style.horizontalScrollPolicy
+ *  @copy spark.components.Scroller#style:horizontalScrollPolicy
  *
  *  @langversion 3.0
  *  @playerversion Flash 10
@@ -51,7 +51,7 @@
 [Style(name="horizontalScrollPolicy", type="String", inherit="no", enumeration="off,on,auto")]

 /**
- *  @copy spark.components.Scroller#style.verticalScrollPolicy
+ *  @copy spark.components.Scroller#style:verticalScrollPolicy
  *
  *  @langversion 3.0
  *  @playerversion Flash 10
@@ -129,7 +129,7 @@
  *        differently than the MX version.
  *        To learn how to use the
  *        embedAsCFF attribute when you embed a font,
- *    see the topic "Using embedded fonts" in Using Flex.

+ *    see the font documentation.

  *

  *
  *
The Spark TextArea control uses the TLF object-oriented model of rich text,
@@ -138,8 +138,7 @@
  *  objects. You can programmatically access and manipulate these objects.
  *  The central object in TLF for representing rich text is a
  *  TextFlow. Specify rich text for a TextArea control
- *  by setting its textFlow
- *  property to a TextFlow instance.

+ *  by setting its textFlow property to a TextFlow instance.

  *
  *
If you don't need to display text that has multiple formats,
  *  set the TextArea text property to a plain text string.
@@ -148,14 +147,12 @@
  *  for example, you can set one and get the other.

  *
  *
At compile time, you can put TLF markup tags inside
- *  the TextArea tag, as in the following example:
+ *  the TextArea tag, as the following example shows:
  *

  *  <s:TextArea>Hello <s:span fontWeight="bold">World!</s:span></s:TextArea>
  *

  *  In this example, the MXML compiler sets the TextArea content
- *  property, causing a TextFlow object
- *  to be created from the FlowElements
- *  that you specify.

+ *  property, causing a TextFlow object to be created from the FlowElements that you specify.

  *
  *
The default text formatting is determined by CSS styles
  *  such as fontFamily
@@ -178,10 +175,10 @@
  *
By default, the text wraps at the right edge of the control.
  *  A vertical scrollbar automatically appears when there is more
  *  text than fits in the TextArea.
- *  If you set the lineBreak style to "explicit",
+ *  If you set the lineBreak style to explicit,
  *  new lines start only at explicit line breaks. This has the same effect as
- *  if you use CR ("\r"), LF ("\n"),
- *  or CR+LF ("\r\n") in text,
+ *  if you use CR (\r), LF (\n),
+ *  or CR+LF (\r\n) in text,
  *  or if you use <p> and <br/>
  *  in TLF markup.
  *  In those cases, a horizontal scrollbar automatically appears
@@ -206,17 +203,16 @@
  *  and the Scroller as scroller.

  *
  *
The Spark TextArea
- *  can display left-to-right (LTR), text such as French,
+ *  can display left-to-right (LTR) text, such as French,
  *  right-to-left (RTL) text, such as Arabic, and bidirectional text,
  *  such as a French phrase inside of an Arabic one.
  *  If the predominant text direction is right-to-left,
- *  set the direction style to "rtl".
- *  The textAlign style defaults to "start",
+ *  set the direction style to rtl.
+ *  The textAlign style defaults to start,
  *  which makes the text left-aligned when direction
- *  is "ltr" and right-aligned when direction
- *  is "rtl".
- *  To get the opposite alignment,
- *  set textAlign to "end".

+ *  is ltr and right-aligned when direction
+ *  is rtl. To get the opposite alignment,
+ *  set textAlign to end.

  *
  *
The Spark TextArea also supports
  *  unlimited undo/redo within one editing session.
@@ -255,14 +251,14 @@
  *

  *  <s:TextArea
  *    Properties
- *    heightInLines=""
- *    textFlow="24"
- *    widthInChars=""
+ *    heightInLines="Calculated default"
+ *    textFlow="TextFlow"
+ *    widthInChars="Calculated default"
  *
  *    Styles
- *    horizontalScrollPolicy="No default"
+ *    horizontalScrollPolicy="auto"
  *    symbolColor=""
- *    verticalScrollPolicy="No default"
+ *    verticalScrollPolicy="auto"
  *  />
  *

  *
@@ -439,12 +435,12 @@
      *  for rich text content in the Text Layout Framework.
      *
      *
The content property is the default property
-     *  for TextArea, so that you can write MXML such as
+     *  for TextArea, so that you can write MXML, as the following example shows:
      *

      *  <s:TextArea>Hello <s:span fontWeight="bold">World</s:span></s:TextArea>
      *

-     *  and have the String and SpanElement that you specify
-     *  as the content be used to create a TextFlow.

+     *  In this example, the String and SpanElement that you specify
+     *  as the content are used to create a TextFlow.

      *
      *
This property is typed as Object because you can set it to
      *  to a String, a FlowElement, or an Array of Strings and FlowElements.
@@ -456,8 +452,6 @@
      *
No matter how you specify the content, the content is converted
      *  to a TextFlow object. When you get the value of this property, you get
      *  the resulting TextFlow object.

-     *
-     *

      *
      *  @langversion 3.0
      *  @playerversion Flash 10


Transferred from the Adobe Open Source Subversion Repository

Revision: 7319
Author:   jszeto@adobe.com
Date:     2009-05-27T17:45:33.641648Z

Log Message:
-----------
Transform improvements

http://bugs.adobe.com/jira/browse/SDK-17312 - Fix up transform, matrix and matrix3D properties on UIComponent and GraphicElement.

When a Transform is assigned to a GraphicElement or UIComponent, we want changes to the Transform to be applied to the GraphicElement or UIComponent (component). The current implementation has the component listening for change events on the Transform. We also want the Transform to reflect changes made to the component. The current implementation doesn’t do this.

The solution is when the Transform is assigned to the component, that component is assigned to the target property of the Transform. Any calls to the setters of the Transform directly assign properties of the component. The getters grab their values directly from the component. The components no longer listen for change events from the Transform.

Since the GraphicElement and IGraphicElement classes exist in the flex4 swc, they can not be used in the Transform class, which exists only in the framework swc. The solution is to use loose typing and use the “property in object” check. The change to the component classes are made in UIComponent, UIMovieClip and GraphicElement.

I added a public $transform property to UIMovieClip to access super.transform. I had to make it public because the framework swc doesn’t include UIMovieClip.

I was unable to override the matrix3D setter in Transform because it was throwing an illegal override compiler error.

I had to add a setColorTransform public function to GraphicElement to handle the case where the GraphicElement’s colorTransform is directly set.

myRect.transform.colorTransform = newColorTransform;

In this situation, the GraphicElement’s transform object is created on demand. At this point, the GraphicElement might not have its own DisplayObject, so we need a way to store the colorTransform value until the DO is created. I had to make the function public because the “in” operator doesn’t work with non-public namespaces.

ColorTransforms get passed around by reference, so in setColorTransform, I make a copy. This fixes some strange baseColor bug I was seeing.

http://bugs.adobe.com/jira/browse/SDK-17680 - GraphicElement with transform matrix ignores alpha property

If the alpha property and a transform are declaratively set on a GraphicElement, then the alpha value is ignored. The reason is that the Transform object always has a default value for its ColorTransform, which sets the alpha value. The transform.ColorTransform.alphaMultiplier and alpha property are synchronized in DisplayObject.

Ideally we would throw a compiler error if both the alpha property and the transform property were set at the same time. Instead, the next best thing to do is to apply the alpha value after the ColorTransform has been applied. We can do this for GraphicElement since alpha and colorTransform are set in commitProperties. For UIComponent, alpha is applied right away. I didn’t want to change that since it would probably break a whole lot of mustella tests and effect behavior. Thus this bug still exists in UIComponent.

QE Notes: Need tests to ensure that the Transform is in sync with its target component
Doc Notes: Need to document that changes to the component get reflected by its Transform
Bugs: SDK-17312, SDK-17680
Reviewer: Glenn

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/supportClasses/GraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/geom/Transform.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/halo-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flash-integration/src/mx/flash/UIMovieClip.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/fxg-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1260941 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/geom/Transform.as
+++ frameworks/projects/framework/src/mx/geom/Transform.as
@@ -1,93 +1,253 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2008 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
 package mx.geom
 {
-	import flash.geom.ColorTransform;
-	import flash.geom.Matrix;
-	import flash.geom.Rectangle;
-	import flash.geom.Transform;
-	import flash.display.Shape;
-	import flash.events.Event;
-	import flash.events.EventDispatcher;
-	import flash.events.IEventDispatcher;
-
-	import mx.events.PropertyChangeEvent;
-	import flash.display.DisplayObject;
-	import flash.geom.PerspectiveProjection;
-	import mx.core.IInvalidating;
-
-
-	public class Transform extends flash.geom.Transform implements IEventDispatcher
-	{
-		private var dispatcher:EventDispatcher;
+import flash.display.DisplayObject;
+import flash.display.Shape;
+import flash.geom.ColorTransform;
+import flash.geom.Matrix;
+import flash.geom.Matrix3D;
+import flash.geom.PerspectiveProjection;
+import flash.geom.Rectangle;
+import flash.geom.Transform;
+
+import mx.core.ILayoutElement;
+import mx.core.IVisualElement;
+import mx.core.UIComponent;
+import mx.core.mx_internal;
+
+use namespace mx_internal;
+
+/**
+ *  TODO
+ *
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class Transform extends flash.geom.Transform
+{
+	/**
+	 *  TODO
+	 *
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public function Transform(src:DisplayObject = null)
+	{
+		if(src == null)
+			src = new Shape();
+		super(src);
+	}
+
+	//--------------------------------------------------------------------------
+    //
+    //  Overridden flash.geom.Transform Properties
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	override public function set colorTransform(value:ColorTransform):void
+	{
+		if (target is UIComponent)
+			UIComponent(target).$transform.colorTransform = value;
+		else if (target && "$transform" in target) // UIMovieClip
+			target["$transform"]["colorTransform"] = value;
+		else if (target && "setColorTransform" in target)
+			target["setColorTransform"](value);
+		else
+			super.colorTransform = value;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function get colorTransform():ColorTransform
+	{
+		if (target is UIComponent)
+			return UIComponent(target).$transform.colorTransform;
+		else if (target && "$transform" in target) // UIMovieClip
+			return target["$transform"]["colorTransform"];
+		else if (target && "displayObject" in target && target["displayObject"] != null)
+			return target["displayObject"]["transform"]["colorTransform"];
+		else
+			return super.colorTransform;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function get concatenatedColorTransform():ColorTransform
+	{
+		if (target is UIComponent)
+			return UIComponent(target).$transform.concatenatedColorTransform;
+		else if (target && "$transform" in target) // UIMovieClip
+			return target["$transform"]["concatenatedColorTransform"];
+		else if (target && "displayObject" in target && target["displayObject"] != null)
+			return target["displayObject"]["transform"]["concatenatedColorTransform"];
+		else
+			return super.concatenatedColorTransform;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function get concatenatedMatrix():Matrix
+	{
+		if (target is UIComponent)
+			return UIComponent(target).$transform.concatenatedMatrix;
+		else if (target && "$transform" in target) // UIMovieClip
+			return target["$transform"]["concatenatedMatrix"];
+		else if (target && "displayObject" in target && target["displayObject"] != null)
+			return target["displayObject"]["transform"]["concatenatedMatrix"];
+		else
+			return super.concatenatedMatrix;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function set matrix(value:Matrix):void
+	{
+		if (target is ILayoutElement)
+			ILayoutElement(target).setLayoutMatrix(value, true);
+		else
+			super.matrix = value;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function get matrix():Matrix
+	{
+		if (target is ILayoutElement)
+			return ILayoutElement(target).getLayoutMatrix();
+		else
+			return super.matrix;
+	}
+
+	/*override public function set matrix3D(value:Matrix3D):void
+	{
+		if (target is ILayoutElement)
+			ILayoutElement(target).setLayoutMatrix3D(value, true);
+		else
+			super.matrix3D = value;
+	}*/
+
+	/**
+	 *  @private
+	 */
+	override public function get matrix3D():Matrix3D
+	{
+		if (target is ILayoutElement)
+			return ILayoutElement(target).getLayoutMatrix3D();
+		else
+			return super.matrix3D;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function set perspectiveProjection(value:PerspectiveProjection):void
+	{
+		// TODO!!! jszeto
+		var oldValue:PerspectiveProjection = super.perspectiveProjection;
+		super.perspectiveProjection = value;

-		public function Transform(src:DisplayObject = null)
-		{
-			dispatcher = new EventDispatcher();
-
-			if(src == null)
-				src = new Shape();
-			super(src);
-		}
-
-		[Bindable("propertyChange")]
-		override public function set matrix(value:Matrix):void
-		{
-			var oldMatrix:Matrix = super.matrix;
-			super.matrix = value;
-
-			dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "matrix", oldMatrix, value));
-
-		}
-
-		[Bindable("propertyChange")]
-		override public function set perspectiveProjection(value:PerspectiveProjection):void
-		{
-			var oldValue:PerspectiveProjection = super.perspectiveProjection;
-			super.perspectiveProjection = value;
-
-			dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "perspectiveProjection", oldValue, value));
-		}
-
-
-		[Bindable("propertyChange")]
-		override public function set colorTransform(value:ColorTransform):void
-		{
-			var oldColorTransform:ColorTransform = super.colorTransform;
-			super.colorTransform = value;
-
-			dispatchEvent(PropertyChangeEvent.createUpdateEvent(this, "colorTransform", oldColorTransform, value));
-		}
-
-		//--------------------------------------------------------------------------
-		//
-		//  IEventDispatcher properties and methods
-		//
-		//--------------------------------------------------------------------------
-		public function addEventListener(type:String, listener:Function,
-										 useCapture:Boolean = false, priority:int = 0,
-										 useWeakReference:Boolean = false):void
-		{
-			return dispatcher.addEventListener(type, listener, useCapture, priority,
-										useWeakReference);
-		}
-
-		public function dispatchEvent(event:Event):Boolean
-		{
-			 return dispatcher.dispatchEvent(event);
-		}
-
-		public function hasEventListener(type:String):Boolean
-		{
-			return dispatcher.hasEventListener(type);
-		}
-
-		public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
-		{
-			return dispatcher.removeEventListener(type, listener, useCapture);
-		}
-
-		public function willTrigger(type:String):Boolean
-		{
-			return dispatcher.willTrigger(type);
-		}
-	}
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function get perspectiveProjection():PerspectiveProjection
+	{
+		if (target is UIComponent)
+			return UIComponent(target).$transform.perspectiveProjection;
+		else if (target && "$transform" in target) // UIMovieClip
+			return target["$transform"]["perspectiveProjection"];
+		else if (target && "displayObject" in target && target["displayObject"] != null)
+			return target["displayObject"]["transform"]["perspectiveProjection"];
+		else
+			return super.perspectiveProjection;
+	}
+
+	/**
+	 *  @private
+	 */
+	override public function get pixelBounds():Rectangle
+	{
+		if (target is UIComponent)
+			return UIComponent(target).$transform.pixelBounds;
+		else if (target && "$transform" in target) // UIMovieClip
+			return target["$transform"]["pixelBounds"];
+		else if (target && "displayObject" in target && target["displayObject"] != null)
+			return target["displayObject"]["transform"]["pixelBounds"];
+		else
+			return super.pixelBounds;
+	}
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+	private var _target:IVisualElement;
+
+	/**
+	 *  TODO
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public function set target(value:IVisualElement):void
+	{
+		if (value !== _target)
+			_target = value;
+	}
+
+	/**
+	 *  @private
+	 */
+	public function get target():IVisualElement
+	{
+		return _target;
+	}
+
+	//--------------------------------------------------------------------------
+    //
+    //  Overridden flash.geom.Transform Methods
+    //
+    //--------------------------------------------------------------------------
+
+	override public function getRelativeMatrix3D(relativeTo:DisplayObject):Matrix3D
+	{
+		if (target is UIComponent)
+			return UIComponent(target).$transform.getRelativeMatrix3D(relativeTo);
+		else if (target && "$transform" in target) // UIMovieClip
+			return target["$transform"]["getRelativeMatrix3D"](relativeTo);
+		else if (target && "displayObject" in target && target["displayObject"] != null)
+			return target["displayObject"]["transform"]["getRelativeMatrix3D"](relativeTo);
+		else
+			return super.getRelativeMatrix3D(relativeTo);
+	}
+}
 }