Transferred from the Adobe Open Source Subversion Repository

Revision: 17741
Author:   doug.lee@ssbbartgroup.com
Date:     2010-09-16T23:52:40.864576Z

Log Message:
-----------
Initial DataGrid AccImpl for Spark.

QE notes:
Doc notes:
Bugs:
Reviewer:
Tests run: checkin
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/bundles/en_US/components.properties</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/accessibility/DataGridAccImpl.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/DataGrid.as</path>

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

--- frameworks/projects/spark/src/spark/accessibility/DataGridAccImpl.as
+++ frameworks/projects/spark/src/spark/accessibility/DataGridAccImpl.as
@@ -0,0 +1,738 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2010 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 spark.accessibility
+{
+
+import flash.accessibility.Accessibility;
+import flash.events.Event;
+import mx.accessibility.AccConst;
+import mx.collections.IList;
+import mx.core.UIComponent;
+import mx.core.mx_internal;
+import mx.resources.ResourceManager;
+import mx.resources.IResourceManager;
+import spark.components.DataGrid;
+import spark.components.Grid;
+import spark.components.supportClasses.GridSelectionMode;
+import spark.components.supportClasses.CellPosition;
+import spark.events.GridEvent;
+import spark.events.GridCaretEvent;
+import spark.events.GridSelectionEvent;
+import spark.skins.spark.DefaultGridItemRenderer;
+
+use namespace mx_internal;
+
+/**
+ *  DataGridAccImpl is a subclass of AccessibilityImplementation
+ *  which implements accessibility for the DataGrid class.
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class DataGridAccImpl extends ListBaseAccImpl
+{
+    include "../core/Version.as";
+
+    private var focusedCell:CellPosition = new CellPosition();
+	// See the DataGridAccImpl constructor for why this is not initialized here.
+	private static var dgAccInfo:ItemAccInfo; // = new ItemAccInfo();
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Enables accessibility in the DataGrid class.
+	 *
+	 *
This method is called by application startup code
+	 *  that is autogenerated by the MXML compiler.
+	 *  Afterwards, when instances of DataGrid are initialized,
+	 *  their accessibilityImplementation property
+	 *  will be set to an instance of this class.

+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public static function enableAccessibility():void
+	{
+		DataGrid.createAccessibilityImplementation =
+			createAccessibilityImplementation;
+	}
+
+	/**
+	 *  @private
+	 *  Creates a DataGrid's AccessibilityImplementation object.
+	 *  This method is called from UIComponent's
+	 *  initializeAccessibility() method.
+	 */
+	mx_internal static function createAccessibilityImplementation(
+								component:UIComponent):void
+	{
+		component.accessibilityImplementation =
+			new DataGridAccImpl(component);
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor.
+	 *
+	 *  @param master The UIComponent instance that this AccImpl instance
+	 *  is making accessible.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 1.5
+	 *  @productversion Flex 4
+	 */
+	public function DataGridAccImpl(master:UIComponent)
+	{
+		super(master);
+		// Normally this would not be done here, but at this writing,
+		// initializing dgAccInfo from its declaration line causes an RTE,
+		// apparently because the AS compiler does not yet detect a forward-ref
+		// problem that results in an incorrect initialization at run time.
+		// [DGL, 2010-09-07]
+		if (!dgAccInfo)
+			dgAccInfo = new ItemAccInfo();
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Overridden properties: AccImpl
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  eventsToHandle
+	//----------------------------------
+
+	/**
+	 *  @private
+	 *	Array of events that we should listen for from the master component.
+	 */
+	override protected function get eventsToHandle():Array
+	{
+        return super.eventsToHandle.concat([GridSelectionEvent.SELECTION_CHANGING]);
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Overridden methods: AccessibilityImplementation
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 *  Gets the role for the component.
+	 *
+	 *  @param childID Children of the component
+	 */
+	override public function get_accRole(childID:uint):uint
+	{
+		if (childID == 0)
+			// Get this out of the way quick; it's often requested by AT.
+			return role;
+		var dataGrid:DataGrid = DataGrid(master);
+        if (!dataGrid.columns)
+            return null;
+
+		if (childID <= dataGrid.columns.length && dataGrid.columnHeaderBar)
+			return AccConst.ROLE_SYSTEM_COLUMNHEADER;
+		else
+			// Same role for all childIDs regardless of mode (row or cell).
+			// Valid and invalid childIDs return this;
+			// this behavior is common to most list-based controls we've seen.
+			// [DGL, 2010-08-10]
+			return AccConst.ROLE_SYSTEM_LISTITEM;
+	}
+
+	/**
+	 *  @private
+	 *  IAccessible method for returning the state of the GridItem.
+	 *  States are predefined for all the components in MSAA.
+	 *  Values are assigned to each state.
+	 *  Depending upon the GridItem being Selected, Selectable, Invisible,
+	 *  Offscreen, a value is returned.
+	 *
+	 *  @param childID uint
+	 *
+	 *  @return State uint
+	 */
+	override public function get_accState(childID:uint):uint
+	{
+		var accState:uint = getState(childID);
+		if (childID <= 0)
+			return accState;
+
+		dgAccInfo.setup(master, childID);
+        if (!dgAccInfo.dataGrid.columns)
+            return null;
+		if (dgAccInfo.isInvalid)
+			// Child ID out of bounds most likely.
+			return accState;
+		if (dgAccInfo.isColumnHeader)
+			// There are some states we don't allow for these.
+			return accState & ~(
+				AccConst.STATE_SYSTEM_FOCUSABLE
+				| AccConst.STATE_SYSTEM_SELECTABLE
+				| AccConst.STATE_SYSTEM_FOCUSED
+				| AccConst.STATE_SYSTEM_SELECTED
+			);
+
+		// We now have only rows and data cells to consider.
+
+		// Determine if this item is focused.
+		if (childID == get_accFocus())
+			accState |= AccConst.STATE_SYSTEM_FOCUSED;
+
+		// Anything (row or cell) is selectable unless selection is not allowed at all.
+		if (dgAccInfo.dataGrid.selectionMode != GridSelectionMode.NONE)
+			accState |= AccConst.STATE_SYSTEM_SELECTABLE;
+
+		// Figure out visibility and selectedness.
+
+		if (dgAccInfo.isCellMode)
+		{
+			var renderer:DefaultGridItemRenderer = DefaultGridItemRenderer(
+				dgAccInfo.dataGrid.grid.getItemRendererAt(dgAccInfo.rowIndex, dgAccInfo.columnIndex)
+			);
+			if (renderer && renderer.selected)
+				accState |= AccConst.STATE_SYSTEM_SELECTED;
+		}
+		else  // row mode
+		{
+			var items:Vector.<int> = dgAccInfo.dataGrid.selectedIndices;
+			if (items.indexOf(dgAccInfo.rowIndex) >= 0)
+				accState |= AccConst.STATE_SYSTEM_SELECTED;
+		}  // cell or row mode
+
+		return accState;
+	}
+
+	/**
+	 *  @private
+	 *  IAccessible method for executing the Default Action.
+	 *
+	 *  @param childID uint
+	 */
+	override public function accDoDefaultAction(childID:uint):void
+	{
+		dgAccInfo.setup(master, childID);
+		if (!dgAccInfo.dataGrid.columns || dgAccInfo.isInvalid)
+			return;
+
+		if (dgAccInfo.isColumnHeader)
+		{
+        	// TODO: Allow doDefaultAction to sort columns
+			return;
+		}
+
+		if (dgAccInfo.isCellMode)
+		{
+        	// TODO: Allow doDefaultAction to go into edit mode if editable
+            var cp:CellPosition = new CellPosition();
+            cp.columnIndex = dgAccInfo.columnIndex;
+            cp.rowIndex = dgAccInfo.rowIndex;
+            dgAccInfo.dataGrid.selectedCell = cp;
+			return;
+		}
+		else
+		{
+    		dgAccInfo.dataGrid.selectedIndex = dgAccInfo.itemIndex;
+			return;
+		}
+	}
+
+	/**
+	 *  @private
+	 *  Method to return an array of childIDs.
+	 *
+	 *  @return Array
+	 */
+	override public function getChildIDArray():Array
+	{
+		dgAccInfo.setup(master, 0);
+        if (!dgAccInfo.dataGrid.columns)
+            return null;
+		return createChildIDArray(dgAccInfo.maxChildID);
+	}
+
+	/**
+	 *  @private
+	 *  IAccessible method for returning the bounding box of the GridItem.
+	 *
+	 *  @param childID uint
+	 *
+	 *  @return Location Object
+	 */
+	override public function accLocation(childID:uint):*
+	{
+		dgAccInfo.setup(master, childID);
+        if (!dgAccInfo.dataGrid.columns)
+            return null;
+        //var addHeader:int = dgAccInfo.dataGrid.columnHeaderBar.visible ? 1 : 0;
+		var row:int = dgAccInfo.rowIndex;
+
+        //row = index + addHeader;
+
+        //TODO: Fix location if off-screen, may be ok to actually expose location
+        //according to docs
+        /*if (row < dgAccInfo.dataGrid.scroller.viewport.verticalScrollPosition ||
+            row >= dgAccInfo.dataGrid.scroller.viewport.verticalScrollPosition + dgAccInfo.rowCount)
+        {
+            return null;
+        } */
+
+        if (dgAccInfo.isInvalid)
+            return null;
+
+        if (dgAccInfo.isColumnHeader)
+            return dgAccInfo.dataGrid.columnHeaderBar.dataGroup.getElementAt(childID-1);
+
+        // TODO: return correct height for rows and cells as incorrect height
+        // is being returned
+        var renderer:Object;
+        renderer = dgAccInfo.dataGrid.grid.getItemRendererAt(dgAccInfo.rowIndex, dgAccInfo.columnIndex);
+        return renderer ? renderer : null;
+	}
+
+	/**
+	 *  @private
+	 *  IAccessible method for returning the childFocus of the DataGrid.
+	 *
+	 *  @param childID uint
+	 *
+	 *  @return focused childID.
+	 */
+	override public function get_accFocus():uint
+	{
+		dgAccInfo.setup(master, 0);
+        if (!dgAccInfo.dataGrid.columns || !dgAccInfo.dataGrid.dataProvider)
+            return null;
+
+        // TODO: handle editable
+
+		var index:int;
+        if (dgAccInfo.isCellMode)
+        {
+            // TODO: consider handling case where no cell is select and only cell
+            // is focused and we don't have the focused cell because no caret
+            // change occurred.  Doesn't seem to cause an issue not to fix,
+            // returns list 0
+            if (focusedCell.columnIndex && focusedCell.rowIndex)
+			{
+                index = focusedCell.rowIndex*dgAccInfo.columnCount+focusedCell.columnIndex;
+			}
+            else  // no focused cell so use selection
+			{
+				var selectedCell:CellPosition = dgAccInfo.dataGrid.selectedCell;
+				if (!selectedCell)
+					return 0;
+	            index = selectedCell.rowIndex * dgAccInfo.columnCount +selectedCell.columnIndex;
+			}
+        }
+        else
+        {
+            index = (dgAccInfo.dataGrid.selectedIndex != -1) ? dgAccInfo.dataGrid.selectedIndex : 0;
+        }
+
+		return index >= 0 ? index + 1 + dgAccInfo.headerCount : 0;
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Overridden methods: AccImpl
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 *  method for returning the name of the ListItem/DataGrid
+	 *  which is spoken out by the screen reader
+	 *  The ListItem should return the label as the name with m of n string and
+	 *  DataGrid should return the name specified in the AccessibilityProperties.
+	 *
+	 *  @param childID uint
+	 *
+	 *  @return Name String
+	 */
+	override protected function getName(childID:uint):String
+	{
+		if (int(childID) <= 0)
+			return null;
+		dgAccInfo.setup(master, childID);
+		if (dgAccInfo.isInvalid || !dgAccInfo.dataGrid.columns)
+			return null;
+		if (dgAccInfo.isColumnHeader)
+			return dgAccInfo.dataGrid.columns.getItemAt(childID-1).headerText;
+
+		// We now have only rows and data cells to consider.
+        if (!dgAccInfo.dataGrid.dataProvider || !dgAccInfo.dataGrid.columns)
+            return null;
+
+		// String representation of row position.
+		// TODO: Localize this.
+		var rowString:String = "";
+		if ((dgAccInfo.isCellMode && dgAccInfo.columnIndex == 0) || !dgAccInfo.isCellMode)
+		{
+			var resourceManager:IResourceManager = ResourceManager.getInstance();
+			rowString = resourceManager.getString("components", "rowMofN");
+			rowString = rowString.replace("%1", dgAccInfo.rowIndex + 1).replace("%2", dgAccInfo.rowCount);
+		}
+
+		// Construct the name to return.
+		var name:String = "";
+		// TODO: Should the types of these be more specific?
+		var rowObject:Object = dgAccInfo.dataGrid.dataProvider.getItemAt(dgAccInfo.rowIndex);
+        var columns:IList = dgAccInfo.dataGrid.columns;
+		if (dgAccInfo.isCellMode)
+		{
+            name = columns.getItemAt(dgAccInfo.columnIndex).headerText + ": "
+            + cellName(rowObject, dgAccInfo.columnIndex);
+		}
+		else if (rowObject)  // row mode
+		{
+			for (var c:int = 0; c < dgAccInfo.columnCount; c++)
+			{
+                //TODO: remove header text if there is no columnHeaderBar
+				if (c > 0)
+					name += ",";
+				name += " "
+				+ columns.getItemAt(c).headerText
+				+ ": "
+				+ columns.getItemAt(c).itemToLabel(rowObject);
+			}
+		}  // cell or row mode
+		if (rowString)
+			name += ", " +rowString;
+
+		return name;
+	}
+
+    /**
+     *  @private
+     *  IAccessible method for selecting an item.
+     *
+     *  @param childID uint
+     */
+    override public function accSelect(selFlag:uint, childID:uint):void
+    {
+		dgAccInfo.setup(master, childID);
+
+        if (selFlag == AccConst.SELFLAG_TAKEFOCUS && !dgAccInfo.isColumnHeader && !dgAccInfo.isInvalid)
+        {
+            if (dgAccInfo.isCellMode)
+            {
+                var cellPosition:CellPosition = new CellPosition();
+                cellPosition.columnIndex = dgAccInfo.columnIndex;
+                cellPosition.rowIndex = dgAccInfo.rowIndex;
+                dgAccInfo.dataGrid.selectedCell = cellPosition;
+            }
+            else
+			{
+                dgAccInfo.dataGrid.selectedIndex = dgAccInfo.rowIndex;
+			}
+        }
+    }
+
+    /**
+     *  @private
+     *  IAccessible method for returning the child Selections in the List.
+     *
+     *  @param childID uint
+     *
+     *  @return focused childID.
+     */
+    override public function get_accSelection():Array
+    {
+        var accSelection:Array = [];
+		dgAccInfo.setup(master, 0);
+        if (!dgAccInfo.dataGrid.columns)
+            return null;
+		var i:int
+		var n:int
+		var items:Object;
+
+        if (dgAccInfo.isCellMode)
+        {
+			items = dgAccInfo.dataGrid.selectedCells;
+			n = items.length;
+            for (i = 0; i < n; i++)
+            {
+				// The selected childID is effectively the 1-based cell index.
+				// This is row*colCount + columnInRow +columnHeaderCount +1.
+                accSelection[i] = items[i].rowIndex * dgAccInfo.columnCount
+                + items[i].columnIndex
+                + dgAccInfo.headerCount + 1;
+            }
+        }
+        else // row mode
+        {
+			items = dgAccInfo.dataGrid.selectedIndices;
+			n = items.length;
+            for (i = 0; i < n; i++)
+            {
+				// This time we just need rowIndex (0-based) + headerCount + 1.
+                accSelection[i] = items[i] + dgAccInfo.headerCount + 1;
+            }
+
+        }
+
+        return accSelection;
+
+    }
+
+	//--------------------------------------------------------------------------
+	//
+	//  Overridden event handlers: AccImpl
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 *  Override the generic event handler.
+	 *  All AccImpl must implement this to listen
+	 *  for events from its master component.
+	 */
+	override protected function eventHandler(event:Event):void
+	{
+		// Let AccImpl class handle the events
+		// that all accessible UIComponents understand.
+		$eventHandler(event);
+
+		dgAccInfo.setup(master, 0);
+		if (!dgAccInfo.dataGrid.columns)
+			return;
+
+		var childID:uint;
+        switch (event.type)
+        {
+            case GridCaretEvent.CARET_CHANGE:
+            {
+                var index:int;
+                if (dgAccInfo.isCellMode)
+                {
+                    index = int(GridCaretEvent(event).newRowIndex)
+                    * dgAccInfo.columnCount+int(GridCaretEvent(event).newColumnIndex);
+                    focusedCell.rowIndex = GridCaretEvent(event).newRowIndex;
+                    focusedCell.columnIndex = GridCaretEvent(event).newColumnIndex;
+                }
+                else // row mode
+                {
+                    focusedCell.rowIndex = GridCaretEvent(event).newRowIndex;
+                    index = focusedCell.rowIndex;
+                }
+                if (index >= 0)
+                {
+                    childID = index + 1 + dgAccInfo.headerCount;
+
+                    Accessibility.sendEvent(dgAccInfo.dataGrid, childID,
+                                            AccConst.EVENT_OBJECT_FOCUS);
+                }
+                break;
+            }
+            case GridSelectionEvent.SELECTION_CHANGING:
+            {
+                if (dgAccInfo.isCellMode)
+                    index = GridSelectionEvent(event).selectionChange.rowIndex*dgAccInfo.columnCount + GridSelectionEvent(event).selectionChange.columnIndex;
+                else
+                    index = GridSelectionEvent(event).selectionChange.rowIndex;
+
+                if (index >= 0)
+                {
+                    childID = index + 1 + dgAccInfo.headerCount;
+                    Accessibility.sendEvent(dgAccInfo.dataGrid, childID,
+                                            AccConst.EVENT_OBJECT_SELECTION);
+                }
+                break;
+            }
+        }
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private function cellName(rowObject:Object, columnIndex:int):String
+	{
+		var item:Object = rowObject;
+		if (item is String)
+			return "" + item;
+		var dataGrid:DataGrid = DataGrid(master);
+		var columns:IList = dataGrid.columns;
+        if (!columns)
+			return null;
+		var column:Object = columns.getItemAt(columnIndex);
+		if (!column)
+			return null;
+		return column.itemToLabel(rowObject);
+	}
+
+    /**
+     *  @private
+     *  Returns true if the given row is above or below the viewable area.
+     */
+    private function rowIndexIsScrolledOffScreen(rowIndex: int): Boolean
+	{
+		var dataGrid:DataGrid = DataGrid(master);
+		var vpos:int = dataGrid.scroller.viewport.verticalScrollPosition;
+        if (rowIndex < vpos
+		|| rowIndex >= vpos + dataGrid.dataProvider.length)
+			return true;
+		return false;
+	}
+
+}
+
+}
+
+internal class ItemAccInfo
+{
+	import mx.core.UIComponent;
+	import spark.components.DataGrid;
+	import spark.components.Grid;
+	import spark.components.supportClasses.GridSelectionMode;
+	import spark.components.supportClasses.CellPosition;
+
+	/**
+	 *  Constructor.
+	 */
+	public function ItemAccInfo()
+	{
+		super();
+	}
+
+	/**
+	 *
+	 *  @param master The UIComponent instance that this AccImpl instance
+	 *  is making accessible.
+	 *  @param childID The childID of the item of interest.
+	 */
+	public function setup(master:UIComponent, childID:uint):void
+	{
+		this.master = master;
+		this.childID = childID;
+		dataGrid = DataGrid(master);
+		if (dataGrid.columns)
+			columnCount = dataGrid.columns.length;
+		else
+			columnCount = 0;
+		if (dataGrid.dataProvider)
+			rowCount = dataGrid.dataProvider.length;
+		else
+			rowCount = 0;
+		itemIndex = childID - 1;
+		if (dataGrid.columnHeaderBar)
+		{
+			// There are column headers, and their childIDs come first.
+			itemIndex -= columnCount;
+			headerCount = columnCount;
+		}
+		else
+		{
+			headerCount = 0;
+		}
+		var mode:String = dataGrid.selectionMode;
+		isCellMode = (
+			mode == GridSelectionMode.SINGLE_CELL
+			|| mode == GridSelectionMode.MULTIPLE_CELLS
+		);
+		maxChildID = 0;
+		// Account for headers.
+		maxChildID += headerCount;
+		// Then for cells or rows as appropriate.
+        if (isCellMode)
+			maxChildID += rowCount * columnCount;
+        else
+			maxChildID += rowCount;
+		isColumnHeader = false;
+		isInvalid = false;
+		if (childIDOutOfBounds(childID))
+		{
+			isInvalid = true;
+			columnIndex = -1;
+			rowIndex = -1;
+			itemIndex = -1;
+		}
+		else if (itemIndex < 0)
+		{
+			// This childID refers to a header, not a data row or cell.
+			isColumnHeader = true;
+			columnIndex = itemIndex + columnCount;
+			rowIndex = -1;
+			itemIndex = -1;
+		}
+		else if (isCellMode)
+		{
+			rowIndex = Math.floor(itemIndex / columnCount);
+			columnIndex = itemIndex % columnCount;
+		}
+		else
+		{
+			rowIndex = itemIndex;
+			// Using 0 here so, for example, getItemRendererAt() calls still work for a row.
+			columnIndex = 0;
+		}
+	}
+
+	public var master:UIComponent;
+	public var childID:uint;
+	public var dataGrid:DataGrid;
+	public var columnCount:int;
+	public var headerCount:int;
+	public var rowCount:int;
+	public var maxChildID:int;
+	public var itemIndex:int;
+	public var isCellMode:Boolean;
+	public var isInvalid:Boolean;
+	public var isColumnHeader:Boolean;
+	public var columnIndex:int;
+	public var rowIndex:int;
+
+	public function childIDFromRowAndColumn(rowIndex:int, columnIndex:int):uint
+	{
+		var childID:int = headerCount + 1;
+		if (isCellMode)
+			childID += rowIndex * columnCount + columnIndex;
+		else
+			childID += rowIndex;
+		return uint(childID);
+	}
+
+    private function childIDOutOfBounds(childID: int): Boolean
+    {
+		if (int(childID) <= 0)
+			return true;
+        if (!dataGrid.dataProvider || !dataGrid.columns)
+            return true
+		if (childID > maxChildID)
+			return true;
+		return false;
+    }
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/mobiletheme/src/spark/skins/mobile/ButtonBarMiddleButtonSkin.as
+++ frameworks/projects/mobiletheme/src/spark/skins/mobile/ButtonBarMiddleButtonSkin.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 12850
Author:   jimurphy@adobe.com
Date:     2009-12-11T14:57:14.623098Z

Log Message:
-----------
add 6 new DMV projects to the SDK:
automation
automation_air
automation_dmv
automation_flashflexkit
automation_spark
datavisualization

These projects are setup to build in an ant main call.  There are currently several warnings in the datavisualization project that will be cleaned up.  No checkintests exist for these projects as of yet.

I also modified the exisitng projects build files for easier management of the localization targets, bundle and fat-swc. If the projects that I updated:airframework,airspark,framework,playerglobal,rpc,and spark.  All the new projects have been implemented this same way.

QE notes: DMV folks should run through their tests
Doc notes: probably
Bugs: nope
Reviewer:
Tests run: ran the following targets: compile,checkintests,other.locales and doc
Is noteworthy for integration: no

Modified Paths:
--------------
1404 paths were modified

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

--- frameworks/projects/advancedgrids/src/mx/collections/IHierarchicalData.as
+++ frameworks/projects/advancedgrids/src/mx/collections/IHierarchicalData.as
@@ -0,0 +1,113 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 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.collections
+{
+import flash.events.IEventDispatcher;
+
+/**
+ *  The IHierarchicalData interface defines the interface
+ *  used to represent hierarchical data as the data provider for
+ *  a Flex component.
+ *  Hierarchical data is data in a structure of parent
+ *  and child data items.
+ *
+ *  @see mx.collections.ICollectionView
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public interface IHierarchicalData extends IEventDispatcher
+{
+	//--------------------------------------------------------------------------
+	//
+	//  Methods
+	//
+	//--------------------------------------------------------------------------
+
+    /**
+     *  Returns true if the node can contain children.
+     *
+     *
Nodes do not have to contain children for the method
+     *  to return true.
+     *  This method is useful in determining whether other
+     *  nodes can be appended as children to the specified node.

+     *
+     *  @param node The Object that defines the node.
+     *
+     *  @return true if the node can contain children.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    function canHaveChildren(node:Object):Boolean;
+
+    /**
+     *  Returns true if the node has children.
+     *
+     *  @param node The Object that defines the node.
+     *
+     *  @return true if the node has children.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    function hasChildren(node:Object):Boolean;
+
+    /**
+     *  Returns an Object representing the node's children.
+     *
+     *  @param node The Object that defines the node.
+     *  If null, return a collection of top-level nodes.
+     *
+     *  @return An Object containing the children nodes.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    function getChildren(node:Object):Object;
+
+    /**
+     *  Returns data from a node.
+     *
+     *  @param node The node Object from which to get the data.
+     *
+     *  @return The requested data.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    function getData(node:Object):Object;
+
+    /**
+     * Returns the root data item.
+     *
+     * @return The Object containing the root data item.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    function getRoot():Object;
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 16666
Author:   klin@adobe.com
Date:     2010-06-24T22:59:56.427021Z

Log Message:
-----------
The following changes apply to Spark DataGrid only.   Code reviews have been deferred until the implementation is closer to completion.

Fix GridRowList so that findNearest actually works. Modified insert to use the method correctly.

Modified Paths:
--------------
/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/GridRowList.as

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

--- frameworks/projects/spark/src/spark/components/gridClasses/GridRowList.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/GridRowList.as
@@ -204,11 +204,11 @@

         var newNode:GridRowNode = new GridRowNode(numColumns, index);

-        // index is before current node.
-        if (cur)
-            insertBefore(cur, newNode);
-        else // we've hit the end of the list.
-            insertAfter(_tail, newNode);
+        // index is before head.
+        if (!cur)
+            insertBefore(_head, newNode);
+        else // index is after cur.
+            insertAfter(cur, newNode);

         return newNode;
     }
@@ -342,7 +342,8 @@
     /**
      *  Searches through all nodes for the value closest and less than
      *  the specified index. If the index exists, it will just return
-     *  the node at that index.
+     *  the node at that index. Returns null if nearest is at the head
+     *  of the list.
      *
      *  @param index The value to find
      *
@@ -353,13 +354,63 @@
      */
     public function findNearest(index:int):GridRowNode
     {
-        var cur:GridRowNode = _head;
-
+        // use bookmarks? or maybe a least recently used one.
+        if (!_head || index < 0)
+            return null;
+
+        var indexToRecent:int;
+        var lastToIndex:int = _tail.rowIndex - index;
+        var result:GridRowNode = null;
+
+        // Uses last searched node if its closest to the target.
+        if (lastToIndex < 0)
+        {
+            result = _tail;
+        }
+        else if (lastToIndex < index)
+        {
+            result = findNearestBefore(index, _tail);
+        }
+        else
+        {
+            result = findNearestAfter(index, _head);
+        }
+
+        return result;
+    }
+
+    /**
+     *  @private
+     *  Searches for the node with the closest value less than the specified
+     *  index. Searches forwards from the specified node.
+     */
+    private function findNearestAfter(index:int, node:GridRowNode):GridRowNode
+    {
+        var cur:GridRowNode = node;
         while (cur && cur.rowIndex < index)
         {
+            if (cur.next == null)
+                break;
+            else if (cur.next.rowIndex > index)
+                break;
+
             cur = cur.next;
         }
-
+        return cur;
+    }
+
+    /**
+     *  @private
+     *  Searches for the node with the closest value less than the specified
+     *  index. Searches backwards from the specified node.
+     */
+    private function findNearestBefore(index:int, node:GridRowNode):GridRowNode
+    {
+        var cur:GridRowNode = node;
+        while (cur && cur.rowIndex > index)
+        {
+            cur = cur.prev;
+        }
         return cur;
     }


Fix viewer

Fix viewer

--- src/com/merlinds/miracle_tool/viewer/ViewerView.as
+++ src/com/merlinds/miracle_tool/viewer/ViewerView.as
@@ -5,13 +5,10 @@
  */
 package com.merlinds.miracle_tool.viewer {
 	import com.bit101.components.List;
-	import com.bit101.components.Window;
-	import com.merlinds.debug.log;
+	import com.bit101.components.PushButton;
 	import com.merlinds.miracle.Miracle;
 	import com.merlinds.miracle.animations.AnimationHelper;
-	import com.merlinds.miracle.display.MiracleAnimation;
 	import com.merlinds.miracle.display.MiracleDisplayObject;
-	import com.merlinds.miracle.geom.Color;
 	import com.merlinds.miracle.utils.Asset;
 	import com.merlinds.miracle.utils.MafReader;
 	import com.merlinds.miracle_tool.models.AppModel;
@@ -20,19 +17,22 @@
 	import flash.display.StageAlign;
 	import flash.display.StageScaleMode;
 	import flash.events.Event;
+	import flash.filesystem.File;
 	import flash.filesystem.FileMode;
 	import flash.filesystem.FileStream;
+	import flash.net.FileFilter;
 	import flash.utils.ByteArray;
-	import flash.utils.setTimeout;

 	[SWF(backgroundColor="0x333333", frameRate=60)]
 	public class ViewerView extends Sprite {

 		private var _model:AppModel;
-		private var _assets:Vector.<Asset>;
-		private var _window:Window;
-		private var _name:String;
-		private var _current:MiracleAnimation;
+		private var _startBtn:PushButton;
+		private var _texture:ByteArray;
+		private var _animation:ByteArray;
+		private var _fileName:String;
+		private var _list:List;
+		private var _instance:MiracleDisplayObject;

 		public function ViewerView(model:AppModel = null) {
 			super();
@@ -53,106 +53,113 @@
 			this.removeEventListener(event.type, this.initialize);
 			this.stage.scaleMode = StageScaleMode.NO_SCALE;
 			this.stage.align = StageAlign.TOP_LEFT;
-			Miracle.start(this.stage, this.createHandler, true);
+			_startBtn = new PushButton(this, this.stage.stageWidth >> 1, this.stage.stageHeight >> 1,
+					"Start", this.startBtnHandler );
 		}

-		private function choseAnimation():void {
-			//find animation asset and add all of animations to chose list
-			var n:int = _assets.length;
-			for(var i:int = 0; i < n; i++){
-				var asset:Asset = _assets[i];
-				if(asset.type == Asset.TIMELINE_TYPE){
-					//parse output
-					_window = new Window(this, 0, 0, "Chose animation");
-					var list:List = new List(_window, 0, 0, this.getAnimations(asset.output));
-					_window.x = this.stage.stageWidth - _window.width;
-					_window.setSize(_window.height, list.height + 20);
-					list.addEventListener(Event.SELECT, this.selectAnimationHandler);
-				}
-			}
-			var w2:Window = new Window(this, _window.x, _window.y + _window.height + 10, "FPS");
-			list = new List(w2, 0, 0, [1, 5, 16, 24, 30, 35, 40, 60]);
-			w2.height = 120;
-			list.addEventListener(Event.SELECT, this.selectFpsHandler);
+		function clear():void
+		{
+			if(_animation != null) _animation.clear();
+			if(_texture != null) _texture.clear();
+			_texture = null;
+			_animation = null;
+			_fileName = null;
 		}

-		[Inline]
-		private function getAnimations(bytes:ByteArray):Array {
-			var result:Array = [];
-			var reader:MafReader = new MafReader();
-			reader.execute(bytes, 1);
-			var animations:Vector.<AnimationHelper> = reader.animations;
-			for each(var animation:AnimationHelper in animations){
-				result.push(animation.name);
-			}
-			return result;
-		}
-		//} endregion PRIVATE\PROTECTED METHODS ========================================
-
-		//==============================================================================
-		//{region							EVENTS HANDLERS
-		private function createHandler(animation:Boolean = false):void {
-			//\TODO: Show view if it exit
-			if(animation || _model.viewerInput == null){
-				_model.viewerInput = _model.lastFileDirection;
-				_model.viewerInput.addEventListener(Event.SELECT, this.selectFileHandler);
-				_model.viewerInput.browseForOpen("Open " + animation ? "Animation" : "Sprite"
-						+ "file that you want to view");
-			}
+		private function startHandler():void {
+			trace("Miracle was started");
+			var maf:Asset = new Asset(_fileName + ".maf", _animation);
+			var mtf:Asset = new Asset(_fileName + ".mtf", _texture);
+			Miracle.createScene(new <Asset>[maf, mtf], this.createdHandler, 1);
 		}

-		private function selectFileHandler(event:Event):void {
-			_model.viewerInput.removeEventListener(event.type, this.selectFileHandler);
-			_model.lastFileDirection = _model.viewerInput.parent;
-			var byteArray:ByteArray = new ByteArray();
-			var stream:FileStream = new FileStream();
-			stream.open(_model.viewerInput, FileMode.READ);
-			stream.readBytes(byteArray);
-			stream.close();
-			//parse
-			if(_assets == null)_assets = new <Asset>[];
-			var asset:Asset = new Asset(_model.viewerInput.name, byteArray);
-			if(asset.type == Asset.TIMELINE_TYPE){
-				_name = asset.name;
+		private function createdHandler():void {
+			trace("Scene created");
+			this.getAnimationList();
+		}
+
+		private function getAnimationList():void {
+			var mafReader = new MafReader();
+			mafReader.execute(_animation, 1);
+			var animationsName:Array = [];
+			for each(var animation:AnimationHelper in mafReader.animations)
+			{
+				animationsName.push(animation.name);
 			}
-			_assets.push(asset);
-			if(_assets.length > 1){
-				this.choseAnimation();
-				Miracle.createScene(_assets,null, 1);
-				Miracle.resume();
-			}else{
-				this.createHandler(true);
+			trace("Was get animations", animationsName);
+			_list = new List(this, this.stage.stageWidth - 200, 0, animationsName);
+			_list.width = 200;
+			_list.addEventListener(Event.SELECT, this.selectAnimationHandler);
+		}
+
+		private function getAnimation():void {
+			var file:File = _model.lastFileDirection;
+			file.browseForOpen("Get animation file", [new FileFilter("Miracle animation format", "*.maf")] );
+			file.addEventListener(Event.SELECT, this.animationSelected);
+			file.addEventListener(Event.CANCEL, this.animationSelected);
+		}
+
+		private function readAnimation(file:File):void {
+			_animation = new ByteArray();
+			var fileStream:FileStream = new FileStream();
+			fileStream.open(file, FileMode.READ);
+			fileStream.readBytes(_animation);
+			fileStream.close();
+		}
+
+		private function getTexture(file:File):void {
+			_fileName = file.name.substr(0, -file.extension.length - 1);
+			file.browseForOpen("Get texture file", [new FileFilter("Miracle texture format", _fileName + ".mtf")] );
+			file.addEventListener(Event.SELECT, this.animationSelected);
+			file.addEventListener(Event.CANCEL, this.animationSelected);
+		}
+
+		private function readTexture(file:File):void {
+			_texture = new ByteArray();
+			var fileStream:FileStream = new FileStream();
+			fileStream.open(file, FileMode.READ);
+			fileStream.readBytes(_texture);
+			fileStream.close();
+		}
+
+		public function startBtnHandler(event:Event):void{
+			_startBtn.visible = false;
+			getAnimation();
+		}
+
+		private function animationSelected(event:Event):void {
+			if(event.type == Event.CANCEL)
+			{
+				this.clear();
+				_startBtn.visible = true;
+			}else
+			{
+				if(_animation == null)
+				{
+					this.readAnimation(event.target as File);
+					this.getTexture(event.target as File);
+				}else
+				{
+					this.readTexture(event.target as File);
+					trace("All loaded");
+					Miracle.start(this.stage, this.startHandler, true);
+				}
 			}
 		}

 		private function selectAnimationHandler(event:Event):void {
-			var list:List = event.target as List;
-			//add animation to miracle
-			var animation:String = list.selectedItem.toString();
-			log(this, "selectAnimationHandler", animation);
-			var mesh:String = animation.substr(0, animation.lastIndexOf("."));
-			animation = animation.substr(animation.lastIndexOf(".") + 1);
-			if(_current == null){
-				_current = Miracle.scene.createAnimation(mesh, animation, 60);
-				_current.moveTO(this.stage.stageWidth >> 1, this.stage.stageHeight >> 1);
-				_current.addEventListener(Event.ADDED_TO_STAGE, this.imageAddedToStage);
-			}else{
-				_current.mesh = mesh;
-				_current.animation = animation;
-				_current.play();
+			if(_instance != null)
+			{
+				Miracle.scene.removeInstance(_instance);
 			}
-		}
-
-		private function imageAddedToStage(event:Event):void {
-			trace("Added to stage");
-		}
-
-		private function selectFpsHandler(event:Event):void {
-			var list:List = event.target as List;
-			//add animation to miracle
-			if(_current != null){
-				_current.fps = int(list.selectedItem);
-			}
+			var selected:String = _list.selectedItem as String;
+			var dot:int = selected.lastIndexOf(".");
+			var animation:String = selected.substr(dot+1);
+			var mesh:String = selected.substr(0, dot);
+			_instance = Miracle.scene.createAnimation(mesh, animation, 30);
+			_instance.x = this.stage.stageWidth >> 1;
+			_instance.y = this.stage.stageHeight >> 1;
+			_instance.visible = true;
 		}
 		//} endregion EVENTS HANDLERS ==================================================


rename currentScene to scene

rename currentScene to scene

--- src/com/merlinds/miracle_tool/viewer/ViewerView.as
+++ src/com/merlinds/miracle_tool/viewer/ViewerView.as
@@ -133,7 +133,7 @@
 			var mesh:String = animation.substr(0, animation.lastIndexOf("."));
 			animation = animation.substr(animation.lastIndexOf(".") + 1);
 			if(_current == null){
-				_current = Miracle.currentScene.createAnimation(mesh, animation, 60);
+				_current = Miracle.scene.createAnimation(mesh, animation, 60);
 				_current.moveTO(this.stage.stageWidth >> 1, this.stage.stageHeight >> 1);
 				_current.addEventListener(Event.ADDED_TO_STAGE, this.imageAddedToStage);
 			}else{


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@1253397 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/charts/src/mx/charts/styles/metadata/FillStrokeStyles.as
+++ frameworks/projects/charts/src/mx/charts/styles/metadata/FillStrokeStyles.as
@@ -1,24 +1,5 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2009 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.
-//
-////////////////////////////////////////////////////////////////////////////////

-/**
- *  Sets the fill for this data series. You can specify either an object implementing the IFill interface,
- *  or a number representing a solid color value. You can also specify a solid fill using CSS.
- *
- *  @langversion 3.0
- *  @playerversion Flash 9
- *  @playerversion AIR 1.1
- *  @productversion Flex 3
- */
 [Style(name="fill", type="mx.graphics.IFill", inherit="no")]

 /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/spark/src/spark/components/gridClasses/GridDimensions.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/GridDimensions.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 5924
Author:   chaase@adobe.com
Date:     2009-04-03T23:23:45.166425Z

Log Message:
-----------
This fixes the use of constraints in effects. Basically, it removes the 'adjustConstraints' property that was added in Flex4 and adds a new 'disableConstraints' flag which disables constraints during the effect (default false).

QE Notes: Issues in spark/effects/AnimateTransform* directories, rename-related, Matt chasing down
Doc Notes: none
Bugs:
Reviewer: Glenn
tests: checkintests, mustella spark/effects

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/AnimateInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/RotateInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/Animate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/ResizeInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/Animate3DInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/Rotate3DInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/supportClasses/MoveInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/effects/AnimateTransform.as</path>

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

--- frameworks/projects/spark/src/spark/effects/supportClasses/ResizeInstance.as
+++ frameworks/projects/spark/src/spark/effects/supportClasses/ResizeInstance.as
@@ -13,10 +13,8 @@
 import flash.events.Event;

 import mx.core.IUIComponent;
-import mx.managers.LayoutManager;

 import spark.effects.AnimationProperty;
-import spark.effects.animation.Animation;
 import spark.events.AnimationEvent;

 public class ResizeInstance extends AnimateInstance
@@ -276,6 +274,26 @@
             [new AnimationProperty("width", widthFrom, widthTo, duration, widthBy),
              new AnimationProperty("height", heightFrom, heightTo, duration, heightBy)];

+        // Also animate any size-related constraints that change between
+        // transition states
+        if (propertyChanges && !disableConstraints)
+        {
+            var wStart:* = propertyChanges.start["width"];
+            var wEnd:* = propertyChanges.end["width"];
+            var hStart:* = propertyChanges.start["height"];
+            var hEnd:* = propertyChanges.end["height"];
+            if (wStart !== undefined && wEnd != undefined && (wStart != wEnd))
+            {
+                setupConstraintAnimation("left");
+                setupConstraintAnimation("right");
+            }
+            if (hStart !== undefined && hEnd != undefined && (hStart != hEnd))
+            {
+                setupConstraintAnimation("top");
+                setupConstraintAnimation("bottom");
+            }
+        }
+
         super.play();

         if (childrenHiding)


(hola patch) split get_levels into get_levels and get_segment_info

--- src/org/mangui/hls/HLSJS.as
+++ src/org/mangui/hls/HLSJS.as
@@ -6,6 +6,7 @@
     import org.hola.HSettings;
     import org.mangui.hls.event.HLSEvent;
     import org.mangui.hls.constant.HLSPlayStates;
+    import org.mangui.hls.model.Level;

     public class HLSJS
     {
@@ -34,6 +35,8 @@
                 hola_hls_get_state);
             ExternalInterface.addCallback("hola_hls_get_levels",
                 hola_hls_get_levels);
+            ExternalInterface.addCallback("hola_hls_get_segment_info",
+                hola_hls_get_segment_info);
             ExternalInterface.addCallback("hola_hls_get_level",
                 hola_hls_get_level);
             ExternalInterface.addCallback("hola_setBandwidth",
@@ -162,7 +165,33 @@
         }

         private static function hola_hls_get_levels():Object{
-            return _hls.levels;
+            var levels:Vector.<Object> =
+                new Vector.<Object>(_hls.levels.length);
+            for (var i:int = 0; i<_hls.levels.length; i++)
+            {
+                var l:Level = _hls.levels[i];
+                // no fragments returned, use get_segment_info for fragm. info
+                levels[i] = Object({url: l.url, bitrate: l.bitrate,
+                    index: l.index, fragments: []});
+            }
+            return levels;
+        }
+
+        private static function hola_hls_get_segment_info(url:String):Object{
+            for (var i:int = 0; i<_hls.levels.length; i++)
+            {
+                var l:Level = _hls.levels[i];
+                for (var j:int = 0; j<l.fragments.length; j++)
+                {
+                    if (url==l.fragments[j].url)
+                    {
+                        return Object({fragment: l.fragments[j],
+                            level: Object({url: l.url, bitrate: l.bitrate,
+                            index: l.index})});
+                    }
+                }
+            }
+            return undefined;
         }

         private static function hola_hls_get_level():Number{


Updated AsUnitRunner to extend MovieClip instead of Sprite

--- asunit-4.0/test/AsUnitRunner.as
+++ asunit-4.0/test/AsUnitRunner.as
@@ -1,18 +1,14 @@
 package {

     import asunit.core.TextCore;
-    import flash.display.Sprite;
+    import flash.display.MovieClip;

-	public class AsUnitRunner extends Sprite {
+	public class AsUnitRunner extends MovieClip {

         private var core:TextCore;

         public function AsUnitRunner() {
             core = new TextCore();
-
-            // Uncomment to turn off the perf report:
-            //core.displayPerformanceDetails = false;
-
             core.start(AllTests, null, this);
         }
     }


- changed SWFPlayer

 - changed SWFPlayer

git-svn-id: e38e7cdd6ace00d8230583a2d3b43e9a55f5c011@122 bc4816be-ef27-423a-9c4d-fc420be121a2

--- src/reprise/media/SWFPlayer.as
+++ src/reprise/media/SWFPlayer.as
@@ -93,7 +93,7 @@

 		protected override function doPlay():void
 		{
-			MovieClip(m_loader.content).gotoAndPlay(m_recentPosition);
+			MovieClip(m_loader.content).gotoAndPlay(timeToFrame(position()));
 		}

 		protected override function doSeek(offset:Number):void


small variable name fix in Facade

small variable name fix in Facade

--- src/ru/whitered/kote/Facade.as
+++ src/ru/whitered/kote/Facade.as
@@ -266,13 +266,13 @@
 		 */
 		private function processNotification(notificationObject:NotificationObject):void
 		{
-			const notificationType:Notification = notificationObject.notification;
+			const notification:Notification = notificationObject.notification;

 			// execute commands and abort if one of them returned 'false':
-			const controller:Controller = controllers[notificationType];
+			const controller:Controller = controllers[notification];
 			if(controller && !controller.execute(notificationObject, handleNotification)) return;

-			const subscribedMediators:Vector.<Mediator> = mediatorsMap[notificationType];
+			const subscribedMediators:Vector.<Mediator> = mediatorsMap[notification];
 			if(!subscribedMediators) return;

 			for (var i:int = 0;i < subscribedMediators.length;i++)


Transferred from the Adobe Open Source Subversion Repository

Revision: 20018
Author:   mhorn@adobe.com
Date:     2011-01-31T20:21:08.439131Z

Log Message:
-----------
asdoc updates for bug fix http://watsonexp.corp.adobe.com/#bug=2795537

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/filters/BaseFilter.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/IMarshalSystemManager.as</path>

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

--- frameworks/projects/framework/src/mx/filters/BaseFilter.as
+++ frameworks/projects/framework/src/mx/filters/BaseFilter.as
@@ -16,7 +16,8 @@
     import flash.events.Event;

    /**
-    *
+    *  Base class for some Spark filters.
+    *
     *  @langversion 3.0
     *  @playerversion Flash 10
     *  @playerversion AIR 1.5
@@ -25,7 +26,8 @@
     public class BaseFilter extends EventDispatcher
     {
        /**
-        *
+        *  The string <code>"change"</code>. Used by the event when the filter has changed.
+        *
         *  @langversion 3.0
         *  @playerversion Flash 10
         *  @playerversion AIR 1.5
@@ -34,7 +36,10 @@
         public static const CHANGE:String = "change";

        /**
-        *
+        *  Constructor.
+        *
+        *  @param target The target to which the filter is applied.
+        *
         *  @langversion 3.0
         *  @playerversion Flash 10
         *  @playerversion AIR 1.5
@@ -46,7 +51,8 @@
         }

        /**
-        *
+        *  Propagates a change event when the filter has changed.
+        *
         *  @langversion 3.0
         *  @playerversion Flash 10
         *  @playerversion AIR 1.5


Transferred from the Adobe Open Source Subversion Repository

Revision: 4692
Author:   gosmith@adobe.com
Date:     2009-01-27T22:13:03.562851Z

Log Message:
-----------
Fixed missing or misplaced 'break' statements in the eventHandler() methods of the mx.accessibility classes. These have probably been causing some unintented MSAA events to be dispatched.

Also, each accessible component now dispatches OBJ_NAMECHANGE when its toolTip or errorString property changes, because the MSAA name includes the tooltip or error tip.

QE Notes: None
Doc Notes: None
Bugs: None
Reviewer: Deepa

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ButtonAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ColorPickerAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/AccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/DataGridAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/DateFieldAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/SliderAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/MenuBarAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ComboBaseAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/TabBarAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/TreeAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/DateChooserAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/UIComponentAccProps.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/MenuAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/ListBaseAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/AlertAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/TitleWindowAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/accessibility/AccordionHeaderAccImpl.as</path>

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

--- frameworks/projects/mx/src/mx/accessibility/TreeAccImpl.as
+++ frameworks/projects/mx/src/mx/accessibility/TreeAccImpl.as
@@ -491,6 +491,10 @@
 	 */
 	override protected function eventHandler(event:Event):void
 	{
+		// Let AccImpl class handle the events
+		// that all accessible UIComponents understand.
+		$eventHandler(event);
+
 		var index:int = Tree(master).selectedIndex;

 		var childID:uint = index + 1;


Transferred from the Adobe Open Source Subversion Repository

Revision: 18756
Author:   jszeto@adobe.com
Date:     2010-11-20T00:02:28.469827Z

Log Message:
-----------
ComboBox Bug Fixes

http://bugs.adobe.com/jira/browse/SDK-26363 - Spark ComboBox doesn't respect baseline constraint.

Updated the ComboBoxTextInputSkin. RichEditableText always returns the baseline position of the first line and ignores verticalAlign. The textDisplay no longer vertically stretches across the skin. This enables a more accurate baselinePosition.

http://bugs.adobe.com/jira/browse/SDK-26314 - Cant get value of Spark Combobox with empty dataprovider

In ComboBox, when entering custom text, we make sure to set the selectedIndex to custom item mode. In ListBase, if there is no dataProvider, we allow the selectedIndex to be set to custom item mode.

QE notes: none
Doc notes: none
Bugs: SDK-26363, SDK-26314
Reviewer: Kevin L
Tests run: checkintests, cyclone
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/ComboBox.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/ComboBoxTextInputSkin.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as</path>

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

--- frameworks/projects/spark/src/spark/components/ComboBox.as
+++ frameworks/projects/spark/src/spark/components/ComboBox.as
@@ -542,13 +542,14 @@
     private function processInputField():void
     {
         var matchingItems:Vector.<int>;
-
+
+        // If the textInput has been changed, then use the input string as the selectedItem
+        actualProposedSelectedIndex = CUSTOM_SELECTED_ITEM;
+
+        // Even if there is no data provider, we still want to allow custom items.
         if (!dataProvider || dataProvider.length <= 0)
             return;

-        // If the textInput has been changed, then use the input string as the selectedItem
-        actualProposedSelectedIndex = CUSTOM_SELECTED_ITEM;
-
         if (textInput.text != "")
         {
             if (itemMatchingFunction != null)


Transferred from the Adobe Open Source Subversion Repository

Revision: 6843
Author:   jimurphy@adobe.com
Date:     2009-05-12T13:58:34.182467Z

Log Message:
-----------
Merged beta1 revisions 6793,6796-6797,6802,6805,6808-6809,6831 -> trunk

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/projects/flex4/src/spark/skins/default/ButtonBarFirstButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/RichEditableText.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/utils/MouseShieldUtil.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/supportClasses/TextGraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/SkinnableContainerBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/RichText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/TextAreaSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/SimpleText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/default/ButtonBarLastButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/TileLayout.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/TextBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/layouts/VerticalLayout.as</path>

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

--- frameworks/projects/spark/src/spark/components/RichText.as
+++ frameworks/projects/spark/src/spark/components/RichText.as
@@ -19,7 +19,6 @@
 import flash.geom.Rectangle;
 import flash.text.TextFormat;
 import flash.text.engine.FontLookup;
-import flash.text.engine.TextLine;

 import flashx.textLayout.compose.ITextLineCreator;
 import flashx.textLayout.conversion.ITextImporter;
@@ -36,10 +35,7 @@
 import flashx.textLayout.factory.TruncationOptions;
 import flashx.textLayout.formats.FormatValue;
 import flashx.textLayout.formats.ITextLayoutFormat;
-import flashx.textLayout.formats.TextAlign;
 import flashx.textLayout.formats.TextLayoutFormat;
-import flashx.textLayout.formats.VerticalAlign;
-import flashx.textLayout.tlf_internal;

 import mx.core.EmbeddedFont;
 import mx.core.EmbeddedFontRegistry;
@@ -54,6 +50,8 @@
 import spark.core.CSSTextLayoutFormat;
 import spark.primitives.supportClasses.TextGraphicElement;
 import spark.utils.TextUtil;
+
+use namespace mx_internal;

 //--------------------------------------
 //  Styles
@@ -331,11 +329,11 @@
         // you set the 'content' and then get the 'text'.
         if (textInvalid)
         {
-            mx_internal::_text = TextUtil.extractText(textFlow);
+            _text = TextUtil.extractText(textFlow);
             textInvalid = false;
         }

-        return mx_internal::_text;
+        return _text;
     }

     /**
@@ -446,7 +444,7 @@
     {
         // If there isn't any content and there is text, create a one paragraph
         // text flow from the text.
-        if (!_content && mx_internal::_text)
+        if (!_content && _text)
             _content = convertTextToContent();

         return _content;
@@ -466,7 +464,7 @@
             // Setting 'content' temporarily causes 'text' to become null.
             // Later, after the 'content' has been committed into the TextFlow,
             // getting 'text' will extract the text from the TextFlow.
-            mx_internal::_text = null;
+            _text = null;
             textChanged = false;

             _content = value;
@@ -492,7 +490,7 @@
     	super.updateDisplayList(unscaledWidth, unscaledHeight);

     	// Draw an optional background for debugging.
-    	var bc:Object = mx_internal::backgroundColor;
+    	var bc:Object = backgroundColor;
     	if (bc != null)
     	{
 	    	var g:Graphics = Sprite(drawnDisplayObject).graphics;
@@ -538,7 +536,7 @@
     /**
      *  @private
      */
-    override protected function invalidateTextLines(cause:String):void
+    override mx_internal function invalidateTextLines(cause:String):void
     {
         super.invalidateTextLines(cause);

@@ -630,7 +628,7 @@
         textFlow.replaceChildren(0, 0, p);

         var span:SpanElement = new SpanElement();
-        span.text = mx_internal::_text;
+        span.text = _text;
         p.replaceChildren(0, 0, span);

         // Set formats and textLineCreator.
@@ -767,22 +765,21 @@
         contentChanged = false;
         textChanged = false;

-        var oldEmbeddedFontContext:IFlexModuleFactory =
-        	mx_internal::embeddedFontContext;
+        var oldEmbeddedFontContext:IFlexModuleFactory = embeddedFontContext;

         // If the CSS styles for this component specify an embedded font,
         // embeddedFontContext will be set to the module factory that
         // should create TextLines (since they must be created in the
         // SWF where the embedded font is.)
         // Otherwise, this will be null.
-        mx_internal::embeddedFontContext = getEmbeddedFontContext();
-
-        if (mx_internal::embeddedFontContext != oldEmbeddedFontContext)
+        embeddedFontContext = getEmbeddedFontContext();
+
+        if (embeddedFontContext != oldEmbeddedFontContext)
         {
             staticTextFlowFactory.textLineCreator =
-                ITextLineCreator(mx_internal::embeddedFontContext)
+                ITextLineCreator(embeddedFontContext)
             staticStringFactory.textLineCreator =
-                ITextLineCreator(mx_internal::embeddedFontContext)
+                ITextLineCreator(embeddedFontContext)
         }

         if (hostFormatChanged)
@@ -837,8 +834,8 @@
      *  @private
      *  Returns true to indicate all lines were composed.
      */
-    override protected function composeTextLines(width:Number = NaN,
-												 height:Number = NaN):Boolean
+    override mx_internal function composeTextLines(width:Number = NaN,
+												   height:Number = NaN):Boolean
     {
         super.composeTextLines(width, height);

@@ -859,14 +856,13 @@
 		// The bounds are then used by the addTextLines() method
 		// to determine the isOverset flag.
 		// The composition bounds are also reported by the measure() method.
-		var bounds:Rectangle = mx_internal::bounds;
         bounds.x = 0;
         bounds.y = 0;
         bounds.width = isNaN(width) ? maxWidth : width;
         bounds.height = height;

-        mx_internal::removeTextLines();
-        mx_internal::releaseTextLines();
+        removeTextLines();
+        releaseTextLines();

         createTextLines();

@@ -874,18 +870,18 @@
         // This will save a recompose and/or clip in updateDisplayList() if
         // the bounds width matches the unscaled width.
         if (getStyle("lineBreak") == "toFit" && !isNaN(width) &&
-            mx_internal::bounds.width < width)
-        {
-            mx_internal::bounds.width = width;
+            bounds.width < width)
+        {
+            bounds.width = width;
         }

-        mx_internal::addTextLines(DisplayObjectContainer(drawnDisplayObject));
+        addTextLines(DisplayObjectContainer(drawnDisplayObject));

         // Figure out if the text overruns the available space for composition.
-        mx_internal::isOverset = mx_internal::isTextOverset(width, height);
+        isOverset = isTextOverset(width, height);

 		// Just recomposed so reset.
-        mx_internal::invalidateCompose = false;
+        invalidateCompose = false;

         // Listen for "damage" events in case the textFlow is
         // modified programatically.
@@ -907,7 +903,7 @@
 	private function createTextLines():void
 	{
 		// Clear any previously generated TextLines from the textLines Array.
-		mx_internal::textLines.length = 0;
+		textLines.length = 0;

 		var factory:TextLineFactoryBase;
 		if (textFlow)
@@ -922,7 +918,7 @@
 		// Its width is 0 but its height is equal to the font's
 		// ascent plus descent.

-        factory.compositionBounds = mx_internal::bounds;
+        factory.compositionBounds = bounds;

         // Set up the truncation options.
         var truncationOptions:TruncationOptions;
@@ -931,7 +927,7 @@
             truncationOptions = new TruncationOptions();
             truncationOptions.lineCountLimit = truncation;
             truncationOptions.truncationIndicator =
-                TextGraphicElement.mx_internal::truncationIndicatorResource;
+                TextGraphicElement.truncationIndicatorResource;
         }
 		factory.truncationOptions = truncationOptions;

@@ -942,12 +938,12 @@
         else
         {
             // We know text is non-null since it got this far.
-            staticStringFactory.text = mx_internal::_text;
+            staticStringFactory.text = _text;
             staticStringFactory.textFlowFormat = hostFormat;
             staticStringFactory.createTextLines(addTextLine);
         }

-        mx_internal::bounds = factory.contentBounds;
+        bounds = factory.contentBounds;
     }

     /**
@@ -956,7 +952,7 @@
      */
     private function addTextLine(textLine:DisplayObject):void
     {
-        mx_internal::textLines.push(textLine);
+        textLines.push(textLine);
     }

     //--------------------------------------------------------------------------
@@ -980,7 +976,7 @@
         textInvalid = true;

         // Force recompose since text and/or styles may have changed.
-        mx_internal::invalidateCompose = true;
+        invalidateCompose = true;

         // This is smart enough not to remeasure if the explicit width/height
         // were specified.


Transferred from the Adobe Open Source Subversion Repository

Revision: 9467
Author:   gosmith@adobe.com
Date:     2009-08-21T21:46:43.117874Z

Log Message:
-----------
Completed the ASDoc for the nine documented Spark text classes. No more "Documentation is not currently available." Instead, there may now be too much of it. :)

QE notes: Please review the new doc and give me feedback
Doc notes: Please review and edit
Bugs: None
Reviewer: None
Tests run: ant checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/TextGraphicElement.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/supportClasses/SkinnableTextBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/RichText.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/primitives/SimpleText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/events/TextOperationEvent.as</path>

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

--- frameworks/projects/spark/src/spark/components/TextArea.as
+++ frameworks/projects/spark/src/spark/components/TextArea.as
@@ -94,15 +94,137 @@
 [IconFile("TextArea.png")]

 /**
- *  The TextArea component is a text field that lets users enter
- *  and edit multiple lines of rich text. TextArea supports horizontal
- *  and vertical scrolling.
- *
- *
The text content in TextArea can contain multiple paragraphs,
- *  spans, inline graphics, multiple columns, and so on. Formatting
- *  is preserved as the user edits. TextArea does not include any UI
- *  for changing the formatting of text; text can be changed programmatically
- *  only.

+ *  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.

+ *
+ *
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)
+ *  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 Spark version offers better typography, better support
+ *        for international languages, and better text layout.

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

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

+ *
The Spark version 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.

+ *

+ *
+ *
The Spark TextArea uses TLF's 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.
+ *  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
+ *  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
+ *  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
+ *

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

+ *  In this case, the MXML compiler sets the 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.
+ *  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.
+ *  If you set the lineBreak style to "explicit",
+ *  new lines will start only at explicit lines 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,

+ *
+ *
The widthInChars and heightInChars
+ *  properties provide a convenient way to specify the width and height
+ *  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
+ *  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
+ *  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,
+ *  set the editable property to false.
+ *  If you don't even want it to be selectable,
+ *  set the selectable property to false.

+ *
+ *
This control is a skinnable control whose skin uses a
+ *  RichEditableText to display and edit the text,
+ *  and a Scroller to provide scrollbars.
+ *  The RichEditableText can be accessed as textDisplay
+ *  and the Scroller as scroller.

+ *
+ *
Because its RichEditableText uses TLF, the Spark TextArea
+ *  supports displaying 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",
+ *  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".

+ *
+ *
Also as a result of using TLF, the Spark TextArea supports
+ *  unlimited undo/redo within one editing session.
+ *  An editing session starts when the control gets keyboard focus
+ *  and ends when the control loses focus.

  *
  *
The TextArea control has the following default characteristics:

  *

@@ -147,11 +269,11 @@
  *  />
  *

  *
+ *  @see spark.components.TextInput
  *  @see spark.skins.spark.TextAreaSkin
  *  @see spark.primitives.RichText
  *  @see spark.primitives.RichEditableText
  *  @see spark.primitives.SimpleText
- *  @see TextInput TextInput class
  *
  *  @includeExample examples/TextAreaExample.mxml
  *
@@ -282,12 +404,7 @@
     // TLF work.

     /**
-     *  The TextFlow displayed by this component.
-     *
-     *
A TextFlow is the most important class
-     *  in the Text Layout Framework.
-     *  It is the root of a tree of FlowElements
-     *  representing rich text content.

+     *  @copy spark.primitives.RichEditableText#textFlow
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -314,7 +431,7 @@
     //----------------------------------

     /**
-     *  Documentation is not currently available.
+     *  @copy spark.primitives.RichEditableText#heightInLines
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -341,7 +458,8 @@
     [SkinPart(required="false")]

     /**
-     *  The optional Scroller used to scroll the RichEditableText.
+     *  The optional Scroller in the skin,
+	 *  used to scroll the RichEditableText.
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -355,7 +473,7 @@
     //----------------------------------

     /**
-     *  Documentation is not currently available.
+     *  @copy spark.primitives.RichEditableText#widthInChars
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -464,7 +582,7 @@
     //--------------------------------------------------------------------------

     /**
-     *  Documentation is not currently available.
+     *  @copy spark.primitives.RichEditableText#getFormatOfRange()
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -483,7 +601,7 @@
     }

     /**
-     *  Documentation is not currently available.
+     *  @copy spark.primitives.RichEditableText#setFormatOfRange()
      *
      *  @langversion 3.0
      *  @playerversion Flash 10
@@ -501,7 +619,7 @@
     }

     /**
-     *  @copy flashx.textLayout.container.ContainerController#scrollToPosition()
+     *  @copy spark.primitives.RichEditableText#scrollToRange()
      *
      *  @langversion 3.0
      *  @playerversion Flash 10


Transferred from the Adobe Open Source Subversion Repository

Revision: 17435
Author:   rfrishbe@adobe.com
Date:     2010-08-20T21:38:52.068340Z

Log Message:
-----------
A few MobileItemRenderer/MobileIconItemRenderer changes at NJ's request. Added verticalAlign style. Changed defaults for paddings. Exposed content cache for MobileIconItemRenderer.  Fixed bug with MobileIconItemRenderer around default height (should be 80, not 120).

QE notes: None
Doc notes: None
Bugs: SDK-27504, SDK-27401
Reviewer: Glenn
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/defaults.css</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobilecomponents/src/spark/components/MobileIconItemRenderer.as</path>

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

--- frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as
+++ frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as
@@ -41,6 +41,7 @@
 import spark.components.supportClasses.MobileTextField;
 import spark.components.supportClasses.TextBase;
 import spark.core.ContentCache;
+import spark.core.IContentLoader;
 import spark.primitives.BitmapImage;

 use namespace mx_internal;
@@ -102,7 +103,7 @@

     /**
      *  @private
-     *  Icon image cache
+     *  Static icon image cache.  This is the default for iconContentLoader.
      */
     static private var _imageCache:ContentCache;

@@ -123,6 +124,11 @@
     public function MobileIconItemRenderer()
     {
         super();
+
+        if (_imageCache == null) {
+            _imageCache = new ContentCache();
+            _imageCache.maxCacheEntries = 100;
+        }
     }

     //--------------------------------------------------------------------------
@@ -181,7 +187,7 @@

     //--------------------------------------------------------------------------
     //
-    //  Public Properties
+    //  Public Properties: Overridden
     //
     //--------------------------------------------------------------------------

@@ -212,6 +218,53 @@
         invalidateProperties();
     }

+    //--------------------------------------------------------------------------
+    //
+    //  Public Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  iconContentLoader
+    //----------------------------------
+
+    /**
+     *  @private
+     */
+    private var _iconContentLoader:IContentLoader = _imageCache;
+
+
+    /**
+     *  Optional custom image loader (e.g. image cache or queue) to
+     *  associate with content loader client.
+     *
+     *
The default is a static content cache defined on MobileIconItemRenderer
+     *  that allows up to 100 entries.

+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 2.5
+     *  @productversion Flex 4.5
+     */
+    public function get iconContentLoader():IContentLoader
+    {
+        return _iconContentLoader;
+    }
+
+    /**
+     *  @private
+     */
+    public function set iconContentLoader(value:IContentLoader):void
+    {
+        if (value == _iconContentLoader)
+            return;
+
+        _iconContentLoader = value;
+
+        if (iconDisplay)
+            iconDisplay.contentLoader = _iconContentLoader;
+    }
+
     //----------------------------------
     //  decoratorClass
     //----------------------------------
@@ -233,7 +286,10 @@

     /**
      *  Decorator that appears on the right side
-     *  of this item renderer
+     *  of this item renderer.
+     *
+     *
The decorator ignores the verticalAlign style
+     *  and is always centered vertically.

      *
      *  @default ""
      *
@@ -772,11 +828,7 @@
                 iconDisplay.top = 0;
                 iconDisplay.bottom = 0;

-                if (_imageCache == null) {
-                    _imageCache = new ContentCache();
-                    _imageCache.maxCacheEntries = 100;
-                }
-                iconDisplay.contentLoader = _imageCache;
+                iconDisplay.contentLoader = iconContentLoader;

                 // add iconDisplayHolder to the display list first in case
                 // bitmap needs to check its layoutDirection.
@@ -1053,10 +1105,10 @@
         // now set the local variables to the member variables.  Make sure it means our
         // minimum height of 80
         measuredWidth = myMeasuredWidth
-        measuredHeight = Math.max(120, myMeasuredHeight);
+        measuredHeight = Math.max(80, myMeasuredHeight);

         measuredMinWidth = myMeasuredMinWidth;
-        measuredMinHeight = Math.max(120, myMeasuredMinHeight);
+        measuredMinHeight = Math.max(80, myMeasuredMinHeight);
     }

     /**
@@ -1199,6 +1251,14 @@
             messageDisplay.width = messageWidth;
             messageDisplay.height = messageHeight;

+            // FIXME (rfrishbe): figure out if this is right with regards to multi-line text.
+            // For instance, if the text component spans to 2 lines but only shows one line, then textHeight here
+            // is the size of the two line text.  We take the minimum with messageHeight to make sure
+            // we don't position it outside of the item renderer's bounds later on, but this
+            // calculation still isn't correct.  We basically want the textHeight for the number of
+            // displayed lines.
+            messageHeight = Math.min(messageHeight, messageDisplay.textHeight + UITextField.TEXT_HEIGHT_PADDING);
+
             messageDisplay.x = Math.round(labelComponentsX);
             messageDisplay.y = Math.round(paddingTop + headerHeight + verticalGap);

@@ -1207,6 +1267,33 @@
             //    messageDisplay.text = messageText;
             //messageDisplay.truncateToFit();
         }
+
+        // revisit y positions now that we know all heights so we can respect verticalAlign style
+        if (getStyle("verticalAlign") == "top")
+        {
+            // don't do anything...already aligned to top in code above
+        }
+        else if (getStyle("verticalAlign") == "bottom")
+        {
+            if (iconDisplay)
+                iconDisplayHolder.setLayoutBoundsPosition(paddingLeft, unscaledHeight - iconHeight - paddingBottom);
+            if (messageDisplay)
+                messageDisplay.y = unscaledHeight - paddingBottom - messageHeight;
+            if (labelDisplay)
+                labelDisplay.y = unscaledHeight - paddingBottom - messageHeight - verticalGap - headerHeight;
+        }
+        else //if (getStyle("verticalAlign") == "middle")
+        {
+            if (iconDisplay)
+                iconDisplayHolder.setLayoutBoundsPosition(paddingLeft, Math.round((unscaledHeight - iconHeight)/2));
+            var textTotalHeight:Number = headerHeight + messageHeight + verticalGap;
+            if (labelDisplay)
+                labelDisplay.y = Math.round((unscaledHeight - textTotalHeight)/2);
+            if (messageDisplay)
+                messageDisplay.y = Math.round((unscaledHeight - textTotalHeight)/2 + verticalGap + headerHeight);
+        }
+        // made "middle" last even though it's most likely so it is the default and if someone
+        // types "center", then it will still vertically center itself.
     }

     //--------------------------------------------------------------------------


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@1264704 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mobilecomponents/src/spark/managers/PersistenceManager.as
+++ frameworks/projects/mobilecomponents/src/spark/managers/PersistenceManager.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 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 spark.managers
 {