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

--- frameworks/projects/framework/src/mx/managers/FocusManager.as
+++ frameworks/projects/framework/src/mx/managers/FocusManager.as
@@ -0,0 +1,1391 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.managers
+{
+
+import flash.display.DisplayObject;
+import flash.display.DisplayObjectContainer;
+import flash.display.InteractiveObject;
+import flash.display.Sprite;
+import flash.events.Event;
+import flash.events.FocusEvent;
+import flash.events.KeyboardEvent;
+import flash.events.MouseEvent;
+import flash.system.Capabilities;
+import flash.text.TextField;
+import flash.ui.Keyboard;
+import mx.core.Application;
+import mx.core.FlexSprite;
+import mx.core.IButton;
+import mx.core.IChildList;
+import mx.core.IRawChildrenContainer;
+import mx.core.IUIComponent;
+import mx.core.mx_internal;
+import mx.events.FlexEvent;
+
+use namespace mx_internal;
+
+/**
+ *  The FocusManager class manages the focus on components in response to mouse
+ *  activity or keyboard activity (Tab key).  There can be several FocusManager
+ *  instances in an application.  Each FocusManager instance
+ *  is responsible for a set of components that comprise a "tab loop".  If you
+ *  hit Tab enough times, focus traverses through a set of components and
+ *  eventually get back to the first component that had focus.  That is a "tab loop"
+ *  and a FocusManager instance manages that loop.  If there are popup windows
+ *  with their own set of components in a "tab loop" those popup windows will have
+ *  their own FocusManager instances.  The main application always has a
+ *  FocusManager instance.
+ *
+ *
The FocusManager manages focus from the "component level".
+ *  In Flex, a UITextField in a component is the only way to allow keyboard entry
+ *  of text. To the Flash Player or AIR, that UITextField has focus. However, from the
+ *  FocusManager's perspective the component that parents the UITextField has focus.
+ *  Thus there is a distinction between component-level focus and player-level focus.
+ *  Application developers generally only have to deal with component-level focus while
+ *  component developers must understand player-level focus.

+ *
+ *
All components that can be managed by the FocusManager must implement
+ *  mx.managers.IFocusManagerComponent, whereas objects managed by player-level focus do not.

+ *
+ *
The FocusManager also managers the concept of a defaultButton, which is
+ *  the Button on a form that dispatches a click event when the Enter key is pressed
+ *  depending on where focus is at that time.

+ */
+public class FocusManager implements IFocusManager
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *
A FocusManager manages the focus within the children of an IFocusManagerContainer.
+     *  It installs itself in the IFocusManagerContainer during execution
+     *  of the constructor.

+     *
+     *  @param container An IFocusManagerContainer that hosts the FocusManager.
+     *
+     *  @param popup If true, indicates that the container
+     *  is a popup component and not the main application.
+     */
+    public function FocusManager(container:IFocusManagerContainer, popup:Boolean = false)
+    {
+        super();
+
+        browserMode = Capabilities.playerType == "ActiveX" && !popup;
+
+        container.focusManager = this; // this property name is reserved in the parent
+
+        // trace("FocusManager constructor " + container + ".focusManager");
+
+        _form = container;
+
+        focusableObjects = [];
+
+        focusPane = new FlexSprite();
+        focusPane.name = "focusPane";
+
+        addFocusables(DisplayObject(container));
+
+        container.addEventListener(Event.ADDED, addedHandler);
+        container.addEventListener(Event.REMOVED, removedHandler);
+        container.addEventListener(FlexEvent.SHOW, showHandler);
+        container.addEventListener(FlexEvent.HIDE, hideHandler);
+
+        //special case application and window
+        if (container.systemManager is SystemManager)
+        {
+            // special case application.  It shouldn't need to be made
+            // active and because we defer appCreationComplete, this
+            // would steal focus back from any popups created during
+            // instantiation
+            if (container != SystemManager(container.systemManager).application)
+                container.addEventListener(FlexEvent.CREATION_COMPLETE,
+                                       creationCompleteHandler);
+        }
+
+        // Make sure the SystemManager is running so it can tell us about
+        // mouse clicks and stage size changes.
+        container.systemManager.addFocusManager(container);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+    private var LARGE_TAB_INDEX:int = 99999;
+
+    private var calculateCandidates:Boolean = true;
+
+    /**
+     *  @private
+     *  the object that last had focus
+     */
+    private var lastFocus:IFocusManagerComponent;
+
+    /**
+     *  @private
+     *  We track whether we've been last activated or saw a TAB
+     *  This is used in browser tab management
+     */
+    private var lastAction:String;
+
+    /**
+     *  @private
+     *  Tab management changes based on whether were in a browser or not
+     *  This value is also affected by whether you are a modal dialog or not
+     */
+    public var browserMode:Boolean;
+
+    /**
+     *  @private
+     *  Tab management changes based on whether were in a browser or not
+     *  If non-null, this is the object that will
+     *  lose focus to the browser
+     */
+    private var browserFocusComponent:InteractiveObject;
+
+    /**
+     *  @private
+     *  Total set of all objects that can receive focus
+     *  but might be disabled or invisible.
+     */
+    private var focusableObjects:Array;
+
+    /**
+     *  @private
+     *  Filtered set of objects that can receive focus right now.
+     */
+    private var focusableCandidates:Array;
+
+    /**
+     *  @private
+     */
+    private var activated:Boolean = false;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  showFocusIndicator
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the showFocusIndicator property.
+     */
+    private var _showFocusIndicator:Boolean = false;
+
+    /**
+     *  @inheritDoc
+     */
+    public function get showFocusIndicator():Boolean
+    {
+        return _showFocusIndicator;
+    }
+
+    /**
+     *  @private
+     */
+    public function set showFocusIndicator(value:Boolean):void
+    {
+        _showFocusIndicator = value;
+    }
+
+    //----------------------------------
+    //  defaultButton
+    //----------------------------------
+
+    /**
+     *  @private
+     *  The current default button.
+     */
+    private var defButton:IButton;
+
+    /**
+     *  @private
+     */
+    private var _defaultButton:IButton;
+
+    /**
+     *  @inheritDoc
+     */
+    public function get defaultButton():IButton
+    {
+		return _defaultButton;
+    }
+
+    /**
+     *  @private
+     *  We don't type the value as Button for dependency reasons
+     */
+    public function set defaultButton(value:IButton):void
+    {
+		var button:IButton = value ? IButton(value) : null;
+
+        if (button != _defaultButton)
+        {
+            if (_defaultButton)
+                _defaultButton.emphasized = false;
+
+            if (defButton)
+                defButton.emphasized = false;
+
+            _defaultButton = button;
+            defButton = button;
+
+            if (button)
+                button.emphasized = true;
+        }
+    }
+
+    //----------------------------------
+    //  defaultButtonEnabled
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the defaultButtonEnabled property.
+     */
+    private var _defaultButtonEnabled:Boolean = true;
+
+    /**
+     *  @inheritDoc
+     */
+    public function get defaultButtonEnabled():Boolean
+    {
+        return _defaultButtonEnabled;
+    }
+
+    /**
+     *  @private
+     */
+    public function set defaultButtonEnabled(value:Boolean):void
+    {
+        _defaultButtonEnabled = value;
+    }
+
+    //----------------------------------
+    //  focusPane
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the focusPane property.
+     */
+    private var _focusPane:Sprite;
+
+    /**
+     *  @inheritDoc
+     */
+    public function get focusPane():Sprite
+    {
+        return _focusPane;
+    }
+
+    /**
+     *  @private
+     */
+    public function set focusPane(value:Sprite):void
+    {
+        _focusPane = value;
+    }
+
+    //----------------------------------
+    //  form
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the form property.
+     */
+    private var _form:IFocusManagerContainer;
+
+    /**
+     *  @private
+     *  The form is the property where we store the IFocusManagerContainer
+     *  that hosts this FocusManager.
+     */
+    mx_internal function get form():IFocusManagerContainer
+    {
+        return _form;
+    }
+
+    /**
+     *  @private
+     */
+    mx_internal function set form (value:IFocusManagerContainer):void
+    {
+        _form = value;
+    }
+
+    //----------------------------------
+    //  nextTabIndex
+    //----------------------------------
+
+    /**
+     *  @inheritDoc
+     */
+    public function get nextTabIndex():int
+    {
+        return getMaxTabIndex() + 1;
+    }
+
+    /**
+     *  Gets the highest tab index currently used in this Focus Manager's form or subform.
+     *
+     *  @return Highest tab index currently used.
+     */
+    private function getMaxTabIndex():int
+    {
+        var z:Number = 0;
+
+        var n:int = focusableObjects.length;
+        for (var i:int = 0; i < n; i++)
+        {
+            var t:Number = focusableObjects[i].tabIndex;
+            if (!isNaN(t))
+                z = Math.max(z, t);
+        }
+
+        return z;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @inheritDoc
+     */
+    public function getFocus():IFocusManagerComponent
+    {
+        var o:InteractiveObject = form.systemManager.stage.focus;
+        return findFocusManagerComponent(o);
+    }
+
+    /**
+     *  @inheritDoc
+     */
+    public function setFocus(o:IFocusManagerComponent):void
+    {
+        // trace("FM " + this + " setting focus to " + o);
+
+        o.setFocus();
+
+        // trace("FM set focus");
+    }
+
+    /**
+     *  @private
+     */
+    private function focusInHandler(event:FocusEvent):void
+    {
+        var target:InteractiveObject = InteractiveObject(event.target);
+        // trace("FM " + this + " focusInHandler " + target);
+        if (isParent(DisplayObjectContainer(form), target))
+        {
+            // trace("FM " + this + " setting last focus " + target);
+            lastFocus = findFocusManagerComponent(InteractiveObject(target));
+
+			// handle default button here
+			// we can't check for Button because of cross-versioning so
+			// for now we just check for an emphasized property
+			if (lastFocus is IButton)
+			{
+				var x:IButton = lastFocus as IButton;
+				// if we have marked some other button as a default button
+				if (defButton)
+				{
+					// change it to be this button
+					defButton.emphasized = false;
+					defButton = x;
+					x.emphasized = true;
+				}
+			}
+			else
+			{
+				// restore the default button to be the original one
+				if (defButton && defButton != _defaultButton)
+				{
+					defButton.emphasized = false;
+					defButton = _defaultButton;
+					_defaultButton.emphasized = true;
+				}
+			}
+		}
+    }
+
+    /**
+     *  @private  Useful for debugging
+     */
+    private function focusOutHandler(event:FocusEvent):void
+    {
+        var target:InteractiveObject = InteractiveObject(event.target);
+        // trace("FM " + this + " focusOutHandler " + target);
+    }
+
+    /**
+     *  @private
+     *  restore focus to whoever had it last
+     */
+    private function activateHandler(event:Event):void
+    {
+        var target:InteractiveObject = InteractiveObject(event.target);
+        // trace("FM " + this + " activateHandler ", lastFocus);
+        if (lastFocus && !browserMode)
+            lastFocus.setFocus();
+        lastAction = "ACTIVATE";
+
+    }
+
+    /**
+     *  @private  Useful for debugging
+     */
+    private function deactivateHandler(event:Event):void
+    {
+        var target:InteractiveObject = InteractiveObject(event.target);
+        // trace("FM " + this + " deactivateHandler ", lastFocus);
+    }
+
+    /**
+     *  @inheritDoc
+     */
+    public function showFocus():void
+    {
+        if (!showFocusIndicator)
+        {
+            showFocusIndicator = true;
+            if (lastFocus)
+                lastFocus.drawFocus(true);
+        }
+    }
+
+    /**
+     *  @inheritDoc
+     */
+    public function hideFocus():void
+    {
+        // trace("FOcusManger " + this + " Hide Focus");
+        if (showFocusIndicator)
+        {
+            showFocusIndicator = false;
+            if (lastFocus)
+                lastFocus.drawFocus(false);
+        }
+        // trace("END FOcusManger Hide Focus");
+    }
+
+    /**
+     *  The SystemManager activates and deactivates a FocusManager
+     *  if more than one IFocusManagerContainer is visible at the same time.
+     *  If the mouse is clicked in an IFocusManagerContainer with a deactivated
+     *  FocusManager, the SystemManager will call
+     *  the activate() method on that FocusManager.
+     *  The FocusManager that was activated will have its deactivate() method
+     *  called prior to the activation of another FocusManager.
+     *
+     *
The FocusManager adds event handlers that allow it to monitor
+     *  focus related keyboard and mouse activity.

+     */
+    public function activate():void
+    {
+        // we can get a double activation if we're popping up and becoming visible
+        // like the second time a menu appears
+        if (activated)
+            return;
+
+        // trace("FocusManager activating " + this);
+
+        // listen for focus changes, use weak references for the stage
+        form.systemManager.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
+        form.systemManager.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
+        form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
+        form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
+        form.systemManager.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
+        form.systemManager.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
+        form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
+        // listen for default button in Capture phase. Some components like TextInput
+        // and Accordion stop the Enter key from propagating in the Bubble phase.
+        form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
+
+        activated = true;
+
+        // Restore focus to the last control that had it if there was one.
+        if (lastFocus)
+            setFocus(lastFocus);
+    }
+
+    /**
+     *  The SystemManager activates and deactivates a FocusManager
+     *  if more than one IFocusManagerContainer is visible at the same time.
+     *  If the mouse is clicked in an IFocusManagerContainer with a deactivated
+     *  FocusManager, the SystemManager will call
+     *  the activate() method on that FocusManager.
+     *  The FocusManager that was activated will have its deactivate() method
+     *  called prior to the activation of another FocusManager.
+     *
+     *
The FocusManager removes event handlers that allow it to monitor
+     *  focus related keyboard and mouse activity.

+     */
+    public function deactivate():void
+    {
+        // trace("FocusManager deactivating " + this);
+        // listen for focus changes
+        form.systemManager.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
+        form.systemManager.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
+        form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
+        form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
+        form.systemManager.stage.removeEventListener(Event.ACTIVATE, activateHandler);
+        form.systemManager.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
+        form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
+        // stop listening for default button in Capture phase
+        form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
+
+        activated = false;
+
+    }
+
+    /**
+     *  @inheritDoc
+     */
+    public function findFocusManagerComponent(
+                            o:InteractiveObject):IFocusManagerComponent
+    {
+        while (o)
+        {
+            if (o is IFocusManagerComponent && IFocusManagerComponent(o).focusEnabled)
+                return IFocusManagerComponent(o);
+
+            o = o.parent;
+        }
+
+        // tab was set somewhere else
+        return null;
+    }
+
+    /**
+     *  @private
+     *  Returns true if p is a parent of o.
+     */
+    private function isParent(p:DisplayObjectContainer, o:DisplayObject):Boolean
+    {
+        if (p is IRawChildrenContainer)
+            return IRawChildrenContainer(p).rawChildren.contains(o);
+
+        return p.contains(o);
+    }
+
+    private function isEnabledAndVisible(o:DisplayObject):Boolean
+    {
+        var formParent:DisplayObjectContainer = DisplayObject(form).parent;
+
+        while (o != formParent)
+        {
+            if (o is IUIComponent)
+                if (!IUIComponent(o).enabled)
+                    return false;
+            if (!o.visible)
+                return false;
+            o = o.parent;
+        }
+        return true;
+    }
+
+    /**
+     *  @private
+     */
+    private function sortByTabIndex(a:IFocusManagerComponent, b:IFocusManagerComponent):int
+    {
+        var aa:int = a.tabIndex;
+        var bb:int = b.tabIndex;
+
+        if (aa == -1)
+            aa = int.MAX_VALUE;
+        if (bb == -1)
+            bb = int.MAX_VALUE;
+
+        return (aa > bb ? 1 :
+                aa < bb ? -1 : sortByDepth(a, b));
+    }
+
+    /**
+     *  @private
+     */
+    private function sortFocusableObjectsTabIndex():void
+    {
+        // trace("FocusableObjectsTabIndex");
+
+        focusableCandidates = [];
+
+        var n:int = focusableObjects.length;
+        for (var i:int = 0; i < n; i++)
+        {
+            var c:IFocusManagerComponent = focusableObjects[i];
+            if (c.tabIndex && !isNaN(Number(c.tabIndex)))
+            {
+                // if we get here, it is a candidate
+                focusableCandidates.push(c);
+            }
+        }
+
+        focusableCandidates.sort(sortByTabIndex);
+    }
+
+    /**
+     *  @private
+     */
+    private function sortByDepth(aa:IFocusManagerComponent, bb:IFocusManagerComponent):Number
+    {
+        var val1:String = "";
+        var val2:String = "";
+        var index:int;
+        var tmp:String;
+        var tmp2:String;
+        var zeros:String = "0000";
+
+        var a:DisplayObject = DisplayObject(aa);
+        var b:DisplayObject = DisplayObject(bb);
+
+        while (a != DisplayObject(form) && a.parent)
+        {
+            index = getChildIndex(a.parent, a);
+            tmp = index.toString(16);
+            if (tmp.length < 4)
+            {
+                tmp2 = zeros.substring(0, 4 - tmp.length) + tmp;
+            }
+            val1 = tmp2 + val1;
+            a = a.parent;
+        }
+        while (b != DisplayObject(form) && b.parent)
+        {
+            index = getChildIndex(b.parent, b);
+            tmp = index.toString(16);
+            if (tmp.length < 4)
+            {
+                tmp2 = zeros.substring(0, 4 - tmp.length) + tmp;
+            }
+            val2 = tmp2 + val2;
+            b = b.parent;
+        }
+
+        return val1 > val2 ? 1 : val1 < val2 ? -1 : 0;
+    }
+
+    private function getChildIndex(parent:DisplayObjectContainer, child:DisplayObject):int
+    {
+        try
+        {
+            return parent.getChildIndex(child);
+        }
+        catch(e:Error)
+        {
+            if (parent is IRawChildrenContainer)
+                return IRawChildrenContainer(parent).rawChildren.getChildIndex(child);
+            throw e;
+        }
+        throw new Error("FocusManager.getChildIndex failed");   // shouldn't ever get here
+    }
+
+    /**
+     *  @private
+     *  Calculate what focusableObjects are valid tab candidates.
+     */
+    private function sortFocusableObjects():void
+    {
+        // trace("FocusableObjects " + focusableObjects.length.toString());
+        focusableCandidates = [];
+
+        var n:int = focusableObjects.length;
+        for (var i:int = 0; i < n; i++)
+        {
+            var c:InteractiveObject = focusableObjects[i];
+            // trace("  " + c);
+            if (c.tabIndex && !isNaN(Number(c.tabIndex)) && c.tabIndex > 0)
+            {
+                sortFocusableObjectsTabIndex();
+                return;
+            }
+            focusableCandidates.push(c);
+        }
+
+        focusableCandidates.sort(sortByDepth);
+    }
+
+    /**
+     *  Call this method to make the system
+     *  think the Enter key was pressed and the defaultButton was clicked
+     */
+    mx_internal function sendDefaultButtonEvent():void
+    {
+        // trace("FocusManager.sendDefaultButtonEvent " + defButton);
+        defButton.dispatchEvent(new MouseEvent("click"));
+    }
+
+    /**
+     *  @private
+     *  Do a tree walk and add all children you can find.
+     */
+    private function addFocusables(o:DisplayObject, skipTopLevel:Boolean = false):void
+    {
+        // trace(">>addFocusables " + o);
+        if (o is IFocusManagerComponent && !skipTopLevel)
+        {
+            var focusable:IFocusManagerComponent = IFocusManagerComponent(o);
+            if (focusable.focusEnabled)
+            {
+                if (focusable.tabEnabled && isTabVisible(o))
+                {
+                    focusableObjects.push(o);
+                    calculateCandidates = true;
+                    // trace("FM added " + o);
+                }
+                o.addEventListener("tabEnabledChange", tabEnabledChangeHandler);
+                o.addEventListener("tabIndexChange", tabIndexChangeHandler);
+            }
+        }
+
+        if (o is DisplayObjectContainer)
+        {
+            var doc:DisplayObjectContainer = DisplayObjectContainer(o);
+            // Even if they aren't focusable now,
+            // listen in case they become later.
+            o.addEventListener("tabChildrenChange", tabChildrenChangeHandler);
+
+            if (doc.tabChildren)
+            {
+                var i:int;
+                if (o is IRawChildrenContainer)
+                {
+                    // trace("using view rawChildren");
+                    var rawChildren:IChildList = IRawChildrenContainer(o).rawChildren;
+                    // recursively visit and add children of components
+                    // we don't do this for containers because we get individual
+                    // adds for the individual children
+                    for (i = 0; i < rawChildren.numChildren; i++)
+                    {
+                        try
+                        {
+                            addFocusables(rawChildren.getChildAt(i));
+                        }
+                        catch(error:SecurityError)
+                        {
+                            // Ignore this child if we can't access it
+                        }
+                    }
+
+                }
+                else
+                {
+                    // trace("using container's children");
+                    // recursively visit and add children of components
+                    // we don't do this for containers because we get individual
+                    // adds for the individual children
+                    for (i = 0; i < doc.numChildren; i++)
+                    {
+                        try
+                        {
+                            addFocusables(doc.getChildAt(i));
+                        }
+                        catch(error:SecurityError)
+                        {
+                            // Ignore this child if we can't access it
+                        }
+                    }
+                }
+            }
+        }
+        // trace("<<addFocusables " + o);
+    }
+
+    /**
+     *  @private
+     *  is it really tabbable?
+     */
+    private function isTabVisible(o:DisplayObject):Boolean
+    {
+        var s:DisplayObject = DisplayObject(form.systemManager);
+        if (!s) return false;
+
+        var p:DisplayObjectContainer = o.parent;
+        while (p && p != s)
+        {
+            if (!p.tabChildren)
+                return false;
+            p = p.parent;
+        }
+        return true;
+    }
+
+    private function isValidFocusCandidate(o:DisplayObject, g:String):Boolean
+    {
+        if (!isEnabledAndVisible(o))
+            return false;
+
+        if (o is IFocusManagerGroup)
+        {
+            // reject if it is in the same tabgroup
+            var tg:IFocusManagerGroup = IFocusManagerGroup(o);
+            if (g == tg.groupName) return false;
+        }
+        return true;
+    }
+
+    private function getIndexOfFocusedObject(o:DisplayObject):int
+    {
+        if (!o)
+            return -1;
+
+        var n:int = focusableCandidates.length;
+        // trace(" focusableCandidates " + n);
+        var i:int = 0;
+        for (i = 0; i < n; i++)
+        {
+            // trace(" comparing " + focusableCandidates[i]);
+            if (focusableCandidates[i] == o)
+                return i;
+        }
+
+        // no match?  try again with a slower match for certain
+        // cases like DG editors
+        for (i = 0; i < n; i++)
+        {
+            var iui:IUIComponent = focusableCandidates[i] as IUIComponent;
+            if (iui && iui.owns(o))
+                return i;
+        }
+
+        return -1;
+    }
+
+
+    private function getIndexOfNextObject(i:int, shiftKey:Boolean, bSearchAll:Boolean, groupName:String):int
+    {
+        var n:int = focusableCandidates.length;
+        var start:int = i;
+
+        while (true)
+        {
+            if (shiftKey)
+                i--;
+            else
+                i++;
+            if (bSearchAll)
+            {
+                if (shiftKey && i < 0)
+                    break;
+                if (!shiftKey && i == n)
+                    break;
+            }
+            else
+            {
+                i = (i + n) % n;
+                // came around and found the original
+                if (start == i)
+                    break;
+            }
+            // trace("testing " + focusableCandidates[i]);
+            if (isValidFocusCandidate(focusableCandidates[i], groupName))
+            {
+                // trace(" stopped at " + i);
+                var o:DisplayObject = DisplayObject(findFocusManagerComponent(focusableCandidates[i]));
+                if (o is IFocusManagerGroup)
+                {
+                    // look around to see if there's a selected member in the tabgroup
+                    // otherwise use the first one we found.
+                    var tg1:IFocusManagerGroup = IFocusManagerGroup(o);
+                    for (var j:int = 0; j < focusableCandidates.length; j++)
+                    {
+                        var obj:DisplayObject = focusableCandidates[j];
+                        if (obj is IFocusManagerGroup)
+                        {
+                            var tg2:IFocusManagerGroup = IFocusManagerGroup(obj);
+                            if (tg2.groupName == tg1.groupName && tg2.selected)
+                            {
+                                // if objects of same group have different tab index
+                                // skip you aren't selected.
+                                if (InteractiveObject(obj).tabIndex != InteractiveObject(o).tabIndex && !tg1.selected)
+                                    return getIndexOfNextObject(i, shiftKey, bSearchAll, groupName);
+
+                                i = j;
+                                break;
+                            }
+                        }
+                    }
+
+                }
+                return i;
+            }
+        }
+        return i;
+    }
+
+    /**
+     *  @private
+     */
+    private function setFocusToNextObject(event:FocusEvent):void
+    {
+        if (focusableObjects.length == 0)
+            return;
+
+		var o:IFocusManagerComponent = getNextFocusManagerComponent(event.shiftKey);
+		// trace("winner = ", o);
+
+		if (o)
+		{
+			if (o is IFocusManagerComplexComponent)
+				IFocusManagerComplexComponent(o).assignFocus(event.shiftKey ? "bottom" : "top");
+			else
+				setFocus(o);
+		}
+	}
+
+    /**
+     *  @inheritDoc
+     */
+    public function getNextFocusManagerComponent(
+                            backward:Boolean = false):IFocusManagerComponent
+    {
+        if (focusableObjects.length == 0)
+            return null;
+
+        // I think we'll have time to do this here instead of at creation time
+        // this makes and orders the focusableCandidates array
+        if (calculateCandidates)
+        {
+            sortFocusableObjects();
+            calculateCandidates = false;
+        }
+
+        // get the object that has the focus
+        var o:DisplayObject = form.systemManager.stage.focus;
+        // trace("focus was at " + o);
+        // trace("focusableObjects " + focusableObjects.length);
+        o = DisplayObject(findFocusManagerComponent(InteractiveObject(o)));
+
+        var g:String = "";
+        if (o is IFocusManagerGroup)
+        {
+            var tg:IFocusManagerGroup = IFocusManagerGroup(o);
+            g = tg.groupName;
+        }
+        var i:int = getIndexOfFocusedObject(o);
+
+        // trace(" starting at " + i);
+        var bSearchAll:Boolean = false;
+        var start:int = i;
+        if (i == -1) // we didn't find it
+        {
+            if (backward)
+                i = focusableCandidates.length;
+            bSearchAll = true;
+            // trace("search all " + i);
+        }
+
+        var j:int = getIndexOfNextObject(i, backward, bSearchAll, g);
+
+        return findFocusManagerComponent(focusableCandidates[j]);
+    }
+
+    /**
+     *  @private
+     */
+    private function getTopLevelFocusTarget(o:InteractiveObject):InteractiveObject
+    {
+        while (o != InteractiveObject(form))
+        {
+            if (o is IFocusManagerComponent &&
+                IFocusManagerComponent(o).focusEnabled &&
+                IFocusManagerComponent(o).mouseFocusEnabled &&
+                (o is IUIComponent ? IUIComponent(o).enabled : true))
+                return o;
+
+            o = o.parent;
+
+            if (o == null)
+                break;
+        }
+
+        return null;
+    }
+
+    /**
+     *  Returns a String representation of the component hosting the FocusManager object,
+     *  with the String ".focusManager" appended to the end of the String.
+     */
+    public function toString():String
+    {
+        return Object(form).toString() + ".focusManager";
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Event handlers
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Listen for children being added
+     *  and see if they are focus candidates.
+     */
+    private function addedHandler(event:Event):void
+    {
+        var target:DisplayObject = DisplayObject(event.target);
+
+        // trace("FM got added for " + target);
+
+        // if it is truly parented, add it, otherwise it will get added when the top of the tree
+        // gets parented
+        if (target.stage)
+        {
+            // trace("adding focusables");
+            addFocusables(DisplayObject(event.target));
+        }
+    }
+
+    /**
+     *  @private
+     *  Listen for children being removed.
+     */
+    private function removedHandler(event:Event):void
+    {
+        var i:int;
+        var o:DisplayObject = DisplayObject(event.target);
+
+        // trace("FM got added for " + event.target);
+
+        if (o is IFocusManagerComponent)
+        {
+            for (i = 0; i < focusableObjects.length; i++)
+            {
+                if (o == focusableObjects[i])
+                {
+                    if (o == lastFocus)
+                    {
+                        lastFocus.drawFocus(false);
+                        lastFocus = null;
+                    }
+                    // trace("FM removed " + o);
+                    o.removeEventListener("tabEnabledChange", tabEnabledChangeHandler);
+                    o.removeEventListener("tabIndexChange", tabIndexChangeHandler);
+                    focusableObjects.splice(i, 1);
+                    calculateCandidates = true;
+                    break;
+                }
+            }
+        }
+        removeFocusables(o, false);
+    }
+
+    /**
+     *  @private
+     */
+    private function removeFocusables(o:DisplayObject, dontRemoveTabChildrenHandler:Boolean):void
+    {
+        var i:int;
+        if (o is DisplayObjectContainer)
+        {
+            if (!dontRemoveTabChildrenHandler)
+                o.removeEventListener("tabChildrenChange", tabChildrenChangeHandler);
+
+            for (i = 0; i < focusableObjects.length; i++)
+            {
+                if (isParent(DisplayObjectContainer(o), focusableObjects[i]))
+                {
+                    if (focusableObjects[i] == lastFocus)
+                    {
+                        lastFocus.drawFocus(false);
+                        lastFocus = null;
+                    }
+                    // trace("FM removed " + focusableObjects[i]);
+                    focusableObjects[i].removeEventListener(
+                        "tabEnabledChange", tabEnabledChangeHandler);
+                    focusableObjects[i].removeEventListener(
+                        "tabIndexChange", tabIndexChangeHandler);
+                    focusableObjects.splice(i, 1);
+                    i = i - 1;  // because increment would skip one
+                    calculateCandidates = true;
+                }
+            }
+        }
+    }
+
+    /**
+     *  @private
+     */
+    private function showHandler(event:Event):void
+    {
+        form.systemManager.activate(form);
+    }
+
+    /**
+     *  @private
+     */
+    private function hideHandler(event:Event):void
+    {
+        form.systemManager.deactivate(form);
+    }
+
+    /**
+     *  @private
+     */
+    private function creationCompleteHandler(event:FlexEvent):void
+    {
+        if (DisplayObject(form).visible && !activated)
+            form.systemManager.activate(form);
+    }
+
+    /**
+     *  @private
+     *  Add or remove if tabbing properties change.
+     */
+    private function tabIndexChangeHandler(event:Event):void
+    {
+        calculateCandidates = true;
+    }
+
+    /**
+     *  @private
+     *  Add or remove if tabbing properties change.
+     */
+    private function tabEnabledChangeHandler(event:Event):void
+    {
+        calculateCandidates = true;
+
+        var o:InteractiveObject = InteractiveObject(event.target);
+        var n:int = focusableObjects.length;
+        for (var i:int = 0; i < n; i++)
+        {
+            if (focusableObjects[i] == o)
+                break;
+        }
+        if (o.tabEnabled)
+        {
+            if (i == n && isTabVisible(o))
+            {
+                // trace("FM tpc added " + o);
+                // add it if were not already
+                focusableObjects.push(o);
+            }
+        }
+        else
+        {
+            // remove it
+            if (i < n)
+            {
+                // trace("FM tpc removed " + o);
+                focusableObjects.splice(i, 1);
+            }
+        }
+    }
+
+    /**
+     *  @private
+     *  Add or remove if tabbing properties change.
+     */
+    private function tabChildrenChangeHandler(event:Event):void
+    {
+        if (event.target != event.currentTarget)
+            return;
+
+        calculateCandidates = true;
+
+        var o:DisplayObjectContainer = DisplayObjectContainer(event.target);
+        if (o.tabChildren)
+        {
+            addFocusables(o, true);
+        }
+        else
+        {
+            removeFocusables(o, true);
+        }
+    }
+
+    /**
+     *  @private
+     *  This gets called when mouse clicks on a focusable object.
+     *  We block player behavior
+     */
+    private function mouseFocusChangeHandler(event:FocusEvent):void
+    {
+        if (event.relatedObject is TextField)
+        {
+            var tf:TextField = event.relatedObject as TextField;
+            if (tf.type == "input" || tf.selectable)
+            {
+                return; // pass it on
+            }
+        }
+
+        event.preventDefault();
+    }
+
+    /**
+     *  @private
+     *  This gets called when the tab key is hit.
+     */
+    private function keyFocusChangeHandler(event:FocusEvent):void
+    {
+        showFocusIndicator = true;
+
+        if (event.keyCode == Keyboard.TAB && !event.isDefaultPrevented())
+        {
+            if (browserFocusComponent)
+            {
+                if (browserFocusComponent.tabIndex == LARGE_TAB_INDEX)
+                    browserFocusComponent.tabIndex = -1;
+                browserFocusComponent = null;
+                return;
+            }
+
+            // trace("tabHandled by " + this);
+            setFocusToNextObject(event);
+
+            event.preventDefault();
+        }
+    }
+
+    /**
+     *  @private
+     *  Watch for Enter key.
+     */
+    private function keyDownHandler(event:KeyboardEvent):void
+    {
+        // trace("onKeyDown handled by " + this);
+        var sm:SystemManager = form.systemManager as SystemManager;
+        if (sm)
+            sm.idleCounter = 0;
+    /*  else
+        {
+            var wsm:WindowedSystemManager = WindowedSystemManager(form.systemManager);
+            wsm.idleCounter = 0;
+        }
+        */
+        if (event.keyCode == Keyboard.TAB)
+        {
+            lastAction = "KEY";
+
+            // I think we'll have time to do this here instead of at creation time
+            // this makes and orders the focusableCandidates array
+            if (calculateCandidates)
+            {
+                sortFocusableObjects();
+                calculateCandidates = false;
+            }
+        }
+
+        if (browserMode)
+        {
+            if (event.keyCode == Keyboard.TAB && focusableCandidates.length > 0)
+            {
+                // get the object that has the focus
+                var o:DisplayObject = form.systemManager.stage.focus;
+                // trace("focus was at " + o);
+                // trace("focusableObjects " + focusableObjects.length);
+                o = DisplayObject(findFocusManagerComponent(InteractiveObject(o)));
+                var g:String = "";
+                if (o is IFocusManagerGroup)
+                {
+                    var tg:IFocusManagerGroup = IFocusManagerGroup(o);
+                    g = tg.groupName;
+                }
+
+                var i:int = getIndexOfFocusedObject(o);
+                var j:int = getIndexOfNextObject(i, event.shiftKey, false, g);
+                if (event.shiftKey)
+                {
+                    if (j >= i)
+                    {
+                        // we wrapped so let browser have it
+                        browserFocusComponent = form.systemManager.stage.focus;
+                        if (browserFocusComponent.tabIndex == -1)
+                            browserFocusComponent.tabIndex = 0;
+                    }
+                }
+                else
+                {
+                    if (j <= i)
+                    {
+                        // we wrapped so let browser have it
+                        browserFocusComponent = form.systemManager.stage.focus;
+                        if (browserFocusComponent.tabIndex == -1)
+                            browserFocusComponent.tabIndex = LARGE_TAB_INDEX;
+                    }
+                }
+            }
+        }
+
+        if (defaultButtonEnabled &&
+            event.keyCode == Keyboard.ENTER &&
+            defaultButton && defButton.enabled)
+            //sendDefaultButtonEvent();
+            defButton.callLater(sendDefaultButtonEvent);
+    }
+
+    /**
+     *  @private
+     *  This gets called when the focus changes due to a mouse click.
+     *
+     *  Note: If the focus is changing to a TextField, we don't call
+     *  setFocus() on it because the player handles it;
+     *  calling setFocus() on a TextField which has scrollable text
+     *  causes the text to autoscroll to the end, making the
+     *  mouse click set the insertion point in the wrong place.
+     */
+    private function mouseDownHandler(event:MouseEvent):void
+    {
+        // trace("FocusManager mouseDownHandler by " + this);
+        // trace("FocusManager mouseDownHandler target " + event.target);
+
+        if (event.isDefaultPrevented())
+            return;
+
+        var o:DisplayObject = getTopLevelFocusTarget(
+            InteractiveObject(event.target));
+
+        if (!o)
+            return;
+
+        showFocusIndicator = false;
+
+        // trace("FocusManager mouseDownHandler on " + o);
+
+        // Make sure the containing component gets notified.
+        // As the note above says, we don't set focus to a TextField ever
+        // because the player already did and took care of where
+        // the insertion point is, and we also don't call setfocus
+        // on a component that last the last focused object unless
+        // the last action was just to activate the player and didn't
+        // involve tabbing or clicking on a component
+        if ((o != lastFocus || lastAction == "ACTIVATE") && !(o is TextField))
+            setFocus(IFocusManagerComponent(o));
+
+        lastAction = "MOUSEDOWN";
+    }
+}
+
+}


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

--- frameworks/projects/mx/src/mx/styles/metadata/BorderStyles.as
+++ frameworks/projects/mx/src/mx/styles/metadata/BorderStyles.as
@@ -1,4 +1,26 @@
-
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  Background color of the component when it is disabled.
+ *  The global default value is undefined.
+ *  The default value for List controls is 0xDDDDDD (light gray).
+ *  If a container is disabled, the background is dimmed, and the degree of
+ *  dimming is controlled by the disabledOverlayAlpha style.
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
 [Style(name="backgroundDisabledColor", type="uint", format="Color", inherit="yes", theme="halo")]

 /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 18035
Author:   egeorgie@adobe.com
Date:     2010-10-06T19:01:59.480083Z

Log Message:
-----------
Fix SDK-27904 Spark Button icon property needs to be a style

In this change:
- remove the "icon" property and replace it with an "icon" non-inheriting style for Button & friends.
- exclude the "icon" style for CheckBox and RadioButton
- The protected "iconInstance" variable in ButtonSkinBase is replaced with protected methods "getIconDisplay()" and "setIcon()"

QE notes: Verify skins look as expected; Update mustella
Doc notes: Make sure doc reflects the change from property to style.
Bugs: SDK-27642
Reviewer: Corey, Glenn, Jason
Tests run: checkin tests, some mobile mustella
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBarBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/CheckBox.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ButtonSkinBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/RadioButton.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/SelectableButtonSkinBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/SparkButtonSkin.as</path>

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

--- frameworks/projects/spark/src/spark/components/RadioButton.as
+++ frameworks/projects/spark/src/spark/components/RadioButton.as
@@ -47,7 +47,7 @@
 //--------------------------------------

 [Exclude(name="cornerRadius", kind="style")]
-[Exclude(name="icon", kind="property")]
+[Exclude(name="icon", kind="style")]

 //--------------------------------------
 //  Other metadata


Transferred from the Adobe Open Source Subversion Repository

Revision: 12764
Author:   gosmith@adobe.com
Date:     2009-12-10T02:06:04.655479Z

Log Message:
-----------
Dealt with issues involving accessibility and skin parts.

1. The accessibility implementation classes for four Spark components -- ComboBox, NumericStepper, TitleWindow, and VideoPlayer -- need to listen to events dispatched from skin parts. The problems were:

a) Skin parts may not exist at the time that the acc impl constructor executes, which is when we were doing addEventListener() on them. This is now fixed by consistently having null checks.

b) Skin parts may come and go at any later time. We now cope with this by having the acc impls listen for "partAdded" and "partRemoved" events from the component. When they discover that a skin part they want to listen to is being added, they now call addEventListener(), and when a skin part is removed they call removeEventListener().

