Falcon caught a duplicate variable

Falcon caught a duplicate variable

--- frameworks/projects/apache/src/org/apache/flex/collections/ArrayList.as
+++ frameworks/projects/apache/src/org/apache/flex/collections/ArrayList.as
@@ -1,839 +1,839 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package org.apache.flex.collections
-{
-
-import flash.events.EventDispatcher;
-import flash.events.IEventDispatcher;
-import flash.utils.IDataInput;
-import flash.utils.IDataOutput;
-import flash.utils.IExternalizable;
-import flash.utils.getQualifiedClassName;
-
-import mx.collections.ICollectionView;
-import mx.collections.IList;
-import mx.core.IPropertyChangeNotifier;
-import mx.events.CollectionEvent;
-import mx.events.CollectionEventKind;
-import mx.events.PropertyChangeEvent;
-import mx.events.PropertyChangeEventKind;
-import mx.resources.IResourceManager;
-import mx.resources.ResourceManager;
-import mx.utils.ArrayUtil;
-import mx.utils.UIDUtil;
-
-//--------------------------------------
-//  Events
-//--------------------------------------
-
-/**
- *  Dispatched when the IList has been updated in some way.
- *
- *  @eventType mx.events.CollectionEvent.COLLECTION_CHANGE
- *
- *  @langversion 3.0
- *  @playerversion Flash 9
- *  @playerversion AIR 1.1
- *  @productversion Flex 3
- */
-[Event(name="collectionChange", type="mx.events.CollectionEvent")]
-
-//--------------------------------------
-//  Other metadata
-//--------------------------------------
-
-[RemoteClass(alias="flex.messaging.io.ArrayList")]
-
-[ResourceBundle("collections")]
-
-[DefaultProperty("source")]
-
-/**
- *  The ArrayList class is a simple implementation of IList
- *  that uses a backing Array as the source of the data.
- *
- *  Items in the backing Array can be accessed and manipulated
- *  using the methods and properties of the IList
- *  interface. Operations on an ArrayList instance modify the
- *  data source; for example, if you use the removeItemAt()
- *  method on an ArrayList, you remove the item from the underlying
- *  Array.
- *
- *  This base class will not throw ItemPendingErrors but it
- *  is possible that a subclass might.
- *
- *

- *  <mx:ArrayList
- *  Properties
- *  source="null"
- *  />
- *

- *
- *  @langversion 3.0
- *  @playerversion Flash 10
- *  @playerversion AIR 1.5
- *  @productversion Flex 4
- */
-public class ArrayList extends EventDispatcher
-       implements IList, IExternalizable, IPropertyChangeNotifier
-{
-    //include "../core/Version.as";
-
-    //--------------------------------------------------------------------------
-    //
-    // Constructor
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  Construct a new ArrayList using the specified array as its source.
-     *  If no source is specified an empty array will be used.
-     *
-     *  @param source The Array to use as a source for the ArrayList.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function ArrayList(source:Array = null)
-    {
-        super();
-
-        disableEvents();
-        this.source = source;
-        enableEvents();
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    // Variables
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     *  Used for accessing localized Error messages.
-     */
-    private var resourceManager:IResourceManager =
-        ResourceManager.getInstance();
-
-    /**
-     *  @private
-     *  Indicates if events should be dispatched.
-     *  calls to enableEvents() and disableEvents() effect the value when == 0
-     *  events should be dispatched.
-     */
-    private var _dispatchEvents:int = 0;
-
-    //--------------------------------------------------------------------------
-    //
-    // Properties
-    //
-    //--------------------------------------------------------------------------
-
-    //----------------------------------
-    // length
-    //----------------------------------
-
-    [Bindable("collectionChange")]
-
-    /**
-     *  Get the number of items in the list.  An ArrayList should always
-     *  know its length so it shouldn't return -1, though a subclass may
-     *  override that behavior.
-     *
-     *  @return int representing the length of the source.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get length():int
-    {
-        if (source)
-            return source.length;
-        else
-            return 0;
-    }
-
-    //----------------------------------
-    // source
-    //----------------------------------
-
-    /**
-     *  @private
-     *  Storage for the source Array.
-     */
-    private var _source:Array;
-
-    /**
-     *  The source array for this ArrayList.
-     *  Any changes done through the IList interface will be reflected in the
-     *  source array.
-     *  If no source array was supplied the ArrayList will create one internally.
-     *  Changes made directly to the underlying Array (e.g., calling
-     *  theList.source.pop() will not cause CollectionEvents
-     *  to be dispatched.
-     *
-     *  @return An Array that represents the underlying source.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get source():Array
-    {
-        return _source;
-    }
-
-    public function set source(s:Array):void
-    {
-        var i:int;
-        var len:int;
-        if (_source && _source.length)
-        {
-            len = _source.length;
-            for (i = 0; i < len; i++)
-            {
-                stopTrackUpdates(_source[i]);
-            }
-        }
-        _source  = s ? s : [];
-        len = _source.length;
-        for (i = 0; i < len; i++)
-        {
-            startTrackUpdates(_source[i]);
-        }
-
-        if (_dispatchEvents == 0)
-        {
-           var event:CollectionEvent =
-            new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
-           event.kind = CollectionEventKind.RESET;
-           dispatchEvent(event);
-        }
-    }
-
-    //----------------------------------
-    // uid -- mx.core.IPropertyChangeNotifier
-    //----------------------------------
-
-    /**
-     *  @private
-     *  Storage for the UID String.
-     */
-    private var _uid:String;
-
-    /**
-     *  Provides access to the unique id for this list.
-     *
-     *  @return String representing the internal uid.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function get uid():String
-    {
-		if (!_uid) {
-			_uid = UIDUtil.createUID();
-		}
-        return _uid;
-    }
-
-    public function set uid(value:String):void
-    {
-        _uid = value;
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    // Methods
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  Get the item at the specified index.
-     *
-     *  @param  index the index in the list from which to retrieve the item
-     *  @param  prefetch int indicating both the direction and amount of items
-     *          to fetch during the request should the item not be local.
-     *  @return the item at that index, null if there is none
-     *  @throws ItemPendingError if the data for that index needs to be
-     *                           loaded from a remote location
-     *  @throws RangeError if the index < 0 or index >= length
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function getItemAt(index:int, prefetch:int = 0):Object
-    {
-        if (index < 0 || index >= length)
-        {
-            var message:String = resourceManager.getString(
-                "collections", "outOfBounds", [ index ]);
-            throw new RangeError(message);
-        }
-
-        return source[index];
-    }
-
-    /**
-     *  Place the item at the specified index.
-     *  If an item was already at that index the new item will replace it and it
-     *  will be returned.
-     *
-     *  @param  item the new value for the index
-     *  @param  index the index at which to place the item
-     *  @return the item that was replaced, null if none
-     *  @throws RangeError if index is less than 0 or greater than or equal to length
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function setItemAt(item:Object, index:int):Object
-    {
-        if (index < 0 || index >= length)
-        {
-            var message:String = resourceManager.getString(
-                "collections", "outOfBounds", [ index ]);
-            throw new RangeError(message);
-        }
-
-        var oldItem:Object = source[index];
-        source[index] = item;
-        stopTrackUpdates(oldItem);
-        startTrackUpdates(item);
-
-        //dispatch the appropriate events
-        if (_dispatchEvents == 0)
-        {
-            var hasCollectionListener:Boolean =
-                hasEventListener(CollectionEvent.COLLECTION_CHANGE);
-            var hasPropertyListener:Boolean =
-                hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
-            var updateInfo:PropertyChangeEvent;
-
-            if (hasCollectionListener || hasPropertyListener)
-            {
-                updateInfo = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
-                updateInfo.kind = PropertyChangeEventKind.UPDATE;
-                updateInfo.oldValue = oldItem;
-                updateInfo.newValue = item;
-                updateInfo.property = index;
-            }
-
-            if (hasCollectionListener)
-            {
-                var event:CollectionEvent =
-                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
-                event.kind = CollectionEventKind.REPLACE;
-                event.location = index;
-                event.items.push(updateInfo);
-                dispatchEvent(event);
-            }
-
-            if (hasPropertyListener)
-            {
-                dispatchEvent(updateInfo);
-            }
-        }
-        return oldItem;
-    }
-
-    /**
-     *  Add the specified item to the end of the list.
-     *  Equivalent to addItemAt(item, length);
-     *
-     *  @param item the item to add
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function addItem(item:Object):void
-    {
-        addItemAt(item, length);
-    }
-
-    /**
-     *  Add the item at the specified index.
-     *  Any item that was after this index is moved out by one.
-     *
-     *  @param item the item to place at the index
-     *  @param index the index at which to place the item
-     *  @throws RangeError if index is less than 0 or greater than the length
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function addItemAt(item:Object, index:int):void
-    {
-        const spliceUpperBound:int = length;
-
-        if (index < spliceUpperBound && index > 0)
-        {
-            source.splice(index, 0, item);
-        }
-        else if (index == spliceUpperBound)
-        {
-            source.push(item);
-        }
-        else if (index == 0)
-        {
-            source.unshift(item);
-        }
-        else
-        {
-            var message:String = resourceManager.getString(
-                "collections", "outOfBounds", [ index ]);
-            throw new RangeError(message);
-        }
-
-        startTrackUpdates(item);
-        internalDispatchEvent(CollectionEventKind.ADD, item, index);
-    }
-
-    /**
-     *  @copy mx.collections.ListCollectionView#addAll()
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function addAll(addList:IList):void
-    {
-        addAllAt(addList, length);
-    }
-
-    /**
-     *  @copy mx.collections.ListCollectionView#addAllAt()
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function addAllAt(addList:IList, index:int):void
-    {
-        var length:int = addList.length;
-        for (var i:int = 0; i < length; i++)
-        {
-            this.addItemAt(addList.getItemAt(i), i+index);
-        }
-    }
-
-    /**
-     *  Return the index of the item if it is in the list such that
-     *  getItemAt(index) == item.
-     *  Note that in this implementation the search is linear and is therefore
-     *  O(n).
-     *
-     *  @param item the item to find
-     *  @return the index of the item, -1 if the item is not in the list.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function getItemIndex(item:Object):int
-    {
-        return ArrayUtil.getItemIndex(item, source);
-    }
-
-    /**
-     *  Removes the specified item from this list, should it exist.
-     *
-     *  @param  item Object reference to the item that should be removed.
-     *  @return Boolean indicating if the item was removed.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function removeItem(item:Object):Boolean
-    {
-        var index:int = getItemIndex(item);
-        var result:Boolean = index >= 0;
-        if (result)
-            removeItemAt(index);
-
-        return result;
-    }
-
-    /**
-     *  Remove the item at the specified index and return it.
-     *  Any items that were after this index are now one index earlier.
-     *
-     *  @param index The index from which to remove the item.
-     *  @return The item that was removed.
-     *  @throws RangeError if index < 0 or index >= length.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function removeItemAt(index:int):Object
-    {
-        const spliceUpperBound:int = length - 1;
-        var removed:Object;
-
-        if (index > 0 && index < spliceUpperBound)
-        {
-            removed = source.splice(index, 1)[0];
-        }
-        else if (index == spliceUpperBound)
-        {
-            removed = source.pop();
-        }
-        else if (index == 0)
-        {
-            removed = source.shift();
-        }
-        else
-        {
-            var message:String = resourceManager.getString(
-                "collections", "outOfBounds", [ index ]);
-            throw new RangeError(message);
-        }
-
-        var removed:Object = source.splice(index, 1)[0];
-        stopTrackUpdates(removed);
-        internalDispatchEvent(CollectionEventKind.REMOVE, removed, index);
-        return removed;
-    }
-
-    /**
-     *  Remove all items from the list.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function removeAll():void
-    {
-        if (length > 0)
-        {
-            var len:int = length;
-            for (var i:int = 0; i < len; i++)
-            {
-                stopTrackUpdates(source[i]);
-            }
-
-            source.splice(0, length);
-            internalDispatchEvent(CollectionEventKind.RESET);
-        }
-    }
-
-    /**
-     *  Notify the view that an item has been updated.
-     *  This is useful if the contents of the view do not implement
-     *  IEventDispatcher.
-     *  If a property is specified the view may be able to optimize its
-     *  notification mechanism.
-     *  Otherwise it may choose to simply refresh the whole view.
-     *
-     *  @param item The item within the view that was updated.
-     *
-     *  @param property A String, QName, or int
-     *  specifying the property that was updated.
-     *
-     *  @param oldValue The old value of that property.
-     *  (If property was null, this can be the old value of the item.)
-     *
-     *  @param newValue The new value of that property.
-     *  (If property was null, there's no need to specify this
-     *  as the item is assumed to be the new value.)
-     *
-     *  @see mx.events.CollectionEvent
-     *  @see mx.core.IPropertyChangeNotifier
-     *  @see mx.events.PropertyChangeEvent
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-     public function itemUpdated(item:Object, property:Object = null,
-                                 oldValue:Object = null,
-                                 newValue:Object = null):void
-    {
-        var event:PropertyChangeEvent =
-            new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
-
-        event.kind = PropertyChangeEventKind.UPDATE;
-        event.source = item;
-        event.property = property;
-        event.oldValue = oldValue;
-        event.newValue = newValue;
-
-		//This handler was intended to handle events from child objects, not to be called directly
-		//itemUpdateHandler(event);
-
-		internalDispatchEvent(CollectionEventKind.UPDATE, event);
-
-		// need to dispatch object event now
-		if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
-		{
-			dispatchPropertyChangeEventClone( event, item );
-		}
-    }
-
-    /**
-     *  Return an Array that is populated in the same order as the IList
-     *  implementation.
-     *
-     *  @return An Array populated in the same order as the IList
-     *  implementation.
-     *
-     *  @throws ItemPendingError if the data is not yet completely loaded
-     *  from a remote location
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    public function toArray():Array
-    {
-        return source.concat();
-    }
-
-    /**
-     *  Ensures that only the source property is seralized.
-     *  @private
-     */
-    public function readExternal(input:IDataInput):void
-    {
-        source = input.readObject();
-    }
-
-    /**
-     *  Ensures that only the source property is serialized.
-     *  @private
-     */
-    public function writeExternal(output:IDataOutput):void
-    {
-        output.writeObject(_source);
-    }
-
-    /**
-     *  Pretty prints the contents of this ArrayList to a string and returns it.
-     *
-     *  @return A String containing the contents of the ArrayList.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    override public function toString():String
-    {
-        if (source)
-            return source.toString();
-        else
-            return getQualifiedClassName(this);
-    }
-
-    //--------------------------------------------------------------------------
-    //
-    // Internal Methods
-    //
-    //--------------------------------------------------------------------------
-
-	/**
-	 *  Dispatches a PropertyChangeEvent clone either from a child object whose event needs to be redispatched
-	 *  or when a PropertyChangeEvent is faked inside of this class for the purposes of informing the view
-	 *  of an update to underlying data.
-	 *
-	 *  @param event The PropertyChangeEvent to be cloned and dispatched
-	 *  @param item The item within the view that was updated.
-	 *
-	 *  @see mx.core.IPropertyChangeNotifier
-	 *  @see mx.events.PropertyChangeEvent
-	 */
-
-	private function dispatchPropertyChangeEventClone( event:PropertyChangeEvent, item:Object ):void {
-		var objEvent:PropertyChangeEvent = PropertyChangeEvent(event.clone());
-
-		var index:int = getItemIndex( item );
-		objEvent.property = index.toString() + "." + event.property;
-		dispatchEvent(objEvent);
-	}
-
-    /**
-     *  Enables event dispatch for this list.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    private function enableEvents():void
-    {
-        _dispatchEvents++;
-        if (_dispatchEvents > 0)
-            _dispatchEvents = 0;
-    }
-
-    /**
-     *  Disables event dispatch for this list.
-     *  To re-enable events call enableEvents(), enableEvents() must be called
-     *  a matching number of times as disableEvents().
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    private function disableEvents():void
-    {
-        _dispatchEvents--;
-    }
-
-    /**
-     *  Dispatches a collection event with the specified information.
-     *
-     *  @param kind String indicates what the kind property of the event should be
-     *  @param item Object reference to the item that was added or removed
-     *  @param location int indicating where in the source the item was added.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    private function internalDispatchEvent(kind:String, item:Object = null, location:int = -1):void
-    {
-        if (_dispatchEvents == 0)
-        {
-            if (hasEventListener(CollectionEvent.COLLECTION_CHANGE))
-            {
-                var event:CollectionEvent =
-                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
-                event.kind = kind;
-                event.items.push(item);
-                event.location = location;
-                dispatchEvent(event);
-            }
-
-            // now dispatch a complementary PropertyChangeEvent
-            if (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE) &&
-               (kind == CollectionEventKind.ADD || kind == CollectionEventKind.REMOVE))
-            {
-                var objEvent:PropertyChangeEvent =
-                    new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
-                objEvent.property = location;
-                if (kind == CollectionEventKind.ADD)
-                    objEvent.newValue = item;
-                else
-                    objEvent.oldValue = item;
-                dispatchEvent(objEvent);
-            }
-        }
-    }
-
-    /**
-     *  Called when any of the contained items in the list dispatch an
-     *  ObjectChange event.
-     *  Wraps it in a CollectionEventKind.UPDATE object.
-     *
-     *  @param event The event object for the ObjectChange event.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    protected function itemUpdateHandler(event:PropertyChangeEvent):void
-    {
-        internalDispatchEvent(CollectionEventKind.UPDATE, event);
-
-		// need to dispatch object event now
-		if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
-		{
-			dispatchPropertyChangeEventClone( event, event.target );
-		}
-    }
-
-    /**
-     *  If the item is an IEventDispatcher, watch it for updates.
-     *  This method is called by the addItemAt() method,
-     *  and when the source is initially assigned.
-     *
-     *  @param item The item passed to the addItemAt() method.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    protected function startTrackUpdates(item:Object):void
-    {
-        if (item && (item is IEventDispatcher))
-        {
-            IEventDispatcher(item).addEventListener(
-                                        PropertyChangeEvent.PROPERTY_CHANGE,
-                                        itemUpdateHandler, false, 0, true);
-        }
-    }
-
-    /**
-     *  If the item is an IEventDispatcher, stop watching it for updates.
-     *  This method is called by the removeItemAt() and
-     *  removeAll() methods, and before a new
-     *  source is assigned.
-     *
-     *  @param item The item passed to the removeItemAt() method.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 9
-     *  @playerversion AIR 1.1
-     *  @productversion Flex 3
-     */
-    protected function stopTrackUpdates(item:Object):void
-    {
-        if (item && item is IEventDispatcher)
-        {
-            IEventDispatcher(item).removeEventListener(
-                                        PropertyChangeEvent.PROPERTY_CHANGE,
-                                        itemUpdateHandler);
-        }
-    }
-
-}
-
-}
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.collections
+{
+
+import flash.events.EventDispatcher;
+import flash.events.IEventDispatcher;
+import flash.utils.IDataInput;
+import flash.utils.IDataOutput;
+import flash.utils.IExternalizable;
+import flash.utils.getQualifiedClassName;
+
+import mx.collections.ICollectionView;
+import mx.collections.IList;
+import mx.core.IPropertyChangeNotifier;
+import mx.events.CollectionEvent;
+import mx.events.CollectionEventKind;
+import mx.events.PropertyChangeEvent;
+import mx.events.PropertyChangeEventKind;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+import mx.utils.ArrayUtil;
+import mx.utils.UIDUtil;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the IList has been updated in some way.
+ *
+ *  @eventType mx.events.CollectionEvent.COLLECTION_CHANGE
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+[Event(name="collectionChange", type="mx.events.CollectionEvent")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+[RemoteClass(alias="flex.messaging.io.ArrayList")]
+
+[ResourceBundle("collections")]
+
+[DefaultProperty("source")]
+
+/**
+ *  The ArrayList class is a simple implementation of IList
+ *  that uses a backing Array as the source of the data.
+ *
+ *  Items in the backing Array can be accessed and manipulated
+ *  using the methods and properties of the IList
+ *  interface. Operations on an ArrayList instance modify the
+ *  data source; for example, if you use the removeItemAt()
+ *  method on an ArrayList, you remove the item from the underlying
+ *  Array.
+ *
+ *  This base class will not throw ItemPendingErrors but it
+ *  is possible that a subclass might.
+ *
+ *

+ *  <mx:ArrayList
+ *  Properties
+ *  source="null"
+ *  />
+ *

+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class ArrayList extends EventDispatcher
+       implements IList, IExternalizable, IPropertyChangeNotifier
+{
+    //include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Construct a new ArrayList using the specified array as its source.
+     *  If no source is specified an empty array will be used.
+     *
+     *  @param source The Array to use as a source for the ArrayList.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function ArrayList(source:Array = null)
+    {
+        super();
+
+        disableEvents();
+        this.source = source;
+        enableEvents();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Used for accessing localized Error messages.
+     */
+    private var resourceManager:IResourceManager =
+        ResourceManager.getInstance();
+
+    /**
+     *  @private
+     *  Indicates if events should be dispatched.
+     *  calls to enableEvents() and disableEvents() effect the value when == 0
+     *  events should be dispatched.
+     */
+    private var _dispatchEvents:int = 0;
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    // length
+    //----------------------------------
+
+    [Bindable("collectionChange")]
+
+    /**
+     *  Get the number of items in the list.  An ArrayList should always
+     *  know its length so it shouldn't return -1, though a subclass may
+     *  override that behavior.
+     *
+     *  @return int representing the length of the source.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get length():int
+    {
+        if (source)
+            return source.length;
+        else
+            return 0;
+    }
+
+    //----------------------------------
+    // source
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the source Array.
+     */
+    private var _source:Array;
+
+    /**
+     *  The source array for this ArrayList.
+     *  Any changes done through the IList interface will be reflected in the
+     *  source array.
+     *  If no source array was supplied the ArrayList will create one internally.
+     *  Changes made directly to the underlying Array (e.g., calling
+     *  theList.source.pop() will not cause CollectionEvents
+     *  to be dispatched.
+     *
+     *  @return An Array that represents the underlying source.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get source():Array
+    {
+        return _source;
+    }
+
+    public function set source(s:Array):void
+    {
+        var i:int;
+        var len:int;
+        if (_source && _source.length)
+        {
+            len = _source.length;
+            for (i = 0; i < len; i++)
+            {
+                stopTrackUpdates(_source[i]);
+            }
+        }
+        _source  = s ? s : [];
+        len = _source.length;
+        for (i = 0; i < len; i++)
+        {
+            startTrackUpdates(_source[i]);
+        }
+
+        if (_dispatchEvents == 0)
+        {
+           var event:CollectionEvent =
+            new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+           event.kind = CollectionEventKind.RESET;
+           dispatchEvent(event);
+        }
+    }
+
+    //----------------------------------
+    // uid -- mx.core.IPropertyChangeNotifier
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the UID String.
+     */
+    private var _uid:String;
+
+    /**
+     *  Provides access to the unique id for this list.
+     *
+     *  @return String representing the internal uid.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get uid():String
+    {
+		if (!_uid) {
+			_uid = UIDUtil.createUID();
+		}
+        return _uid;
+    }
+
+    public function set uid(value:String):void
+    {
+        _uid = value;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Get the item at the specified index.
+     *
+     *  @param  index the index in the list from which to retrieve the item
+     *  @param  prefetch int indicating both the direction and amount of items
+     *          to fetch during the request should the item not be local.
+     *  @return the item at that index, null if there is none
+     *  @throws ItemPendingError if the data for that index needs to be
+     *                           loaded from a remote location
+     *  @throws RangeError if the index < 0 or index >= length
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function getItemAt(index:int, prefetch:int = 0):Object
+    {
+        if (index < 0 || index >= length)
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+
+        return source[index];
+    }
+
+    /**
+     *  Place the item at the specified index.
+     *  If an item was already at that index the new item will replace it and it
+     *  will be returned.
+     *
+     *  @param  item the new value for the index
+     *  @param  index the index at which to place the item
+     *  @return the item that was replaced, null if none
+     *  @throws RangeError if index is less than 0 or greater than or equal to length
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function setItemAt(item:Object, index:int):Object
+    {
+        if (index < 0 || index >= length)
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+
+        var oldItem:Object = source[index];
+        source[index] = item;
+        stopTrackUpdates(oldItem);
+        startTrackUpdates(item);
+
+        //dispatch the appropriate events
+        if (_dispatchEvents == 0)
+        {
+            var hasCollectionListener:Boolean =
+                hasEventListener(CollectionEvent.COLLECTION_CHANGE);
+            var hasPropertyListener:Boolean =
+                hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
+            var updateInfo:PropertyChangeEvent;
+
+            if (hasCollectionListener || hasPropertyListener)
+            {
+                updateInfo = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+                updateInfo.kind = PropertyChangeEventKind.UPDATE;
+                updateInfo.oldValue = oldItem;
+                updateInfo.newValue = item;
+                updateInfo.property = index;
+            }
+
+            if (hasCollectionListener)
+            {
+                var event:CollectionEvent =
+                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+                event.kind = CollectionEventKind.REPLACE;
+                event.location = index;
+                event.items.push(updateInfo);
+                dispatchEvent(event);
+            }
+
+            if (hasPropertyListener)
+            {
+                dispatchEvent(updateInfo);
+            }
+        }
+        return oldItem;
+    }
+
+    /**
+     *  Add the specified item to the end of the list.
+     *  Equivalent to addItemAt(item, length);
+     *
+     *  @param item the item to add
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addItem(item:Object):void
+    {
+        addItemAt(item, length);
+    }
+
+    /**
+     *  Add the item at the specified index.
+     *  Any item that was after this index is moved out by one.
+     *
+     *  @param item the item to place at the index
+     *  @param index the index at which to place the item
+     *  @throws RangeError if index is less than 0 or greater than the length
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addItemAt(item:Object, index:int):void
+    {
+        const spliceUpperBound:int = length;
+
+        if (index < spliceUpperBound && index > 0)
+        {
+            source.splice(index, 0, item);
+        }
+        else if (index == spliceUpperBound)
+        {
+            source.push(item);
+        }
+        else if (index == 0)
+        {
+            source.unshift(item);
+        }
+        else
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+
+        startTrackUpdates(item);
+        internalDispatchEvent(CollectionEventKind.ADD, item, index);
+    }
+
+    /**
+     *  @copy mx.collections.ListCollectionView#addAll()
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addAll(addList:IList):void
+    {
+        addAllAt(addList, length);
+    }
+
+    /**
+     *  @copy mx.collections.ListCollectionView#addAllAt()
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addAllAt(addList:IList, index:int):void
+    {
+        var length:int = addList.length;
+        for (var i:int = 0; i < length; i++)
+        {
+            this.addItemAt(addList.getItemAt(i), i+index);
+        }
+    }
+
+    /**
+     *  Return the index of the item if it is in the list such that
+     *  getItemAt(index) == item.
+     *  Note that in this implementation the search is linear and is therefore
+     *  O(n).
+     *
+     *  @param item the item to find
+     *  @return the index of the item, -1 if the item is not in the list.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function getItemIndex(item:Object):int
+    {
+        return ArrayUtil.getItemIndex(item, source);
+    }
+
+    /**
+     *  Removes the specified item from this list, should it exist.
+     *
+     *  @param  item Object reference to the item that should be removed.
+     *  @return Boolean indicating if the item was removed.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeItem(item:Object):Boolean
+    {
+        var index:int = getItemIndex(item);
+        var result:Boolean = index >= 0;
+        if (result)
+            removeItemAt(index);
+
+        return result;
+    }
+
+    /**
+     *  Remove the item at the specified index and return it.
+     *  Any items that were after this index are now one index earlier.
+     *
+     *  @param index The index from which to remove the item.
+     *  @return The item that was removed.
+     *  @throws RangeError if index < 0 or index >= length.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeItemAt(index:int):Object
+    {
+        const spliceUpperBound:int = length - 1;
+        var removed:Object;
+
+        if (index > 0 && index < spliceUpperBound)
+        {
+            removed = source.splice(index, 1)[0];
+        }
+        else if (index == spliceUpperBound)
+        {
+            removed = source.pop();
+        }
+        else if (index == 0)
+        {
+            removed = source.shift();
+        }
+        else
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+
+        removed = source.splice(index, 1)[0];
+        stopTrackUpdates(removed);
+        internalDispatchEvent(CollectionEventKind.REMOVE, removed, index);
+        return removed;
+    }
+
+    /**
+     *  Remove all items from the list.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeAll():void
+    {
+        if (length > 0)
+        {
+            var len:int = length;
+            for (var i:int = 0; i < len; i++)
+            {
+                stopTrackUpdates(source[i]);
+            }
+
+            source.splice(0, length);
+            internalDispatchEvent(CollectionEventKind.RESET);
+        }
+    }
+
+    /**
+     *  Notify the view that an item has been updated.
+     *  This is useful if the contents of the view do not implement
+     *  IEventDispatcher.
+     *  If a property is specified the view may be able to optimize its
+     *  notification mechanism.
+     *  Otherwise it may choose to simply refresh the whole view.
+     *
+     *  @param item The item within the view that was updated.
+     *
+     *  @param property A String, QName, or int
+     *  specifying the property that was updated.
+     *
+     *  @param oldValue The old value of that property.
+     *  (If property was null, this can be the old value of the item.)
+     *
+     *  @param newValue The new value of that property.
+     *  (If property was null, there's no need to specify this
+     *  as the item is assumed to be the new value.)
+     *
+     *  @see mx.events.CollectionEvent
+     *  @see mx.core.IPropertyChangeNotifier
+     *  @see mx.events.PropertyChangeEvent
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+     public function itemUpdated(item:Object, property:Object = null,
+                                 oldValue:Object = null,
+                                 newValue:Object = null):void
+    {
+        var event:PropertyChangeEvent =
+            new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+
+        event.kind = PropertyChangeEventKind.UPDATE;
+        event.source = item;
+        event.property = property;
+        event.oldValue = oldValue;
+        event.newValue = newValue;
+
+		//This handler was intended to handle events from child objects, not to be called directly
+		//itemUpdateHandler(event);
+
+		internalDispatchEvent(CollectionEventKind.UPDATE, event);
+
+		// need to dispatch object event now
+		if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
+		{
+			dispatchPropertyChangeEventClone( event, item );
+		}
+    }
+
+    /**
+     *  Return an Array that is populated in the same order as the IList
+     *  implementation.
+     *
+     *  @return An Array populated in the same order as the IList
+     *  implementation.
+     *
+     *  @throws ItemPendingError if the data is not yet completely loaded
+     *  from a remote location
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function toArray():Array
+    {
+        return source.concat();
+    }
+
+    /**
+     *  Ensures that only the source property is seralized.
+     *  @private
+     */
+    public function readExternal(input:IDataInput):void
+    {
+        source = input.readObject();
+    }
+
+    /**
+     *  Ensures that only the source property is serialized.
+     *  @private
+     */
+    public function writeExternal(output:IDataOutput):void
+    {
+        output.writeObject(_source);
+    }
+
+    /**
+     *  Pretty prints the contents of this ArrayList to a string and returns it.
+     *
+     *  @return A String containing the contents of the ArrayList.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    override public function toString():String
+    {
+        if (source)
+            return source.toString();
+        else
+            return getQualifiedClassName(this);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Internal Methods
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  Dispatches a PropertyChangeEvent clone either from a child object whose event needs to be redispatched
+	 *  or when a PropertyChangeEvent is faked inside of this class for the purposes of informing the view
+	 *  of an update to underlying data.
+	 *
+	 *  @param event The PropertyChangeEvent to be cloned and dispatched
+	 *  @param item The item within the view that was updated.
+	 *
+	 *  @see mx.core.IPropertyChangeNotifier
+	 *  @see mx.events.PropertyChangeEvent
+	 */
+
+	private function dispatchPropertyChangeEventClone( event:PropertyChangeEvent, item:Object ):void {
+		var objEvent:PropertyChangeEvent = PropertyChangeEvent(event.clone());
+
+		var index:int = getItemIndex( item );
+		objEvent.property = index.toString() + "." + event.property;
+		dispatchEvent(objEvent);
+	}
+
+    /**
+     *  Enables event dispatch for this list.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function enableEvents():void
+    {
+        _dispatchEvents++;
+        if (_dispatchEvents > 0)
+            _dispatchEvents = 0;
+    }
+
+    /**
+     *  Disables event dispatch for this list.
+     *  To re-enable events call enableEvents(), enableEvents() must be called
+     *  a matching number of times as disableEvents().
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function disableEvents():void
+    {
+        _dispatchEvents--;
+    }
+
+    /**
+     *  Dispatches a collection event with the specified information.
+     *
+     *  @param kind String indicates what the kind property of the event should be
+     *  @param item Object reference to the item that was added or removed
+     *  @param location int indicating where in the source the item was added.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function internalDispatchEvent(kind:String, item:Object = null, location:int = -1):void
+    {
+        if (_dispatchEvents == 0)
+        {
+            if (hasEventListener(CollectionEvent.COLLECTION_CHANGE))
+            {
+                var event:CollectionEvent =
+                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+                event.kind = kind;
+                event.items.push(item);
+                event.location = location;
+                dispatchEvent(event);
+            }
+
+            // now dispatch a complementary PropertyChangeEvent
+            if (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE) &&
+               (kind == CollectionEventKind.ADD || kind == CollectionEventKind.REMOVE))
+            {
+                var objEvent:PropertyChangeEvent =
+                    new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+                objEvent.property = location;
+                if (kind == CollectionEventKind.ADD)
+                    objEvent.newValue = item;
+                else
+                    objEvent.oldValue = item;
+                dispatchEvent(objEvent);
+            }
+        }
+    }
+
+    /**
+     *  Called when any of the contained items in the list dispatch an
+     *  ObjectChange event.
+     *  Wraps it in a CollectionEventKind.UPDATE object.
+     *
+     *  @param event The event object for the ObjectChange event.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected function itemUpdateHandler(event:PropertyChangeEvent):void
+    {
+        internalDispatchEvent(CollectionEventKind.UPDATE, event);
+
+		// need to dispatch object event now
+		if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
+		{
+			dispatchPropertyChangeEventClone( event, event.target );
+		}
+    }
+
+    /**
+     *  If the item is an IEventDispatcher, watch it for updates.
+     *  This method is called by the addItemAt() method,
+     *  and when the source is initially assigned.
+     *
+     *  @param item The item passed to the addItemAt() method.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected function startTrackUpdates(item:Object):void
+    {
+        if (item && (item is IEventDispatcher))
+        {
+            IEventDispatcher(item).addEventListener(
+                                        PropertyChangeEvent.PROPERTY_CHANGE,
+                                        itemUpdateHandler, false, 0, true);
+        }
+    }
+
+    /**
+     *  If the item is an IEventDispatcher, stop watching it for updates.
+     *  This method is called by the removeItemAt() and
+     *  removeAll() methods, and before a new
+     *  source is assigned.
+     *
+     *  @param item The item passed to the removeItemAt() method.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected function stopTrackUpdates(item:Object):void
+    {
+        if (item && item is IEventDispatcher)
+        {
+            IEventDispatcher(item).removeEventListener(
+                                        PropertyChangeEvent.PROPERTY_CHANGE,
+                                        itemUpdateHandler);
+        }
+    }
+
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 8447
Author:   smgilson@adobe.com
Date:     2009-07-08T14:43:53.695916Z

Log Message:
-----------
Add ASDoc version info to IToggleButton.as and ITransientDeferredInstance.as.

Update ASDoc comments for IVisualElement.as and IVisualElementContainer.as

QE Notes: None
Doc Notes: None
Bugs: -
Checkintests: passed

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/IToggleButton.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/ITransientDeferredInstance.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/IVisualElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/IVisualElementContainer.as</path>

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

--- frameworks/projects/framework/src/mx/core/ITransientDeferredInstance.as
+++ frameworks/projects/framework/src/mx/core/ITransientDeferredInstance.as
@@ -28,6 +28,11 @@
  *
  *  @see mx.states.AddItems
  *  @see mx.core.IDeferredInstance
+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
  */
 public interface ITransientDeferredInstance extends IDeferredInstance
 {
@@ -40,6 +45,11 @@
     /**
      *  Resets the state of our factory to its initial state, clearing any
      *  references to the cached instance.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
      */
     function reset():void;
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 12878
Author:   jon.avila@ssbbartgroup.com
Date:     2009-12-12T03:07:40.798106Z

Log Message:
-----------
When sub-components don't have a tabIndex and when VideoPlayer instance does, assigned tabIndex to each inner-component to ensure that they appear in the correct tab order with other components on the stage.
QE notes: none
Doc notes: none
Bugs: n/a
Reviewer: Gordon
Tests run: checkintests
Is noteworthy for integration: no

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/VideoPlayerAccImpl.as

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

--- frameworks/projects/spark/src/spark/accessibility/VideoPlayerAccImpl.as
+++ frameworks/projects/spark/src/spark/accessibility/VideoPlayerAccImpl.as
@@ -31,8 +31,11 @@
 import spark.components.mediaClasses.VolumeBar;
 import spark.components.supportClasses.ToggleButtonBase;
 import spark.components.VideoPlayer;
+import spark.components.mediaClasses.ScrubBar;
+import spark.components.supportClasses.ButtonBase;
 import spark.events.SkinPartEvent;
 import spark.events.VideoEvent;
+

 use namespace mx_internal;

@@ -164,14 +167,33 @@
 		var playPauseButton:ToggleButtonBase =
 			VideoPlayer(master).playPauseButton;
 		if (playPauseButton)
+        {
 			playPauseButton.addEventListener(Event.CHANGE, eventHandler);
+            if (VideoPlayer(master).tabIndex > 0 &&
+               playPauseButton.tabIndex == -1)
+               playPauseButton.tabIndex = VideoPlayer(master).tabIndex;
+
+        }

 		var volumeBar:VolumeBar = VideoPlayer(master).volumeBar;
         if (volumeBar)
 		{
 			volumeBar.addEventListener(Event.CHANGE, eventHandler);
 			volumeBar.addEventListener(FlexEvent.MUTED_CHANGE, eventHandler);
+            if (VideoPlayer(master).tabIndex > 0 &&
+                volumeBar.tabIndex == -1)
+                volumeBar.tabIndex = VideoPlayer(master).tabIndex;
 		}
+
+        if (VideoPlayer(master).scrubBar)
+            if (VideoPlayer(master).tabIndex > 0 &&
+                VideoPlayer(master).scrubBar.tabIndex == -1)
+                VideoPlayer(master).scrubBar.tabIndex = VideoPlayer(master).tabIndex;
+
+        if (VideoPlayer(master).fullScreenButton)
+            if (VideoPlayer(master).tabIndex > 0 &&
+                VideoPlayer(master).fullScreenButton.tabIndex == -1)
+                VideoPlayer(master).fullScreenButton.tabIndex = VideoPlayer(master).tabIndex;
 	}

 	//--------------------------------------------------------------------------
@@ -279,7 +301,7 @@
 	 */
 	override public function get_accRole(childID:uint):uint
 	{
-	    var accRole:uint;
+	    var accRole:uint = AccConst.ROLE_SYSTEM_GRAPHIC;

 		switch (childID)
         {
@@ -291,36 +313,48 @@

 		    case VIDEOPLAYER_PLAYPAUSEBUTTON:
             {
+                if (!VideoPlayer(master).playPauseButton)
+                    break;
 			    accRole = AccConst.ROLE_SYSTEM_PUSHBUTTON;  // playPauseButton
 			    break;
     		}

     		case VIDEOPLAYER_SCRUBBAR:
             {
+                if (!VideoPlayer(master).scrubBar)
+                    break;
 			    accRole = AccConst.ROLE_SYSTEM_SLIDER;  // scrubBar
 			    break;
 		    }

 		    case VIDEOPLAYER_CURRENTTIMEDISPLAY:
             {
+                if (!VideoPlayer(master).currentTimeDisplay)
+                    break;
 			    accRole = AccConst.ROLE_SYSTEM_STATICTEXT; // currentTime
 			    break;
        		}

     		case VIDEOPLAYER_MUTEBUTTON:
             {
+                if (!VideoPlayer(master).volumeBar)
+                    break;
 			    accRole = AccConst.ROLE_SYSTEM_PUSHBUTTON;  // volumeBar
 			    break;
 		    }

 		    case VIDEOPLAYER_VOLUMEBAR:
             {
+                if (!VideoPlayer(master).volumeBar)
+                    break;
 			    accRole = AccConst.ROLE_SYSTEM_SLIDER;  // volumeBar
 			    break;
 		    }

 		    case VIDEOPLAYER_FULLSCREENBUTTON:
             {
+                if (!VideoPlayer(master).fullScreenButton)
+                    break;
 			    accRole = AccConst.ROLE_SYSTEM_PUSHBUTTON; // fullScreenButton
 			    break;
 		    }
@@ -363,19 +397,20 @@
             return accState;
         }

-        if (((!videoPlayer.playPauseButton) ||
+        if (((childID == VIDEOPLAYER_PLAYPAUSEBUTTON
+           && !videoPlayer.playPauseButton) ||
            (childID == VIDEOPLAYER_PLAYPAUSEBUTTON &&
            !videoPlayer.playPauseButton.enabled)) ||
-           ((!videoPlayer.scrubBar) || (childID == VIDEOPLAYER_SCRUBBAR &&
+           ((childID == VIDEOPLAYER_SCRUBBAR && !videoPlayer.scrubBar) || (childID == VIDEOPLAYER_SCRUBBAR &&
            !videoPlayer.scrubBar.enabled)) ||
-           ((!videoPlayer.currentTimeDisplay) ||
+           ((childID == VIDEOPLAYER_CURRENTTIMEDISPLAY && !videoPlayer.currentTimeDisplay) ||
            (childID == VIDEOPLAYER_CURRENTTIMEDISPLAY &&
            !videoPlayer.currentTimeDisplay.enabled)) ||
-           ((!videoPlayer.volumeBar) || (childID == VIDEOPLAYER_MUTEBUTTON &&
+           ((childID == VIDEOPLAYER_MUTEBUTTON && !videoPlayer.volumeBar) || (childID == VIDEOPLAYER_MUTEBUTTON &&
            !videoPlayer.volumeBar.enabled)) ||
-           ((!videoPlayer.volumeBar) || (childID == VIDEOPLAYER_VOLUMEBAR &&
+           ((childID == VIDEOPLAYER_VOLUMEBAR && !videoPlayer.volumeBar) || (childID == VIDEOPLAYER_VOLUMEBAR &&
            !videoPlayer.volumeBar.enabled)) ||
-           ((!videoPlayer.fullScreenButton) ||
+           ((childID == VIDEOPLAYER_FULLSCREENBUTTON && !videoPlayer.fullScreenButton) ||
            (childID == VIDEOPLAYER_FULLSCREENBUTTON &&
            !videoPlayer.fullScreenButton.enabled)))
         {
@@ -411,13 +446,23 @@
         {
 		    case VIDEOPLAYER_PLAYPAUSEBUTTON:
             {
+                if (!VideoPlayer(master).playPauseButton)
+                    break;
                 action = "Toggle";
                 break;
             }

 			case VIDEOPLAYER_MUTEBUTTON:
+            {
+               if (!VideoPlayer(master).volumeBar)
+                    break;
+                action = "Press";
+                break;
+            }
             case VIDEOPLAYER_FULLSCREENBUTTON:
             {
+               if (!VideoPlayer(master).fullScreenButton)
+                    break;
 		        action = "Press";
 		        break;
 		    }
@@ -645,7 +690,8 @@

 		    case VIDEOPLAYER_CURRENTTIMEDISPLAY:
             {
-                if (!videoPlayer.currentTimeDisplay)
+                if (!videoPlayer.currentTimeDisplay ||
+                    !videoPlayer.durationDisplay)
                     break;

 		        label = videoPlayer.currentTimeDisplay.text + "/" +
@@ -655,9 +701,7 @@

             case VIDEOPLAYER_MUTEBUTTON:
             {
-                if (!videoPlayer.volumeBar)
-                    break;
-                if (!videoPlayer.volumeBar.muteButton)
+                if (!videoPlayer.volumeBar || !videoPlayer.volumeBar.muteButton)
                     break;

                 label =
@@ -769,6 +813,8 @@

 		var playPauseButton:ToggleButtonBase;
 		var volumeBar:VolumeBar;
+        var scrubBar:ScrubBar;
+        var fullScreenButton:ButtonBase;

 		switch (event.type)
 		{
@@ -833,14 +879,39 @@
 			{
 				playPauseButton = VideoPlayer(master).playPauseButton;
 				if (SkinPartEvent(event).instance == playPauseButton)
+                {
 					playPauseButton.addEventListener(Event.CHANGE, eventHandler);
+                    if (VideoPlayer(master).tabIndex > 0 &&
+                        playPauseButton.tabIndex == -1)
+                        playPauseButton.tabIndex = VideoPlayer(master).tabIndex;
+
+                }

 				volumeBar = VideoPlayer(master).volumeBar;
 				if (SkinPartEvent(event).instance == volumeBar)
 				{
 					volumeBar.addEventListener(Event.CHANGE, eventHandler);
 					volumeBar.addEventListener(FlexEvent.MUTED_CHANGE, eventHandler);
+                    if (VideoPlayer(master).tabIndex > 0 &&
+                        volumeBar.tabIndex == -1)
+                        volumeBar.tabIndex = VideoPlayer(master).tabIndex;
 				}
+
+                scrubBar = VideoPlayer(master).scrubBar;
+                if (SkinPartEvent(event).instance == scrubBar)
+                {
+                    if (VideoPlayer(master).tabIndex > 0 &&
+                        scrubBar.tabIndex == -1)
+                        scrubBar.tabIndex = VideoPlayer(master).tabIndex;
+                }
+
+                fullScreenButton = VideoPlayer(master).fullScreenButton;
+                if (SkinPartEvent(event).instance == fullScreenButton)
+                {
+                    if (VideoPlayer(master).tabIndex > 0 &&
+                        fullScreenButton.tabIndex == -1)
+                        fullScreenButton.tabIndex = VideoPlayer(master).tabIndex;
+                }

 				break;
 			}


Transferred from the Adobe Open Source Subversion Repository

Revision: 9115
Author:   rfrishbe@adobe.com
Date:     2009-08-05T20:25:32.332343Z

Log Message:
-----------
VideoPlayer/VideoElement fixes:

SDK-22196 – VideoElement Cannot Load Video During An Effect.
The issue’s really with FLVPlayback.  If you set width and height to something, it won’t load the video until the next frame.  During an animation, we are constantly setting the width/height in UDL(), so FLVPlayback never actually shows or loads the video.  The fix is just a workaround and we only set width/height on the FLVPlayback control if one of them has changed.

SDK-22182 - Clicking "Full Screen" button on the rotated video displays only artboard.
For rotated video, we weren’t correctly going in to fullscreen mode.  Now we use setLayoutBoundsSize and setLayoutBoundsPosition with postTransform=true and make sure to call invalidateSize() and invalidateDL();

SDK-22310: bufferedArea not showing in spark Video Player
This was an injection with some refactoring around how we handled the sizing of components in TrackBase.  The code was refactored, but pendingValue was used, when the passed in value should be used.

QE notes: -
Doc notes: -
Bugs: SDK-22196, SDK-22182, SDK-22310
Reviewer: Deepa
Tests run: checkintests, VideoPlayer and VideoElement mustella tests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/mediaClasses/ScrubBar.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/VideoPlayer.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/VideoElement.as</path>

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

--- frameworks/projects/spark/src/spark/components/mediaClasses/ScrubBar.as
+++ frameworks/projects/spark/src/spark/components/mediaClasses/ScrubBar.as
@@ -199,7 +199,7 @@
         var trackSize:Number = track.getLayoutBoundsWidth();
         var thumbSize:Number = thumb.getLayoutBoundsWidth();
         var range:Number = maximum - minimum;
-        var thumbPos:Number = (range > 0) ? (pendingValue - minimum) * ((trackSize - thumbSize) / range) : 0;
+        var thumbPos:Number = (range > 0) ? (value - minimum) * ((trackSize - thumbSize) / range) : 0;
         return thumbSize + thumbPos;
     }


Transferred from the Adobe Open Source Subversion Repository

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

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

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

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

--- frameworks/projects/automation_spark/src/spark/automation/delegates/components/mediaClasses/SparkMuteButtonAutomationImpl.as
+++ frameworks/projects/automation_spark/src/spark/automation/delegates/components/mediaClasses/SparkMuteButtonAutomationImpl.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2009 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////

 package spark.automation.delegates.components.mediaClasses
 {


Transferred from the Adobe Open Source Subversion Repository

Revision: 14571
Author:   deeptika@adobe.com
Date:     2010-03-04T07:17:40.283901Z

Log Message:
-----------
Merging revision 14570 from 4.x branch
QE notes:
Doc notes:
Bugs:
Reviewer:
Tests run: checkintests
Is noteworthy for integration: No

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation/src/mx/automation/delegates/core/UIComponentAutomationImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation_air/src/mx/automation/delegates/controls/FlexNativeMenuAutomationImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation/src/mx/automation/delegates/controls/SWFLoaderAutomationImpl.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation_spark/src/spark/automation/tabularData/SparkListBaseTabularData.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation_spark/src/mx/automation/delegates/core/UIFTETextFieldAutomationImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation/src/mx/automation/delegates/core/UITextFieldAutomationImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation_spark/src/spark/automation/delegates/components/supportClasses/SparkDropDownListBaseAutomationImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation_dmv/src/mx/automation/delegates/advancedDataGrid/AdvancedDataGridAutomationImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation_spark/src/spark/automation/delegates/components/supportClasses/SparkListBaseAutomationImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation/src/mx/automation/tabularData/OLAPDataGridTabularData.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation/src/mx/automation/codec/RendererPropertyCodec.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation/src/mx/automation/delegates/TextFieldAutomationHelper.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/automation/src/mx/automation/codec/AutomationObjectPropertyCodec.as</path>

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

--- frameworks/projects/automation_spark/src/spark/automation/delegates/components/supportClasses/SparkListBaseAutomationImpl.as
+++ frameworks/projects/automation_spark/src/spark/automation/delegates/components/supportClasses/SparkListBaseAutomationImpl.as
@@ -167,7 +167,8 @@
 				var propertyNameMap:Object = automationClass.propertyNameMap;
 				if (propertyNameMap["enableIndexBasedSelection"])
 				{
-					trace("TBD - We should find the item renderer and convert it to index");
+					var message:String = "TBD - We should find the item renderer and convert it to index";
+					Automation.automationDebugTracer.traceMessage("SparkListBaseAutomationImpl","recordListItemSelectEvent()",message);
 					selectionType = SparkListItemSelectEvent.SELECT_INDEX;
 					indexSelection = true;
 				}


Add additional URLs for crossdomain policy files.

--- src/flash/tandem/core/Application.as
+++ src/flash/tandem/core/Application.as
@@ -75,7 +75,8 @@
     private const DEFAULT_USER_ID : String = "72389028@N00"
     private const DEFAULT_MINIMUM_ZOOM : Number = 0.25//0.5
     private const DEFAULT_MAXIMUM_ZOOM : Number = 180
-
+    private const NUM_FARMS = 10
+
     //--------------------------------------------------------------------------
     //
     //  Children
@@ -150,11 +151,11 @@
     {
         // TODO: Smells bad… =(
         Security.loadPolicyFile( "http://static.flickr.com/crossdomain.xml" )
-
-        Security.loadPolicyFile( "http://farm1.static.flickr.com/crossdomain.xml" )
-        Security.loadPolicyFile( "http://farm2.static.flickr.com/crossdomain.xml" )
-        Security.loadPolicyFile( "http://farm3.static.flickr.com/crossdomain.xml" )
-        Security.loadPolicyFile( "http://farm4.static.flickr.com/crossdomain.xml" )
+
+        for (var i:int = 0; i < NUM_FARMS; i++)
+        {
+            Security.loadPolicyFile("http://farm" + i + ".static.flickr.com/crossdomain.xml")
+        }

         Security.loadPolicyFile( "http://l.yimg.com/crossdomain.xml" )
     }