Author: cframpton
Date: Wed Nov 28 21:49:59 2012
New Revision: 1414947
URL: http://svn.apache.org/viewvc?rev=1414947&view=rev
Log:
>From whiteboard/cframpton/adobe.next. ArrayList/addAllAt() now dispatches
>just one CollectionEvent. SDK-30008.
Modified:
incubator/flex/sdk/branches/develop/frameworks/projects/framework/src/mx/collections/ArrayList.as
Modified:
incubator/flex/sdk/branches/develop/frameworks/projects/framework/src/mx/collections/ArrayList.as
URL:
http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/frameworks/projects/framework/src/mx/collections/ArrayList.as?rev=1414947&r1=1414946&r2=1414947&view=diff
==============================================================================
---
incubator/flex/sdk/branches/develop/frameworks/projects/framework/src/mx/collections/ArrayList.as
(original)
+++
incubator/flex/sdk/branches/develop/frameworks/projects/framework/src/mx/collections/ArrayList.as
Wed Nov 28 21:49:59 2012
@@ -429,10 +429,28 @@ public class ArrayList extends EventDisp
*/
public function addAllAt(addList:IList, index:int):void
{
- var length:int = addList.length;
- for (var i:int = 0; i < length; i++)
+ const addListLength:int = addList.length;
+ if (addListLength == 0)
+ return;
+
+ const addedItems:Array = new Array();
+
+ disableEvents();
+ for (var i:int = 0; i < addListLength; i++)
+ {
+ var item:Object = addList.getItemAt(i);
+ this.addItemAt(item, i + index);
+ addedItems.push(item);
+ }
+ enableEvents();
+
+ if (_dispatchEvents == 0)
{
- this.addItemAt(addList.getItemAt(i), i+index);
+ const event:CollectionEvent = new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+ event.kind = CollectionEventKind.ADD;
+ event.location = index;
+ event.items = addedItems;
+ dispatchEvent(event);
}
}