2. The accessibility implementation classes for two Spark components -- Panel and TitleWindow -- actually get attached to a skin part (the titleDisplay) rather than to the component. Since we do this in createAccessibilityImplementation(), it's a problem if this happens before the titleDisplay exists. So instead of calling createAccessibilityImplementation() from initializeAccessibiility(), these components now call it from partAdded(). They also remove the acc impl if the titleDisplay is removed. Finally, there is some logic to prevent the partAdded() method of TitleWindow, which is a subclass of Panel, from creating both a PanelAccImpl and a TitleWindowAccImpl.

QE notes: None
Doc notes: None
Bugs: None
Reviewer: Glenn
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/SliderBaseAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/SpinnerAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TitleWindow.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/PanelAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/VideoPlayerAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Panel.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/NumericStepperAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/ComboBoxAccImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/TitleWindowAccImpl.as</path>

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

--- frameworks/projects/spark/src/spark/components/TitleWindow.as
+++ frameworks/projects/spark/src/spark/components/TitleWindow.as
@@ -309,8 +309,12 @@
      */
     override protected function initializeAccessibility():void
     {
-        if (TitleWindow.createAccessibilityImplementation != null)
-            TitleWindow.createAccessibilityImplementation(this);
+		// Do nothing... don't even call super.
+		// The TitleWindowAccImpl needs to be attached not to the TitleWindow
+		// but to the TitleWindow's titleDisplay, which is a skin part
+		// which may not exist initially and which may come and go.
+		// So we have to create and attach the TitleWindowAccImpl
+		// in partAdded() instead.
     }

     /**
@@ -354,8 +358,22 @@
      */
     override protected function partAdded(partName:String, instance:Object) : void
     {
-        super.partAdded(partName, instance);
-
+		if (instance == titleDisplay)
+		{
+			// Since the TitleWindowAccImpl must be attached to the TitleWindow's
+			// titleDisplay instead of to the TitleWindow itself, we delay doing this
+			// until we are sure there is a titleDisplay, and we do it again if it gets
+			// re-added.
+			// We also do it before calling the supermethod on Panel,
+			// which creates a PanelAccImpl but only if an acc impl doesn't already exist.
+			// In this way we avoid TitleWindow creating both a TitleWindowAccImpl
+			// and a PanelAccImpl.
+			if (TitleWindow.createAccessibilityImplementation != null)
+				TitleWindow.createAccessibilityImplementation(this);
+		}
+
+		super.partAdded(partName, instance);
+
         if (instance == moveArea)
         {
             moveArea.addEventListener(MouseEvent.MOUSE_DOWN, moveArea_mouseDownHandler);
@@ -373,6 +391,9 @@
     override protected function partRemoved(partName:String, instance:Object):void
     {
         super.partRemoved(partName, instance);
+
+		// Nulling of titleDisplay.accessibilityImplementation when the titleDisplay
+		// is removed is handled by the supermethod.

         if (instance == moveArea)
             moveArea.removeEventListener(MouseEvent.MOUSE_DOWN, moveArea_mouseDownHandler);


Transferred from the Adobe Open Source Subversion Repository

Revision: 8907
Author:   clucier@adobe.com
Date:     2009-07-29T19:49:05.287765Z

Log Message:
-----------
Addressing SDK-22156. For a non-virtualized horizontal and vertical layout, we should be considering the minor-axis size for all elements when requestedRowCount (or requestedColumnCount) is specified.

QE notes: None
Doc notes: None
Bugs: SDK-22156
Reviewer: Hans
Tests run: Cyclone sent to QE, w/focus on HorizontalLayout and VerticalLayout tests.
Is noteworthy for integration: No.

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/VerticalLayout.as</path>

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

--- frameworks/projects/spark/src/spark/layouts/VerticalLayout.as
+++ frameworks/projects/spark/src/spark/layouts/VerticalLayout.as
@@ -1004,11 +1004,14 @@
     /**
      *  @private
      *
-     *  Compute exact values for measuredWidth,Height and  measuredMinWidth,Height.
-     *
-     *  If requestedRowCount is not -1, measure as many layout elements,
-     *  padding with typicalLayoutElement if needed, starting with index 0.
-     *  Otherwise measure all of the layout elements.
+     *  Compute exact values for measuredWidth,Height and measuredMinWidth,Height.
+     *
+     *  Measure each of the layout elements.  If requestedRowCount >= 0 we
+     *  consider the height and width of as many layout elements, padding with
+     *  typicalLayoutElement if needed, starting with index 0. We then only
+     *  consider the width of the elements remaining.
+     *
+     *  If requestedRowCount is -1, we measure all of the layout elements.
      */
     private function measureReal(layoutTarget:GroupBase):void
     {
@@ -1016,37 +1019,42 @@
         var reqEltCount:int = requestedRowCount; // -1 means "all elements"
         var eltCount:uint = Math.max(reqEltCount, layoutEltCount);
         var eltInLayoutCount:uint = 0; // elts that have been measured
-
+
         var preferredHeight:Number = 0; // sum of the elt preferred heights
         var preferredWidth:Number = 0;  // max of the elt preferred widths
         var minHeight:Number = 0; // sum of the elt minimum heights
         var minWidth:Number = 0;  // max of the elt minimum widths
-
+
         var fixedRowHeight:Number = NaN;
         if (!variableRowHeight)
             fixedRowHeight = rowHeight;  // may query typicalLayoutElement, elt at index=0
-
+
         for (var i:uint = 0; i < eltCount; i++)
-        {
-            if ((reqEltCount != -1) && (eltInLayoutCount >= reqEltCount))
-                break;
-
+        {
             if (i < layoutEltCount) // target.numElements
                 var elt:ILayoutElement = layoutTarget.getElementAt(i);
             else // target.numElements < requestedElementCount, so "pad"
                 elt = typicalLayoutElement;
             if (!elt || !elt.includeInLayout)
                 continue;
-
-            var height:Number = isNaN(fixedRowHeight) ? elt.getPreferredBoundsHeight() : fixedRowHeight;
+
+            // If requestedRowCount is specified, no need to consider the height
+            // of rows outside the bounds of the "requested" range. Otherwise, we
+            // consider each element.
+            if ((reqEltCount == -1) || ((reqEltCount != -1) && eltInLayoutCount < requestedRowCount))
+            {
+                var height:Number = isNaN(fixedRowHeight) ? elt.getPreferredBoundsHeight() : fixedRowHeight;
+                preferredHeight += height;
+                minHeight += (isNaN(elt.percentHeight)) ? height : elt.getMinBoundsHeight();
+                eltInLayoutCount += 1;
+            }
+
+            // Consider the width of each element, inclusive of those outside
+            // the requestedRowCount range.
             var width:Number = elt.getPreferredBoundsWidth();
-            preferredHeight += height;
             preferredWidth = Math.max(preferredWidth, width);
-            minHeight += (isNaN(elt.percentHeight)) ? height : elt.getMinBoundsHeight();
             var flexibleWidth:Boolean = !isNaN(elt.percentWidth) || horizontalAlign == HorizontalAlign.JUSTIFY;
-            minWidth = Math.max(minWidth, flexibleWidth ? elt.getMinBoundsWidth() : width);
-
-            eltInLayoutCount += 1;
+            minWidth = Math.max(minWidth, flexibleWidth ? elt.getMinBoundsWidth() : width);
         }

         if (eltInLayoutCount > 1)


Remove --break-blocks option, it doesn't match the existing code style

Strip trailing newlines.

--- astyle_config.as
+++ astyle_config.as
@@ -8,15 +8,15 @@
 # for C++ files only
 --indent-classes

-# Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block.
+# Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block.
 # The entire case block is indented.
 --indent-switches

 # Add extra indentation to namespace blocks. This option has no effect on Java files.
 --indent-namespaces

-# Converts tabs into spaces in the non-indentation part of the line.
---convert-tabs
+# Converts tabs into spaces in the non-indentation part of the line.
+--convert-tabs

 # requires --convert-tabs to work properly
 --indent-preprocessor
@@ -27,17 +27,14 @@

 --max-instatement-indent=40

-# Pad empty lines around header blocks (e.g. 'if', 'for', 'while'...).
---break-blocks
-
-# Insert space padding around operators.
+# Insert space padding around operators.
 --pad-oper

-# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...).
+# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...).
 --pad-header

-# Add brackets to unbracketed one line conditional statements (e.g. 'if', 'for', 'while'...).
+# Add brackets to unbracketed one line conditional statements (e.g. 'if', 'for', 'while'...).
 --add-brackets

 --align-pointer=name
@@ -46,12 +43,12 @@
 --suffix=none

 # For each directory in the command line, process all subdirectories recursively.
---recursive
+--recursive

 # Preserve the original file's date and time modified.
 --preserve-date

-# Formatted files display mode. Display only the files that have been formatted.
+# Formatted files display mode. Display only the files that have been formatted.
 # Do not display files that are unchanged.
 --formatted


OFC-1597 - Data entry users cannot edit records owned by themselves when they leave the record and edit it again

--- collect-client/src/main/flex/org/openforis/collect/presenter/MasterPresenter.as
+++ collect-client/src/main/flex/org/openforis/collect/presenter/MasterPresenter.as
@@ -148,7 +148,7 @@
 				var recordInfo:Object = {id: record.id, step: record.step};
 				var responder:AsyncResponder = new AsyncResponder(loadRecordResultHandler, loadRecordFaultHandler, recordInfo);

-				if (Application.user.canEditNotOwnedRecords) {
+				if (Application.user.canEditRecords) {
 					_dataClient.checkoutRecord(responder, record.id, record.step);
 				} else {
 					_dataClient.loadRecord(responder, record.id, record.step);


Transferred from the Adobe Open Source Subversion Repository

Revision: 22032
Author:   chiedozi@adobe.com
Date:     2011-08-16T21:08:55.666603Z

Log Message:
-----------
ViewNavigator automatically register's the class aliases for NavigationStack and ViewDescriptor to support PersistenceManager

QE notes:
Doc notes:
Bugs: SDK-31165
Reviewer: Tom
Tests run: checkintests, mustella-mobile
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/ViewNavigator.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/manifest.xml</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorApplicationBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/SplitViewNavigator.as</path>

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

--- frameworks/projects/mobilecomponents/src/spark/components/ViewNavigator.as
+++ frameworks/projects/mobilecomponents/src/spark/components/ViewNavigator.as
@@ -12,6 +12,7 @@
 package spark.components
 {
 import flash.events.Event;
+import flash.net.registerClassAlias;

 import mx.core.IVisualElement;
 import mx.core.UIComponent;
@@ -164,6 +165,13 @@
      */
     private static const DEFAULT_VIEW_TRANSITION_DURATION:Number = 300;

+    /**
+     *  @private
+     *  Flag indicating whether the classes required for the PersistenceManager
+     *  have been registered with the player.
+     */
+    private static var classAliasesRegistered:Boolean = false;
+
     //--------------------------------------------------------------------------
     //
     //  Constructor
@@ -180,6 +188,16 @@
     public function ViewNavigator()
     {
         super();
+
+        if (!classAliasesRegistered)
+        {
+            // Register aliases for custom classes that will be written to
+            // persistence store by navigator
+            registerClassAlias("ViewDescriptor", ViewDescriptor);
+            registerClassAlias("NavigationStack", NavigationStack);
+
+            classAliasesRegistered = true;
+        }

         // Default view transitions
         var slideLeft:SlideViewTransition = new SlideViewTransition();


Transferred from the Adobe Open Source Subversion Repository

Revision: 7967
Author:   gosmith@adobe.com
Date:     2009-06-18T19:44:16.674676Z

Log Message:
-----------
PARB changes to TextGraphicElement/SimpleText/RichText and to text styles in general.

TextGraphicElement:

The 'truncation' property has been renamed to 'maxDisplayedLines'.

The isTruncated() method has become an 'isTruncated' read-only property.

RichText:

Since a TextFlow object is the fundamental representation for rich test in TLF, the RichText component now has a public textFlow:TextFlow property which you can get or set. To turn TLF markup -- in either String or XML form -- into a TextFlow, use the static importFromString() and importFromXML() methods in the TextFlowUtil class. These are bindable methods so that if the markup parameter changes they will re-evaluate. To turn the TextFlow back into markup, use TextFLowUtil.export(...) to produce XML.

The 'content' property is now intended only for use by the MXML compiler. It is set-only and only supports being set to what MXML markup produces: a String (which will be treated as the text of an implicit span in an implicit paragraph), a FlowElement, or an Array of Strings and FlowElements.

The 'text', 'textFlow', and 'content' properties are interacting properties. For example, you can set 'textFlow' and then get the 'text', and vice versa. In fact, you can now do this immediately, without waiting for the component to undergo a LayoutManager pass. Of these three properties, the last one set in ActionScript wins; if more than one is set in MXML the results are undefined since MXML does not guarantee the order in which properties are set. Setting any of them to null is equivalent to setting the 'text' to the empty String, which is the initial state of the component.

Styles:

The 'lineBreak' style is now non-inheriting, since in TLF it doesn't inherit from FlowElement to FlowElement.

The text styles are now divided into five buckets:

BasicInheritingTextStyles.as
BasicNonInheritingTextStyles.as
AdvancedInheritingTextStyles.as
AdvancedNonInheritingTextStyles.as
SelectionFormatTextStyles.as

Skinnable components like TextInput and TextArea no longer declare any on the noninheriting text styles, because the RichTextElement in the skin doesn't inherit them. You must set them directly on the RichTextElement in the component's skin, either with ActionScript or by reskinning.

The styleInitialized() method has been added to the IAdvancedStyleClient interface.

QE Notes: None
Doc Notes: None
Bugs: None
Reviewer: Carol

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/ButtonBarFirstButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonBarFirstButtonSkin.mxml</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/BasicTextLayoutFormatStyles.as" copyfrom-rev="7910" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/BasicInheritingTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/spark/SparkChromeWindowedApplicationSkin.mxml</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/airframework/src/spark/skins/spark/WindowedApplicationSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/ButtonBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/DefaultButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/ButtonBarLastButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonBarLastButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/DefaultButtonSkin.mxml</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/AdvancedTextLayoutFormatStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/NumericStepper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/supportClasses/Slider.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleProxy.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/BasicTextLayoutFormatStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/VideoPlayer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/utils/TextFlowUtil.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/AdvancedNonInheritingTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/primitives/RichEditableText.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/ButtonBarMiddleButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/ButtonBarMiddleButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/ButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/ToggleButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/ToggleButtonSkin.mxml</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/components/supportClasses/SkinnableTextBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableDataContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/skins/spark/windowChrome/TitleBarSkin.mxml</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/NonInheritingTextLayoutFormatStyles.as" copyfrom-rev="7910" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/BasicNonInheritingTextStyles.as</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/spark/CheckBoxSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/CheckBoxSkin.mxml</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/NonInheritingTextLayoutFormatStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/components/SkinnableContainer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/skins/spark/RadioButtonSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/IAdvancedStyleClient.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/wireframe/src/spark/skins/wireframe/RadioButtonSkin.mxml</path>
<path kind="file" copyfrom-path="/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/AdvancedTextLayoutFormatStyles.as" copyfrom-rev="7910" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/spark/styles/metadata/AdvancedInheritingTextStyles.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/airframework/src/spark/skins/spark/windowChrome/MacTitleBarSkin.mxml</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
@@ -50,8 +50,8 @@
 //  Styles
 //--------------------------------------

-include "../../styles/metadata/AdvancedTextLayoutFormatStyles.as"
-include "../../styles/metadata/BasicTextLayoutFormatStyles.as"
+include "../../styles/metadata/BasicInheritingTextStyles.as"
+include "../../styles/metadata/AdvancedInheritingTextStyles.as"
 include "../../styles/metadata/SelectionFormatTextStyles.as"

 /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 10075
Author:   rfrishbe@adobe.com
Date:     2009-09-09T01:01:58.077369Z

Log Message:
-----------
Cleanups from the spark text changes and some bug fixes for VideoElement.  Also some PARB changes for UIComponent.

TitleBar: Changing the skin part type from Label to Textbase

UIComponent: skipMeasure()->canSkipMeasurement() to be in line with GraphicElement.  This has been PARB approved.
UIComponent: same with hasComplexLayoutMatrix...this replaces hasDeltaIdentityTransform.  This has been PARB approved.

StyleProtoChain: cleanup around what interfaces to use

TextBase: clean up code that’s no longer needed.

VideoElement: Fixing 4 bugs:
SDK-22824: sourceLastPlayed keeps track of what video file we’ve called play() with last.  This way if a user pauses the video and wants to start it up again at the same point, we can call play(null) on the underlying FLVPlayback videoPlayer.  However, anytime the souce changes, we want to null out sourceLastPlayed.  This was causing a bug when someone set the source to null and then reset it to it’s previous value.

SDK-23034 (GUMBO_PRIORITY): This deals with some FLVPlayback quirks around sizing.  I had put in a fix so we weren’t setting width/height on the underlying videoPlayer too many times, but apparently we need to make sure it always gets called once.  Hopefully when switching to Strobe we can cleanup this logic...I put a FIXME in to do this.

SDK-21947/ SDK-22533 - some video files don’t always send out a metadata event.  I’m not quite sure why this is, but in case this happens, we do a check in the ready handler to see whether we should call invalidateSize() to make sure it gets sized properly.

QE notes:-
Doc notes:-
Bugs: SDK-22824, SDK-23034, SDK-21947, SDK-22533
Reviewer: Glenn, Corey
Tests run: checkintests, Button, GraphicTags, VideoElement, and VideoPlayer (some VideoPlayer were failing, but I think it should be fine)
Is noteworthy for integration: Yes

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/supportClasses/GraphicElement.as</path>
<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/Group.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Skin.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/supportClasses/AddActionInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/mx/core/UITLFTextField.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/airframework/src/spark/components/windowClasses/TitleBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/supportClasses/RemoveActionInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleProtoChain.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/TextBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Label.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/supportClasses/AnimateTransformInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.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/primitives/VideoElement.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as
@@ -782,10 +782,10 @@
     /**
      *  @private
      */
-    override protected function skipMeasure():Boolean
+    override protected function canSkipMeasurement():Boolean
     {
         // We never want to skip measure, if we resize by scaling
-        return _resizeMode == ResizeMode.SCALE ? false : super.skipMeasure();
+        return _resizeMode == ResizeMode.SCALE ? false : super.canSkipMeasurement();
     }

     /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 2805
Author:   chaase@adobe.com
Date:     2008-08-11T20:37:18.700675Z

Log Message:
-----------
First checkin for the "Arbitrary Type Interpolation" feature. This feature has a rewritten Tween class (now named flex.effects.Animation). This class supports the old Tween capabilities, but adds functionality such as the ability to supply alternate interpolation objects (to allow animation of non-Number types), a new Easing API, and new 'repeat behavior' that will allow terser looping or reversing animations. The existing new effects were slightly changed to use the new Animation class (instead of Tween), and the superclass of the new effects, AnimateProperties (renamed 'Animate'), is now a subclass of Effect (not TweenEffect).

Added various new interpolation and easing classes, along with the new packages flex.effects.interpolation and flex.effects.easing. Also added new color-interpolation effect, 'Tint'.

Expect slight tweaks to the API during i7, but the bulk of the functionality and API changes are being checked in now.

Reviewed by Jason S.
Testing: checkintests & mustella tests/Effects (passed)

Modified Paths:
--------------
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/Animation.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/easing/Linear.as</path>
<path kind="file" action="M">/flex/sdk/trunk/development/eclipse/flex/flex4test/.actionScriptProperties</path>
<path kind="file" action="A">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/EffectsProperties.mxml</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/interpolation</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/mxml-2009-manifest.xml</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/effectClasses/AnimatePropertiesInstance.as</path>
<path kind="file" action="D">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/AnimateProperties.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/gumbo-manifest.xml</path>
<path kind="file" action="A">/flex/sdk/trunk/development/eclipse/flex/flex4test/src/components/AnimationPropertiesForm.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/Effect.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/effectClasses/FadeInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/Fade.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/easing/Constant.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/easing/Power.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/interpolation/ColorInterpolator.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/effectClasses/AnimateInstance.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/effectClasses/TintInstance.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/easing/IEaser.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/Tint.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/Animate.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/interpolation/NumberArrayInterpolator.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/EffectInstance.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/interpolation/IInterpolator.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/interpolation/NumberInterpolator.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/IAnimationTarget.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/effectClasses/ResizeInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/Resize.as</path>
<path kind="dir" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/easing</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/easing/Sine.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/effectClasses/MoveInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/Move.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/events/AnimationEvent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/interpolation/ArrayInterpolator.as</path>

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

--- frameworks/projects/spark/src/spark/effects/interpolation/IInterpolator.as
+++ frameworks/projects/spark/src/spark/effects/interpolation/IInterpolator.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 flex.effects.interpolation
+{
+/**
+ * The Interpolator interface is used by classes that calculate
+ * intermediate values for the Animation class. The Animation class
+ * can handle parametric interpolation between Number values and
+ * arrays of Number values, but it cannot handle different types
+ * of interpolation, or interpolation between different types of
+ * values. Implementors of this interface can provide arbitrary
+ * interpolation capabilities so that Animations can be created between
+ * arbitrary values.
+ */
+public interface IInterpolator
+{
+    /**
+     * Returns the type that an implementor can handle
+     */
+    function get interpolatedType():Class;
+
+    /**
+     * Given an elapsed fraction of an animation between 0 and 1,
+     * and start and end values, this function returns some value
+     * based on whatever interpolation the implementor chooses to
+     * provide.
+     */
+    function interpolate(fraction:Number,
+        startValue:*, endValue:*):*;
+}
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 17233
Author:   klin@adobe.com
Date:     2010-08-09T20:10:26.973421Z

Log Message:
-----------
Fix some minor bugs in GridDimensions.

-Reset recently visited cache when setting rowCount as well as rowGap and columnGap.
-Fix getContentWidth/getContentHeight edge cases and also refactor it to be more readable.

QE notes: No
Doc notes: No
Bugs: None
Reviewer: Hans
Tests run: checkintests
Is noteworthy for integration: No

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

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

--- frameworks/projects/spark/src/spark/components/gridClasses/GridDimensions.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/GridDimensions.as
@@ -98,6 +98,12 @@
             return;

         _rowCount = value;
+
+        if (recentNode && recentNode.rowIndex >= _rowCount)
+            recentNode = null;
+        if (recentNode2 && recentNode2.rowIndex >= _rowCount)
+            recentNode2 = null;
+
         // FIXME (klin): remove a range of indices...
     }

@@ -155,32 +161,75 @@
                     typicalCellWidths.length = _columnCount;
                     typicalCellHeights.length = _columnCount;
                 }
-
             }
         }
+
+        // clear cache
+        recentNode = null;
+        recentNode2 = null;
     }

     //----------------------------------
     //  rowGap
     //----------------------------------
+
+    private var _rowGap:Number = 0;

     /**
      *  The gap between rows.
      *
      *  @default 0
      */
-    public var rowGap:Number = 0;
+    public function get rowGap():Number
+    {
+        return _rowGap;
+    }
+
+    /**
+     *  @private
+     */
+    public function set rowGap(value:Number):void
+    {
+        if (value == _rowGap)
+            return;
+
+        _rowGap = value;
+
+        // reset recent node.
+        recentNode = null;
+        recentNode2 = null;
+    }

     //----------------------------------
     //  columnGap
     //----------------------------------
-
-    /**
-     *  The gap between columns.
-     *
+
+    private var _columnGap:Number = 0;
+
+    /**
+     *  The gap between columns.
+     *
      *  @default 0
      */
-    public var columnGap:Number = 0;
+    public function get columnGap():Number
+    {
+        return _columnGap;
+    }
+
+    /**
+     *  @private
+     */
+    public function set columnGap(value:Number):void
+    {
+        if (value == _columnGap)
+            return;
+
+        _columnGap = value;
+
+        // reset recent node.
+        recentNode = null;
+        recentNode2 = null;
+    }

     //----------------------------------
     //  defaultRowHeight
@@ -562,7 +611,8 @@

             // subtract previous node's height and its gap.
             indDiff = node.rowIndex - prevNode.rowIndex - 1;
-            nodeY = currentY = currentY - indDiff * (defaultRowHeight + rowGap) - (prevNode.maxCellHeight + rowGap);
+            currentY = currentY - indDiff * (defaultRowHeight + rowGap) - (prevNode.maxCellHeight + rowGap);
+            nodeY = currentY;
             node = prevNode;
         }

@@ -613,7 +663,8 @@

             // add next node's maxCellHeight and rowGap
             indDiff = nextNode.rowIndex - node.rowIndex - 1;
-            nodeY = currentY = currentY + indDiff * (defaultRowHeight + rowGap);
+            currentY = currentY + indDiff * (defaultRowHeight + rowGap);
+            nodeY = currentY;
             node = nextNode;
         }

@@ -902,11 +953,14 @@
     public function getContentWidth(columnCountOverride:int = -1):Number
     {
 		const nCols:int = (columnCountOverride == -1) ? columnCount : columnCountOverride;
-
+        var contentWidth:Number = 0;
+
+        if (nCols > 1)
+            contentWidth += (nCols - 1) * columnGap;
+
+        // short circuit for no column widths set yet.
         if (!_columnWidths)
-            return (nCols * (defaultColumnWidth + columnGap)) - columnGap;
-
-        var contentWidth:Number = 0;
+            return contentWidth + nCols * defaultColumnWidth;

         for (var i:int = 0; i < nCols; i++)
         {
@@ -916,9 +970,6 @@
                 contentWidth += _columnWidths[i];
         }

-        if (nCols > 1)
-            contentWidth += (nCols - 1) * columnGap;
-
         return contentWidth;
     }

@@ -930,27 +981,28 @@
     public function getContentHeight(rowCountOverride:int = -1):Number
     {
 		const nRows:int = (rowCountOverride == -1) ? rowCount : rowCountOverride;
-
+		var contentHeight:Number = 0;
+
+        if (nRows > 1)
+            contentHeight += (nRows - 1) * rowGap;
+
         if (!isNaN(fixedRowHeight))
-            return (nRows * (fixedRowHeight + rowGap)) - rowGap;
+            return contentHeight + nRows * fixedRowHeight;

         if (rowList.length == 0)
-            return (nRows * (defaultRowHeight + rowGap)) - rowGap;
-
-        var height:Number = 0;
+            return contentHeight + nRows * defaultRowHeight;
+
         var node:GridRowNode = rowList.first;
         var numRows:int = 0;

         while (node && node.rowIndex < nRows)
         {
-            height += node.maxCellHeight;
+            contentHeight += node.maxCellHeight;
             numRows++;
             node = node.next;
         }
-
-        var contentHeight:Number = height + (nRows - numRows) * defaultRowHeight;
-        if (nRows > 1)
-            contentHeight += (nRows - 1) * rowGap;
+
+        contentHeight += (nRows - numRows) * defaultRowHeight;

         return contentHeight;
     }


Transferred from the Adobe Open Source Subversion Repository

Revision: 20931
Author:   cframpto@adobe.com
Date:     2011-03-21T14:21:57.979092Z

Log Message:
-----------
ASdoc changes that missed Flex 4.5 - mostly the mxml syntax sections for the new DataGrid and Image components but also some other errors I noticed in various classes.

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DataGrid.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Label.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Image.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/SkinnableDataContainer.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/NumericStepper.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Scroller.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/gridClasses/GridColumn.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/GridColumnHeaderGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/SkinnableContainer.as</path>

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

--- frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as
@@ -41,6 +41,21 @@
  *  Set the item editor for a column by using
  *  the GridColumn.itemEditor property.

  *
+ *  @mxml
The <s:GridItemEditor> tag inherits all of the tag
+ *  attributes of its superclass and adds the following tag attributes:

+ *
+ *

+ *  <s:GridItemEditor
+ *    Properties
+ *    column="null"
+ *    data="null"
+ *    imeMode="null"
+ *    itemRenderer="null"
+ *    rowIndex="0"
+ *    value="null"
+ *  />
+ *

+ *
  *  @see spark.components.DataGrid
  *  @see spark.components.Grid
  *  @see spark.components.gridClasses.GridColumn
@@ -91,6 +106,8 @@
     /**
      *  @inheritDoc
      *
+     *  @default null
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.5
@@ -135,6 +152,8 @@
     /**
      *  @inheritDoc
      *
+     *  @default null
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.5
@@ -262,6 +281,8 @@
     /**
      *  The item renderer associated with the edited cell.
      *
+     *  @default null
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.5
@@ -292,6 +313,8 @@
     /**
      *  @inheritDoc
      *
+     *  @default 0
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.5
@@ -335,6 +358,8 @@
      *  Override the setter method to initialize the editor based on the cell value.
      *  Override the getter method  to return a new cell value to
      *  the save() method.

+     *
+     *  @default null
      *
      *  @langversion 3.0
      *  @playerversion Flash 10


Transferred from the Adobe Open Source Subversion Repository

Revision: 22294
Author:   jszeto@adobe.com
Date:     2011-08-30T21:22:59.162418Z

Log Message:
-----------
SpinnerList bug fixes

SDK-31384 - SpinnerListContainer has a tiny minWidth

Set minWidth to 30

SDK-31382 - SpinnerList should suppress chromeColor and accentColor code hinting since it isn't supported

Added exclude metadata

SDK-31315 - SpinnerList behaviour erratic when selecting items by 'click'

We floor the calculation for the first visible row

SDK-31387 - SpinnerList w/ fixed height doesn't show bottom row

Changed logic in VerticalSpinnerLayout to calculate the max y position using the bottom of the top row, instead of its top.

QE notes: none
Doc notes: none
Bugs: listed above
Reviewer: Tom K, Hans, Eric Day
Tests run: checkintests
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/SpinnerListSkin.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/tests/airMobileBasicTests/src/mobile/scripts/SpinnerListTestScript.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/tests/airMobileBasicTests/src/airMobileBasicTests-config.xml</path>
<path kind="file" action="A">/private/flex/sdk/branches/4.y/frameworks/tests/airMobileBasicTests/src/mobile/views/TestSpinnerList.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobiletheme/src/spark/skins/mobile/SpinnerListContainerSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/spark/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/components/SpinnerList.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/4.y/frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as</path>

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

--- frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as
+++ frameworks/projects/mobilecomponents/src/spark/layouts/VerticalSpinnerLayout.as
@@ -182,7 +182,7 @@
         var foundLastVisibleElement:Boolean = false;
         var numVisibleElements:int = 0;
         var numVisitedElements:int = 0;
-
+
         // Translate the vsp to the item index
         if (!wrapElements)
         {
@@ -195,7 +195,7 @@
         yPos = itemIndex * rowHeight + yOffset;

         // Calculate the y position of the bottom of the viewable area
-        yPosMax = yPos + height;
+        yPosMax = yPos + rowHeight + height;

         // Normalize the itemIndex
         if (wrapElements)
@@ -443,7 +443,7 @@
 			var wrapCount:int = Math.floor(verticalScrollPosition / totalHeight);
 			index += wrapCount * target.numElements;

-			var firstVisibleItem:int = (verticalScrollPosition ) / rowHeight;
+			var firstVisibleItem:int = Math.floor((verticalScrollPosition ) / rowHeight);
 			if (index < firstVisibleItem)
 				index += target.numElements;
 		}


Transferred from the Adobe Open Source Subversion Repository

Revision: 20032
Author:   smgilson@adobe.com
Date:     2011-02-01T15:47:30.269415Z

Log Message:
-----------
Minor ASDoc edits

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

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/GridColumn.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/IGridItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/IGridVisualElement.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/ComboBoxGridItemEditor.mxml</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/GridSelectionMode.as</path>

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

--- frameworks/projects/spark/src/spark/components/gridClasses/IGridItemRenderer.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/IGridItemRenderer.as
@@ -66,9 +66,10 @@
     function set rowIndex(value:int):void;

     /**
-     *  This property is set to true when one of two input gestures occurs within a
-     *  grid cell:  either the mouse button or the touch screen is pressed.   The down
-     *  property is reset to false when the mouse button goes up, the user lifts off
+     *  This property is set to true when one of two input gestures occurs within a
+     *  grid cell:  either the mouse button or the touch screen is pressed.
+     *  The down property is reset to false when
+     *  the mouse button goes up, the user lifts off
      *  the touch screen, or the mouse/touch is dragged out of the grid cell.
      *
      *
Unlike a List item renderer, grid item renderers do not have exclusive
@@ -121,7 +122,7 @@
     function set hovered(value:Boolean):void;

     /**
-     *  The string to display in the item renderer.
+     *  The String to display in the item renderer.
      *
      *
The GridItemRenderer class automatically copies the
      *  value of this property to the text property