You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2012/08/07 19:13:35 UTC
svn commit: r1370370 [3/43] - in /incubator/flex/trunk/mustella/tests/mx: ./
binding/ binding/utils/ binding/utils/BindingUtils/
binding/utils/BindingUtils/SWFs/ binding/utils/BindingUtils/SWFs/assets/
binding/utils/BindingUtils/method/ binding/utils/C...
Added: incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp5.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp5.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp5.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp5.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<s:Group
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:s="library://ns.adobe.com/flex/spark">
+
+ <!--
+ This is different in that it uses data binding to populate the label of the
+ itemRenderer. We don't do that in the rest of the tests because it causes
+ warnings.
+ -->
+
+ <fx:Script>
+ <![CDATA[
+
+ import flash.events.Event;
+ import mx.collections.*;
+ import mx.collections.errors.*;
+ import mx.events.CollectionEvent;
+
+ // Public so we can access it, e.g., to be sure it dispatches events.
+ public var alv:AsyncListView;
+
+ // The ever famous simulator.
+ public var items:ItemPendingErrorSimulator;
+
+ // Added items start at 5000 so we can tell which ones those are.
+ public var addedItems:int = 5000;
+
+ /**
+ * This allows you to set a bunch of parameters.
+ **/
+ public function setup( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Boolean = true,
+ createFailedItemFunction:Boolean = true):void{
+
+ items = new ItemPendingErrorSimulator();
+
+ items.responseDelay = responseDelay;
+ items.numItems = numItems;
+ items.numPreloadedPages = numPreloadedPages;
+ items.pageSize = pageSize;
+ items.mode = mode;
+ items.failureProbability = failureProbability;
+ items.objectFactory = theObjectFactory;
+ items.reset();
+
+ alv = new AsyncListView(items);
+
+ if(createPendingItemFunction)
+ alv.createPendingItemFunction = pendingFunction;
+
+ if(createFailedItemFunction)
+ alv.createFailedItemFunction = errorFunction;
+
+ theList.dataProvider = alv;
+ }
+
+ public function pendingFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " pending", status: "pending"};
+ }
+
+ public function errorFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " failed", status: "failed"};
+ }
+
+ public function theObjectFactory(i:int):Object{
+ return {info: "item " + i.toString() + " present", status: "present"};
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:List id="theList" useVirtualLayout="true" height="200">
+ <s:itemRenderer>
+ <fx:Component>
+ <s:ItemRenderer>
+ <s:states>
+ <s:State name="normal" />
+ <s:State name="hovered" />
+ <s:State name="selected" />
+ </s:states>
+ <s:Label id="nameLabel" top="5" left="5" right="5" text="{data.info}" />
+ </s:ItemRenderer>
+ </fx:Component>
+ </s:itemRenderer>
+ </s:List>
+</s:Group>
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp6.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp6.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp6.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp6.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<s:Group
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:s="library://ns.adobe.com/flex/spark">
+
+ <fx:Script>
+ <![CDATA[
+
+ import flash.events.Event;
+ import mx.collections.*;
+ import mx.collections.errors.*;
+ import mx.events.CollectionEvent;
+
+ // Public so we can access it, e.g., to be sure it dispatches events.
+ public var alv:AsyncListView;
+
+ // The ever famous simulator.
+ public var items:ItemPendingErrorSimulator;
+
+ // Added items start at 5000 so we can tell which ones those are.
+ public var addedItems:int = 5000;
+
+ /**
+ * This allows you to set a bunch of parameters.
+ **/
+ public function setup( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Boolean = true,
+ createFailedItemFunction:Boolean = true):void{
+
+ items = new ItemPendingErrorSimulator();
+
+ items.responseDelay = responseDelay;
+ items.numItems = numItems;
+ items.numPreloadedPages = numPreloadedPages;
+ items.pageSize = pageSize;
+ items.mode = mode;
+ items.failureProbability = failureProbability;
+ items.objectFactory = theObjectFactory;
+ items.reset();
+
+ theList.dataProvider = items;
+ }
+
+ public function theObjectFactory(i:int):Object{
+ return {info: "item " + i.toString() + " present", status: "present"};
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:List id="theList" useVirtualLayout="true" height="200">
+ <s:itemRenderer>
+ <fx:Component>
+ <s:ItemRenderer>
+ <fx:Script>
+ <![CDATA[
+ private function getColor(obj:Object):uint{
+ if(obj == null)
+ return 0x888888;
+ else if(obj.status == "pending")
+ return 0xeeffee;
+ else if(obj.status == "failed")
+ return 0xffeeee;
+ else
+ return 0xffffff;
+ }
+
+ override public function set data(obj:Object):void{
+ super.data = obj;
+
+ if(data == null)
+ nameLabel.text = "null";
+ else
+ nameLabel.text = data.info;
+ }
+ ]]>
+ </fx:Script>
+ <s:states>
+ <s:State name="normal" />
+ <s:State name="hovered" />
+ <s:State name="selected" />
+ </s:states>
+ <s:Rect left="0" right="0" top="0" bottom="0" id="theRect" >
+ <s:fill>
+ <s:SolidColor color="{getColor(data)}" id="theSolidColor" />
+ </s:fill>
+ </s:Rect>
+ <s:Label id="nameLabel" top="5" left="5" right="5" />
+ </s:ItemRenderer>
+ </fx:Component>
+ </s:itemRenderer>
+ </s:List>
+
+</s:Group>
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp7.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp7.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp7.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp7.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<s:Group
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:s="library://ns.adobe.com/flex/spark">
+
+ <!--
+ This one is sortable!
+ List
+ contains ListCollectionView (sortable)
+ contains AsyncListView (handles IPEs)
+ contains ItemPendingErrorSimulator (has data and throws IPEs)
+ -->
+
+ <fx:Script>
+ <![CDATA[
+
+ import flash.events.Event;
+ import mx.collections.*;
+ import mx.collections.errors.*;
+ import mx.events.CollectionEvent;
+
+ // These are new in this component so we can sort.
+ public var lcv:ListCollectionView;
+ public var theSort:Sort;
+
+ // Public so we can access it, e.g., to be sure it dispatches events.
+ public var alv:AsyncListView;
+
+ // The ever famous simulator.
+ public var theSimulator:ItemPendingErrorSimulator;
+
+ // Added items start at 5000 so we can tell which ones those are.
+ public var addedItems:int = 5000;
+
+ /**
+ * This allows you to set a bunch of parameters.
+ **/
+ public function setup( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Boolean = true,
+ createFailedItemFunction:Boolean = true):void{
+
+ theSimulator = new ItemPendingErrorSimulator();
+
+ theSimulator.responseDelay = responseDelay;
+ theSimulator.numItems = numItems;
+ theSimulator.numPreloadedPages = numPreloadedPages;
+ theSimulator.pageSize = pageSize;
+ theSimulator.mode = mode;
+ theSimulator.failureProbability = failureProbability;
+ theSimulator.objectFactory = theObjectFactory;
+ theSimulator.reset();
+
+ alv = new AsyncListView(theSimulator);
+
+ if(createPendingItemFunction)
+ alv.createPendingItemFunction = pendingFunction;
+
+ if(createFailedItemFunction)
+ alv.createFailedItemFunction = errorFunction;
+
+ lcv = new ListCollectionView(alv);
+
+ theList.dataProvider = lcv;
+ }
+
+ public function pendingFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " pending", status: "pending"};
+ }
+
+ public function errorFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " failed", status: "failed"};
+ }
+
+ public function theObjectFactory(i:int):Object{
+ return {info: "item " + i.toString() + " present", status: "present"};
+ }
+
+ public function sort(reverse:Boolean = false):void{
+ theSort = new Sort();
+ theSort.fields = [new SortField("info", true)];
+
+ if(reverse)
+ theSort.reverse();
+
+ lcv.sort = theSort;
+ lcv.refresh();
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:List id="theList" useVirtualLayout="true" height="200">
+ <s:itemRenderer>
+ <fx:Component>
+ <s:ItemRenderer>
+ <fx:Script>
+ <![CDATA[
+ private function getColor(obj:Object):uint{
+ if(obj == null)
+ return 0x888888;
+ else if(obj.status == "pending")
+ return 0xeeffee;
+ else if(obj.status == "failed")
+ return 0xffeeee;
+ else
+ return 0xffffff;
+ }
+
+ override public function set data(obj:Object):void{
+ super.data = obj;
+
+ if(data == null)
+ nameLabel.text = "null";
+ else
+ nameLabel.text = data.info;
+ }
+ ]]>
+ </fx:Script>
+ <s:states>
+ <s:State name="normal" />
+ <s:State name="hovered" />
+ <s:State name="selected" />
+ </s:states>
+ <s:Rect left="0" right="0" top="0" bottom="0" id="theRect" >
+ <s:fill>
+ <s:SolidColor color="{getColor(data)}" id="theSolidColor" />
+ </s:fill>
+ </s:Rect>
+ <s:Label id="nameLabel" top="5" left="5" right="5" />
+ </s:ItemRenderer>
+ </fx:Component>
+ </s:itemRenderer>
+ </s:List>
+</s:Group>
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp8.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp8.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp8.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp8.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<s:Group
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:s="library://ns.adobe.com/flex/spark">
+
+ <!--
+ This one has useVirtualLayout = false.
+ -->
+
+ <fx:Script>
+ <![CDATA[
+
+ import flash.events.Event;
+ import mx.collections.*;
+ import mx.collections.errors.*;
+ import mx.events.CollectionEvent;
+
+ // These are new in this component so we can sort.
+ public var lcv:ListCollectionView;
+ public var theSort:Sort;
+
+ // Public so we can access it, e.g., to be sure it dispatches events.
+ public var alv:AsyncListView;
+
+ // The ever famous simulator.
+ public var theSimulator:ItemPendingErrorSimulator;
+
+ // Added items start at 5000 so we can tell which ones those are.
+ public var addedItems:int = 5000;
+
+ // To use as a local data provider.
+ public var ac:ArrayCollection = new ArrayCollection([{info:'thing 0'},{info:'thing 1'},{info:'thing 2'},{info:'thing 3'},{info:'thing 4'}]);
+
+ /**
+ * This allows you to set a bunch of parameters.
+ **/
+ public function setup( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Boolean = true,
+ createFailedItemFunction:Boolean = true):void{
+
+ theSimulator = new ItemPendingErrorSimulator();
+
+ theSimulator.responseDelay = responseDelay;
+ theSimulator.numItems = numItems;
+ theSimulator.numPreloadedPages = numPreloadedPages;
+ theSimulator.pageSize = pageSize;
+ theSimulator.mode = mode;
+ theSimulator.failureProbability = failureProbability;
+ theSimulator.objectFactory = theObjectFactory;
+ theSimulator.reset();
+
+ alv = new AsyncListView(theSimulator);
+
+ if(createPendingItemFunction)
+ alv.createPendingItemFunction = pendingFunction;
+
+ if(createFailedItemFunction)
+ alv.createFailedItemFunction = errorFunction;
+
+ lcv = new ListCollectionView(alv);
+
+ theList.dataProvider = lcv;
+ }
+
+ /**
+ * This allows you to set a bunch of parameters and
+ * specify the pending and error functions.
+ **/
+ public function setup2( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Function = null,
+ createFailedItemFunction:Function = null):void{
+
+ theSimulator = new ItemPendingErrorSimulator();
+
+ theSimulator.responseDelay = responseDelay;
+ theSimulator.numItems = numItems;
+ theSimulator.numPreloadedPages = numPreloadedPages;
+ theSimulator.pageSize = pageSize;
+ theSimulator.mode = mode;
+ theSimulator.failureProbability = failureProbability;
+ theSimulator.objectFactory = theObjectFactory;
+ theSimulator.reset();
+
+ alv = new AsyncListView(theSimulator);
+
+ if(createPendingItemFunction != null)
+ alv.createPendingItemFunction = createPendingItemFunction;
+
+ if(createFailedItemFunction != null)
+ alv.createFailedItemFunction = createFailedItemFunction;
+
+ theList.dataProvider = alv;
+ }
+
+ /**
+ * This setup updates the original AsyncListView object
+ * instead of replacing it.
+ **/
+ public function setup3( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Boolean = true,
+ createFailedItemFunction:Boolean = true):void{
+
+ theSimulator = new ItemPendingErrorSimulator();
+
+ theSimulator.responseDelay = responseDelay;
+ theSimulator.numItems = numItems;
+ theSimulator.numPreloadedPages = numPreloadedPages;
+ theSimulator.pageSize = pageSize;
+ theSimulator.mode = mode;
+ theSimulator.failureProbability = failureProbability;
+ theSimulator.objectFactory = theObjectFactory;
+ theSimulator.reset();
+
+ alv.list = theSimulator;
+
+ if(createPendingItemFunction)
+ alv.createPendingItemFunction = pendingFunction;
+
+ if(createFailedItemFunction)
+ alv.createFailedItemFunction = errorFunction;
+
+ theList.dataProvider = alv;
+ }
+
+ public function pendingFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " pending", status: "pending"};
+ }
+
+ public function errorFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " failed", status: "failed"};
+ }
+
+ public function theObjectFactory(i:int):Object{
+ return {info: "item " + i.toString() + " present", status: "present"};
+ }
+
+ public function sort(reverse:Boolean = false):void{
+ theSort = new Sort();
+ theSort.fields = [new SortField("info", true)];
+
+ if(reverse)
+ theSort.reverse();
+
+ lcv.sort = theSort;
+ lcv.refresh();
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:List id="theList" useVirtualLayout="false" height="200">
+ <s:itemRenderer>
+ <fx:Component>
+ <s:ItemRenderer>
+ <fx:Script>
+ <![CDATA[
+ private function getColor(obj:Object):uint{
+ if(obj == null)
+ return 0x888888;
+ else if(obj.status == "pending")
+ return 0xeeffee;
+ else if(obj.status == "failed")
+ return 0xffeeee;
+ else
+ return 0xffffff;
+ }
+
+ override public function set data(obj:Object):void{
+ super.data = obj;
+
+ if(data == null)
+ nameLabel.text = "null";
+ else
+ nameLabel.text = data.info;
+ }
+ ]]>
+ </fx:Script>
+ <s:states>
+ <s:State name="normal" />
+ <s:State name="hovered" />
+ <s:State name="selected" />
+ </s:states>
+ <s:Rect left="0" right="0" top="0" bottom="0" id="theRect" >
+ <s:fill>
+ <s:SolidColor color="{getColor(data)}" id="theSolidColor" />
+ </s:fill>
+ </s:Rect>
+ <s:Label id="nameLabel" top="5" left="5" right="5" />
+ </s:ItemRenderer>
+ </fx:Component>
+ </s:itemRenderer>
+ </s:List>
+</s:Group>
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp9.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp9.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp9.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/PagedDataComp9.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<s:Group
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:local="assets.*">
+
+ <!--
+ This one has useVirtualLayout = false.
+ -->
+
+ <fx:Script>
+ <![CDATA[
+
+ import flash.events.Event;
+ import mx.collections.*;
+ import mx.collections.errors.*;
+ import mx.events.CollectionEvent;
+ import spark.components.*;
+ import spark.components.supportClasses.DropDownController;
+
+ import flash.events.TimerEvent;
+ import flash.utils.Timer;
+
+ private var t:Timer;
+
+ // These are new in this component so we can sort.
+ public var lcv:ListCollectionView;
+ public var theSort:Sort;
+
+ // Public so we can access it, e.g., to be sure it dispatches events.
+ public var alv:AsyncListView;
+
+ // The ever famous simulator.
+ public var theSimulator:ItemPendingErrorSimulator;
+
+ // Added items start at 5000 so we can tell which ones those are.
+ public var addedItems:int = 5000;
+
+ // To use as a local data provider.
+ public var ac:ArrayCollection = new ArrayCollection([{info:'thing 0'},{info:'thing 1'},{info:'thing 2'},{info:'thing 3'},{info:'thing 4'}]);
+
+ /**
+ * This allows you to set a bunch of parameters.
+ **/
+ public function setup( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Boolean = true,
+ createFailedItemFunction:Boolean = true):void{
+
+ theSimulator = new ItemPendingErrorSimulator();
+
+ theSimulator.responseDelay = responseDelay;
+ theSimulator.numItems = numItems;
+ theSimulator.numPreloadedPages = numPreloadedPages;
+ theSimulator.pageSize = pageSize;
+ theSimulator.mode = mode;
+ theSimulator.failureProbability = failureProbability;
+ theSimulator.objectFactory = theObjectFactory;
+ theSimulator.reset();
+
+ alv = new AsyncListView(theSimulator);
+
+ if(createPendingItemFunction)
+ alv.createPendingItemFunction = pendingFunction;
+
+ if(createFailedItemFunction)
+ alv.createFailedItemFunction = errorFunction;
+
+ lcv = new ListCollectionView(alv);
+
+ theList.dataProvider = lcv;
+ }
+
+ /**
+ * This allows you to set a bunch of parameters and
+ * specify the pending and error functions.
+ **/
+ public function setup2( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Function = null,
+ createFailedItemFunction:Function = null):void{
+
+ theSimulator = new ItemPendingErrorSimulator();
+
+ theSimulator.responseDelay = responseDelay;
+ theSimulator.numItems = numItems;
+ theSimulator.numPreloadedPages = numPreloadedPages;
+ theSimulator.pageSize = pageSize;
+ theSimulator.mode = mode;
+ theSimulator.failureProbability = failureProbability;
+ theSimulator.objectFactory = theObjectFactory;
+ theSimulator.reset();
+
+ alv = new AsyncListView(theSimulator);
+
+ if(createPendingItemFunction != null)
+ alv.createPendingItemFunction = createPendingItemFunction;
+
+ if(createFailedItemFunction != null)
+ alv.createFailedItemFunction = createFailedItemFunction;
+
+ theList.dataProvider = alv;
+ }
+
+ /**
+ * This setup updates the original AsyncListView object
+ * instead of replacing it.
+ **/
+ public function setup3( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0,
+ createPendingItemFunction:Boolean = true,
+ createFailedItemFunction:Boolean = true):void{
+
+ theSimulator = new ItemPendingErrorSimulator();
+
+ theSimulator.responseDelay = responseDelay;
+ theSimulator.numItems = numItems;
+ theSimulator.numPreloadedPages = numPreloadedPages;
+ theSimulator.pageSize = pageSize;
+ theSimulator.mode = mode;
+ theSimulator.failureProbability = failureProbability;
+ theSimulator.objectFactory = theObjectFactory;
+ theSimulator.reset();
+
+ alv.list = theSimulator;
+
+ if(createPendingItemFunction)
+ alv.createPendingItemFunction = pendingFunction;
+
+ if(createFailedItemFunction)
+ alv.createFailedItemFunction = errorFunction;
+
+ theList.dataProvider = alv;
+ }
+
+ public function pendingFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " pending", status: "pending"};
+ }
+
+ public function errorFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " failed", status: "failed"};
+ }
+
+ public function theObjectFactory(i:int):Object{
+ return {info: "item " + i.toString() + " present", status: "present"};
+ }
+
+ public function sort(reverse:Boolean = false):void{
+ theSort = new Sort();
+ theSort.fields = [new SortField("info", true)];
+
+ if(reverse)
+ theSort.reverse();
+
+ lcv.sort = theSort;
+ lcv.refresh();
+ }
+
+ public function doTest():void{
+ setup();
+ theList.openDropDown();
+
+ t = new Timer(2000);
+ t.addEventListener(TimerEvent.TIMER, handleTimerEvent);
+ t.start();
+ }
+
+ public function handleTimerEvent(obj:*):void{
+ trace("theList.dataGroup.getElementAt(0).label: " + Object(theList.dataGroup.getElementAt(0)).label);
+
+ }
+
+ ]]>
+ </fx:Script>
+ <s:VGroup>
+ <s:ComboBox id="theList" useVirtualLayout="true" labelField="info" />
+ </s:VGroup>
+</s:Group>
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/TestPagedData.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/TestPagedData.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/TestPagedData.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/SWFs/assets/TestPagedData.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+
+<!--
+Simple test harness for the DataGroup ItemPendingError handler.
+
+Depends on ItemPendingErrorSimulator.
+
+-->
+
+<s:Application initialize="reset()"
+ xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:s="library://ns.adobe.com/flex/spark">
+
+ <fx:Script>
+ <![CDATA[
+
+ import mx.collections.*;
+ import mx.events.CollectionEvent;
+
+ private var alv:AsyncListView;
+ private var items:ItemPendingErrorSimulator;
+ private var addedItems:int = 0;
+
+ private function reset():void
+ {
+
+ items = new ItemPendingErrorSimulator();
+
+ items.responseDelay = responseDelay.value;
+ items.numItems = numItems.value;
+ items.numPreloadedPages = initialPages.value;
+ items.pageSize = pageSize.value;
+ items.mode = mode.selectedItem as String;
+ items.objectFactory = theObjectFactory;
+ items.failureProbability = fp.value;
+ items.reset();
+
+ alv = new AsyncListView(items);
+ alv.createPendingItemFunction = pendingFunction;
+ alv.createFailedItemFunction = errorFunction;
+
+ listenForCollectionChange();
+
+ list1.dataProvider = alv;
+
+ addedItems = 0;
+ }
+
+ private function listenForCollectionChange():void{
+ if(ckTraceCollectionChange.selected){
+ alv.addEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE, traceCollectionChange);
+ trace("now tracing collectionChange events");
+ }else{
+ alv.removeEventListener(mx.events.CollectionEvent.COLLECTION_CHANGE, traceCollectionChange);
+ }
+ }
+
+ private function traceCollectionChange(e:CollectionEvent):void{
+ trace("alv collectionChange:");
+ trace("currentTarget: " + e.currentTarget);
+ trace("items: " + e.items);
+ trace("kind: " + e.kind);
+ trace("type: " + e.type);
+ trace("location: " + e.location);
+ trace("oldLocation: " + e.oldLocation);
+ trace("target: " + e.target);
+ }
+
+ public function pendingFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " pending", status: "pending"};
+ }
+
+ public function errorFunction(i:int, obj:Object):Object{
+ return {info: "item " + i.toString() + " failed", status: "failed"};
+ }
+
+ public function theObjectFactory(i:int):Object{
+ return {info: "item " + i.toString() + " present", status: "present"};
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:HGroup left="10" right="10">
+ <s:List id="list1" useVirtualLayout="true" height="200">
+ <s:itemRenderer>
+ <fx:Component>
+ <s:ItemRenderer>
+ <fx:Script>
+ <![CDATA[
+ private function getColor(obj:Object):uint{
+ if(obj.status == "pending")
+ return 0xeeffee;
+ else if(obj.status == "failed")
+ return 0xffeeee;
+ else
+ return 0xffffff;
+ }
+
+ override public function set data(obj:Object):void{
+ super.data = obj;
+
+ if(data){
+ nameLabel.text = data.info;
+ }
+ }
+ ]]>
+ </fx:Script>
+ <s:states>
+ <s:State name="normal" />
+ <s:State name="hovered" />
+ <s:State name="selected" />
+ </s:states>
+ <s:Rect left="0" right="0" top="0" bottom="0">
+ <s:fill>
+ <s:SolidColor color="{getColor(data)}" />
+ </s:fill>
+ </s:Rect>
+ <!--s:Label id="nameLabel" text="{data.info}" top="5" left="5" right="5" /-->
+ <s:Label id="nameLabel" top="5" left="5" right="5" />
+ </s:ItemRenderer>
+ </fx:Component>
+ </s:itemRenderer>
+ </s:List>
+ <s:VGroup>
+ <s:HGroup>
+ <mx:Button label="reset" click="reset()" />
+ <mx:Button label="receive page" click="items.receivePage()" enabled="{mode.selectedItem == 'manual'}" />
+ <mx:Button label="fail page" click="items.failPage()" enabled="{mode.selectedItem == 'manual'}" />
+ </s:HGroup>
+
+ <s:HGroup>
+ <mx:Label text="response mode" />
+ <mx:ComboBox id="mode" dataProvider="['fixed', 'random', 'manual']" />
+ </s:HGroup>
+
+ <s:HGroup>
+ <mx:Label text="response delay" />
+ <s:NumericStepper id="responseDelay" value="1" maximum="10000" enabled="{mode.selectedItem == 'fixed'}" />
+ </s:HGroup>
+ <s:HGroup>
+ <mx:Label text="failure probability" />
+ <s:NumericStepper id="fp" value="0.0" maximum="1.0" snapInterval="0.01" stepSize="0.01" valueCommit="(alv.list as ItemPendingErrorSimulator).failureProbability = fp.value" />
+ </s:HGroup>
+ <s:HGroup>
+ <mx:Label text="number of items" />
+ <s:NumericStepper id="numItems" value="100" maximum="1000" />
+ </s:HGroup>
+ <s:HGroup>
+ <mx:Label text="number of preloaded pages" />
+ <s:NumericStepper id="initialPages" value="0" maximum="100" />
+ </s:HGroup>
+ <s:HGroup>
+ <mx:Label text="items per page" />
+ <s:NumericStepper id="pageSize" value="2" maximum="100" minimum="1" />
+ </s:HGroup>
+ <s:CheckBox id="tracing" label="trace output enabled" selected="true" change="items.tracing = tracing.selected" />
+ <s:CheckBox id="ckTraceCollectionChange" label="trace collectionChange" selected="false" change="listenForCollectionChange()" />
+ <s:HGroup>
+ <s:Label text="Add item at:" />
+ <s:TextInput id="tiAdd" text="0" />
+ <s:Button label="Add" click="items.addItemAt(theObjectFactory(addedItems++),new Number(tiAdd.text))" />
+ </s:HGroup>
+ <s:HGroup>
+ <s:Label text="Add pending item at:" />
+ <s:TextInput id="tiAddPending" text="0" />
+ <s:Button label="Add Pending" click="items.addPendingItemAt(theObjectFactory(addedItems++),new Number(tiAddPending.text))" />
+ </s:HGroup>
+ <s:HGroup>
+ <s:Label text="Remove item at:" />
+ <s:TextInput id="tiRemove" text="0" />
+ <s:Button label="Remove" click="items.removeItemAt(new Number(tiRemove.text))" />
+ </s:HGroup>
+ </s:VGroup>
+
+ </s:HGroup>
+
+</s:Application>
Added: incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/events/AsyncListView_collectionChange.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/events/AsyncListView_collectionChange.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/events/AsyncListView_collectionChange.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/collections/AsyncListView/events/AsyncListView_collectionChange.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<UnitTester
+ testDir="mx/collections/AsyncListView/events/"
+ xmlns:mx="http://www.adobe.com/2006/mxml"
+ xmlns="*"
+ xmlns:assets="assets.*"
+ testSWF="AsyncListView_App1.mxml">
+
+ <!-- this set of lines form a template that must be in each unit test -->
+ <mx:Script>
+ <![CDATA[
+ public static function init(o:DisplayObject):void
+ {
+ }
+ ]]>
+ </mx:Script>
+ <mx:Metadata>
+ <![CDATA[
+ [Mixin]
+ ]]>
+ </mx:Metadata>
+ <!-- end of set of lines that must be in each unit test -->
+
+ <mx:Script>
+ <![CDATA[
+
+ import assets.*;
+ import mx.core.FlexGlobals;
+
+ ]]>
+ </mx:Script>
+
+ <testCases>
+
+<!--
+A reminder:
+
+public function setup( responseDelay:int = 500,
+ numItems:int = 100,
+ numPreloadedPages:int = 0,
+ pageSize:int = 1,
+ mode:String = 'manual',
+ failureProbability:int = 0):void{
+-->
+
+<TestCase testID="collectionChange_vlist_test1" keywords="[AsyncListView,collectionChange]" description="A pending item fails." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup(0,10,0,1,'manual',1)" waitTarget="obj1.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.items.failPage()" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_vlist_test2" keywords="[AsyncListView,collectionChange]" description="A pending item succeeds." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup(0,10,0,1,'manual',0)" waitTarget="obj1.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.items.receivePage()" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_vlist_test3" keywords="[AsyncListView,collectionChange]" description="AsyncListView adds an item." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup()" waitTarget="obj1" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.alv.addItemAt({info: 'new item', status: 'present'},0)" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="add" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_vlist_test4" keywords="[AsyncListView,collectionChange]" description="AsyncListView removes an item." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup()" waitTarget="obj1" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.alv.removeItemAt(0)" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="remove" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+<!-- These add items to the part of a virtualized list which is not in view. -->
+<TestCase testID="collectionChange_vlist_test5" keywords="[AsyncListView,collectionChange]" description="A pending item out of view fails." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup(0,30)" waitTarget="obj1.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.alv.getItemAt(20)" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.items.failItem(20)" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_vlist_test6" keywords="[AsyncListView,collectionChange]" description="A pending item out of view succeeds." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup(0,30)" waitTarget="obj1.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.alv.getItemAt(20)" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.items.receiveItem(20)" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_vlist_test7" keywords="[AsyncListView,collectionChange]" description="AsyncListView adds an item out of view." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup(0,30)" waitTarget="obj1" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.alv.addItemAt({info: 'new item', status: 'present'},20)" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="add" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_vlist_test8" keywords="[AsyncListView,collectionChange]" description="AsyncListView removes an item out of view." >
+ <setup>
+ <ResetComponent target="obj1" className="assets.PagedDataComp1" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.setup(0,30)" waitTarget="obj1" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj1.alv.removeItemAt(20)" />
+ <AssertEvent target="obj1.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="remove" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj1.alv" />
+ </body>
+</TestCase>
+
+
+
+
+<!--
+=========
+nonvlist
+=========
+-->
+
+
+<TestCase testID="collectionChange_nonvlist_test1" keywords="[AsyncListView,collectionChange]" description="A pending item fails." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup(0,10,0,1,'manual',1)" waitTarget="obj8.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.theSimulator.failPage()" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_nonvlist_test2" keywords="[AsyncListView,collectionChange]" description="A pending item succeeds." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup(0,10,0,1,'manual',0)" waitTarget="obj8.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.theSimulator.receivePage()" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_nonvlist_test3" keywords="[AsyncListView,collectionChange]" description="AsyncListView adds an item." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup()" waitTarget="obj8" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.alv.addItemAt({info: 'new item', status: 'present'},0)" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="add" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_nonvlist_test4" keywords="[AsyncListView,collectionChange]" description="AsyncListView removes an item." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup()" waitTarget="obj8" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.alv.removeItemAt(0)" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="remove" />
+ <AssertEventPropertyValue propertyName="location" value="0" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_nonvlist_test5" keywords="[AsyncListView,collectionChange]" description="A pending item out of view fails." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup(0,30)" waitTarget="obj8.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.theSimulator.failItem(20)" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_nonvlist_test6" keywords="[AsyncListView,collectionChange]" description="A pending item out of view succeeds." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup(0,30)" waitTarget="obj8.theList" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.theSimulator.receiveItem(20)" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="replace" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_nonvlist_test7" keywords="[AsyncListView,collectionChange]" description="AsyncListView adds an item out of view." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup(0,30)" waitTarget="obj8" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.alv.addItemAt({info: 'new item', status: 'present'},20)" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="add" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+<TestCase testID="collectionChange_nonvlist_test8" keywords="[AsyncListView,collectionChange]" description="AsyncListView removes an item out of view." >
+ <setup>
+ <ResetComponent target="obj8" className="assets.PagedDataComp8" waitEvent="updateComplete" />
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.setup(0,30)" waitTarget="obj8" waitEvent="updateComplete" />
+ </setup>
+ <body>
+ <RunCode code="FlexGlobals.topLevelApplication.obj8.alv.removeItemAt(20)" />
+ <AssertEvent target="obj8.alv" eventName="collectionChange" eventClass="mx.events::CollectionEvent" />
+ <AssertEventPropertyValue propertyName="kind" value="remove" />
+ <AssertEventPropertyValue propertyName="location" value="20" />
+ <AssertEventPropertyValue propertyName="currentTarget" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ <AssertEventPropertyValue propertyName="target" valueExpression="value = FlexGlobals.topLevelApplication.obj8.alv" />
+ </body>
+</TestCase>
+
+</testCases>
+</UnitTester>