royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [royale-asjs] 01/07: move IItemRendererParent from the strand to the view so that there are fewer dependencies on the strand
Date Wed, 16 May 2018 22:18:03 GMT
This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 32e5dbddd3391a4ded6a1cf3970c38454fd1eddf
Author: Alex Harui <aharui@apache.org>
AuthorDate: Wed May 16 15:14:27 2018 -0700

    move IItemRendererParent from the strand to the view so that there are fewer dependencies
on the strand
---
 .../org/apache/royale/core/DataContainerBase.as    | 117 --------------
 .../royale/html/beads/AccordionCollapseBead.as     |   4 +-
 .../org/apache/royale/html/beads/AccordionView.as  |   2 +-
 .../apache/royale/html/beads/DataContainerView.as  | 168 ++++++++++++++++++++-
 .../DataItemRendererFactoryForCollectionView.as    |  12 +-
 .../DynamicItemsRendererFactoryForArrayListData.as |   4 +-
 .../apache/royale/html/supportClasses/DataGroup.as | 121 +--------------
 .../supportClasses/TreeGridControlItemRenderer.as  |  10 ++
 .../layouts/LineChartCategoryVsLinearLayout.as     |   2 +-
 .../beads/layouts/LineChartLinearVsLinearLayout.as |   2 +-
 .../apache/royale/charts/core/IChartDataGroup.as   |   2 +-
 .../royale/charts/optimized/SVGChartDataGroup.as   |  27 ++++
 .../royale/charts/supportClasses/ChartDataGroup.as | 151 +++++++++++++++++-
 .../org/apache/royale/core/IItemRendererParent.as  |   4 +-
 .../effects/beads/EasyAccordionCollapseBead.as     |   8 +-
 15 files changed, 372 insertions(+), 262 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/DataContainerBase.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/DataContainerBase.as
index 06440f2..0d25075 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/DataContainerBase.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/DataContainerBase.as
@@ -21,8 +21,6 @@ package org.apache.royale.core
 	import org.apache.royale.core.ValuesManager;
 	import org.apache.royale.html.beads.IListView;
 	import org.apache.royale.events.Event;
-	import org.apache.royale.events.ItemAddedEvent;
-	import org.apache.royale.events.ItemRemovedEvent;
 	import org.apache.royale.html.supportClasses.DataItemRenderer;
 	
 	/**
@@ -123,120 +121,5 @@ package org.apache.royale.core
 			_itemRenderer = value;
 		}
 				
-		/*
-		* IItemRendererParent
-		*/
-		
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#addItemRenderer()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		public function addItemRenderer(renderer:IItemRenderer, dispatchAdded:Boolean):void
-		{
-			addElement(renderer, dispatchAdded);
-			dispatchItemAdded(renderer);
-		}
-		 */
-		
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#addItemRendererAt()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9
-		public function addItemRendererAt(renderer:IItemRenderer, index:int):void
-		{
-			addElementAt(renderer, index, true);
-			dispatchItemAdded(renderer);
-		}
-		
-		private function dispatchItemAdded(renderer:IItemRenderer):void
-		{
-			var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
-			newEvent.item = renderer;
-			
-			dispatchEvent(newEvent);
-		}
-		 */
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#removeItemRenderer()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		public function removeItemRenderer(renderer:IItemRenderer):void
-		{
-			removeElement(renderer);
-			
-			var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
-			newEvent.item = renderer;
-			
-			dispatchEvent(newEvent);
-		}
-		 */
-		
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#removeAllItemRenderers()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		public function removeAllItemRenderers():void
-		{
-			while (numElements > 0) {
-				var child:IChild = getElementAt(0);
-				removeElement(child);
-			}
-		}
-		 */
-		
-		/**
-		 *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererForIndex()
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 * 	@royaleignorecoercion org.apache.royale.core.IItemRenderer
-		public function getItemRendererForIndex(index:int):IItemRenderer
-		{
-			if (index < 0 || index >= numElements) return null;
-			return getElementAt(index) as IItemRenderer;
-		}
-		 */
-		
-		/**
-		 *  Refreshes the itemRenderers. Useful after a size change by the data group.
-		 *
-		 *  @copy org.apache.royale.core.IItemRendererParent#updateAllItemRenderers()
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 * 	@royaleignorecoercion org.apache.royale.html.supportClasses.DataItemRenderer
-		public function updateAllItemRenderers():void
-		{
-			var n:Number = numElements;
-			for (var i:Number = 0; i < n; i++)
-			{
-				var renderer:DataItemRenderer = getItemRendererForIndex(i) as DataItemRenderer;
-				if (renderer) {
-					renderer.setWidth(this.width,true);
-					renderer.adjustSize();
-				}
-			}
-		}
-		 */
-
     }
 }
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionCollapseBead.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionCollapseBead.as
index d5e0836..68a3a79 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionCollapseBead.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionCollapseBead.as
@@ -46,7 +46,7 @@ package org.apache.royale.html.beads
 				idx = 0;
 
 			var dg:IItemRendererParent = IListView(host.view).dataGroup as IItemRendererParent;
-			var numElems:int = dg.numElements;
+			var numElems:int = dg.numItemRenderers;
 			for(var i:int = 0; i < numElems; i++){
 				if(i == idx)
 					continue;
@@ -64,7 +64,7 @@ package org.apache.royale.html.beads
 		protected function selectedIndexChangedHandler(event:Event):void
 		{
 			var view:IListView = host.view as IListView;
-			var newChild:UIBase = view.dataGroup.getElementAt(host.selectedIndex) as UIBase;
+			var newChild:UIBase = view.dataGroup.getItemRendererAt(host.selectedIndex) as UIBase;
 			if (!newChild)
 			{
 				return;
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionView.as
index f022947..ee689ae 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/AccordionView.as
@@ -95,7 +95,7 @@ package org.apache.royale.html.beads
 		 */
 		override protected function itemsCreatedHandler(event:Event):void
 		{
-			var n:int = dataGroup.numElements;
+			var n:int = dataGroup.numItemRenderers;
 			for (var i:int = 0; i < n; i++)
 			{
 				var child:ICollapsible = dataGroup.getItemRendererForIndex(i) as ICollapsible;
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataContainerView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataContainerView.as
index 560daf1..2ea13b8 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataContainerView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataContainerView.as
@@ -24,10 +24,11 @@ package org.apache.royale.html.beads
 	import org.apache.royale.core.IBeadLayout;
 	import org.apache.royale.core.IBeadModel;
 	import org.apache.royale.core.IBeadView;
-    import org.apache.royale.core.IDataProviderItemRendererMapper;
-    import org.apache.royale.core.IDataProviderModel;
+    import org.apache.royale.core.IChild;
+	import org.apache.royale.core.IDataProviderItemRendererMapper;
+	import org.apache.royale.core.IDataProviderModel;
 	import org.apache.royale.core.IItemRenderer;
-    import org.apache.royale.core.IItemRendererClassFactory;
+	import org.apache.royale.core.IItemRendererClassFactory;
 	import org.apache.royale.core.IItemRendererParent;
 	import org.apache.royale.core.IParent;
 	import org.apache.royale.core.IParentIUIBase;
@@ -41,8 +42,11 @@ package org.apache.royale.html.beads
 	import org.apache.royale.core.ValuesManager;
 	import org.apache.royale.events.Event;
 	import org.apache.royale.events.IEventDispatcher;
+    import org.apache.royale.events.ItemAddedEvent;
+    import org.apache.royale.events.ItemRemovedEvent;
 	import org.apache.royale.html.supportClasses.Border;
 	import org.apache.royale.html.supportClasses.DataGroup;
+	import org.apache.royale.html.supportClasses.DataItemRenderer;
 	import org.apache.royale.utils.loadBeadFromValuesManager;
 
 	/**
@@ -54,7 +58,7 @@ package org.apache.royale.html.beads
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.8
 	 */
-	public class DataContainerView extends ContainerView implements IListView
+	public class DataContainerView extends ContainerView implements IListView, IItemRendererParent
 	{
 		public function DataContainerView()
 		{
@@ -92,7 +96,7 @@ package org.apache.royale.html.beads
 		 */
 		public function get dataGroup():IItemRendererParent
 		{
-			return super.contentView as IItemRendererParent;
+			return this as IItemRendererParent;
 		}
 		
 		/**
@@ -139,5 +143,159 @@ package org.apache.royale.html.beads
         {
             return _strand as IUIBase;
         }
+        
+        /*
+        * IItemRendererParent
+        */
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#numItemRenderers()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         *  @royaleignorecoercion org.apache.royale.core.IParent
+         */
+        public function get numItemRenderers():int
+        {
+            return (contentView as IParent).numElements;
+        }
+        
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#addItemRenderer()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         *  @royaleignorecoercion org.apache.royale.core.IParent
+         */
+        public function addItemRenderer(renderer:IItemRenderer, dispatchAdded:Boolean):void
+        {
+            (contentView as IParent).addElement(renderer, dispatchAdded);
+            dispatchItemAdded(renderer);
+        }
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#addItemRendererAt()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9
+         *  @royaleignorecoercion org.apache.royale.core.IParent
+         */
+        public function addItemRendererAt(renderer:IItemRenderer, index:int):void
+        {
+            (contentView as IParent).addElementAt(renderer, index, true);
+            dispatchItemAdded(renderer);
+        }
+        
+        private function dispatchItemAdded(renderer:IItemRenderer):void
+        {
+            var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
+            newEvent.item = renderer;
+            
+            host.dispatchEvent(newEvent);
+        }
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#removeItemRenderer()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         *  @royaleignorecoercion org.apache.royale.core.IParent
+         */
+        public function removeItemRenderer(renderer:IItemRenderer):void
+        {
+            (contentView as IParent).removeElement(renderer);
+            
+            var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
+            newEvent.item = renderer;
+            
+            host.dispatchEvent(newEvent);
+        }
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#removeAllItemRenderers()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         *  @royaleignorecoercion org.apache.royale.core.IParent
+         */
+        public function removeAllItemRenderers():void
+        {
+            while ((contentView as IParent).numElements > 0) {
+                var child:IChild = (contentView as IParent).getElementAt(0);
+                (contentView as IParent).removeElement(child);
+            }
+        }
+        
+        /**
+         *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererForIndex()
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         * 	@royaleignorecoercion org.apache.royale.core.IItemRenderer
+         */
+        public function getItemRendererForIndex(index:int):IItemRenderer
+        {
+            if (index < 0 || index >= (contentView as IParent).numElements) return
null;
+            return (contentView as IParent).getElementAt(index) as IItemRenderer;
+        }
+        
+        /**
+         *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererAt()
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         * 	@royaleignorecoercion org.apache.royale.core.IItemRenderer
+         *  @royaleignorecoercion org.apache.royale.core.IParent
+         */
+        public function getItemRendererAt(index:int):IItemRenderer
+        {
+            if (index < 0 || index >= (contentView as IParent).numElements) return
null;
+            return (contentView as IParent).getElementAt(index) as IItemRenderer;
+        }
+        
+        /**
+         *  Refreshes the itemRenderers. Useful after a size change by the data group.
+         *
+         *  @copy org.apache.royale.core.IItemRendererParent#updateAllItemRenderers()
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         * 	@royaleignorecoercion org.apache.royale.html.supportClasses.DataItemRenderer
+         *  @royaleignorecoercion org.apache.royale.core.IParent
+         */
+        public function updateAllItemRenderers():void
+        {
+            var n:Number = (contentView as IParent).numElements;
+            for (var i:Number = 0; i < n; i++)
+            {
+                var renderer:DataItemRenderer = getItemRendererForIndex(i) as DataItemRenderer;
+                if (renderer) {
+                    renderer.setWidth(host.width,true);
+                    renderer.adjustSize();
+                }
+            }
+        }
+
 	}
 }
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForCollectionView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForCollectionView.as
index 8226e19..5246fed 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForCollectionView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForCollectionView.as
@@ -209,10 +209,10 @@ package org.apache.royale.html.beads
 			fillRenderer(event.index, event.item, ir, presentationModel);
 			
 			// update the index values in the itemRenderers to correspond to their shifted positions.
-			var n:int = dataGroup.numElements;
+			var n:int = dataGroup.numItemRenderers;
 			for (var i:int = event.index; i < n; i++)
 			{
-				ir = dataGroup.getElementAt(i) as ISelectableItemRenderer;
+				ir = dataGroup.getItemRendererAt(i) as ISelectableItemRenderer;
 				ir.index = i;
 				
 				// could let the IR know its index has been changed (eg, it might change its
@@ -241,14 +241,14 @@ package org.apache.royale.html.beads
 			if (!dp)
 				return;
 			
-			var ir:ISelectableItemRenderer = dataGroup.getElementAt(event.index) as ISelectableItemRenderer;
+			var ir:ISelectableItemRenderer = dataGroup.getItemRendererAt(event.index) as ISelectableItemRenderer;
 			dataGroup.removeItemRenderer(ir);
 			
 			// adjust the itemRenderers' index to adjust for the shift
-			var n:int = dataGroup.numElements;
+			var n:int = dataGroup.numItemRenderers;
 			for (var i:int = event.index; i < n; i++)
 			{
-				ir = dataGroup.getElementAt(i) as ISelectableItemRenderer;
+				ir = dataGroup.getItemRendererAt(i) as ISelectableItemRenderer;
 				ir.index = i;
 				
 				// could let the IR know its index has been changed (eg, it might change its
@@ -276,7 +276,7 @@ package org.apache.royale.html.beads
 
 			// update the given renderer with (possibly) new information so it can change its
 			// appearence or whatever.
-			var ir:ISelectableItemRenderer = dataGroup.getElementAt(event.index) as ISelectableItemRenderer;
+			var ir:ISelectableItemRenderer = dataGroup.getItemRendererAt(event.index) as ISelectableItemRenderer;
 			setData(ir, event.item, event.index);
 		}
 		
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DynamicItemsRendererFactoryForArrayListData.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DynamicItemsRendererFactoryForArrayListData.as
index 1e97f4c..8c424fc 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DynamicItemsRendererFactoryForArrayListData.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DynamicItemsRendererFactoryForArrayListData.as
@@ -191,10 +191,10 @@ package org.apache.royale.html.beads
             fillRenderer(event.index, event.item, ir, presentationModel);
 			
 			// update the index values in the itemRenderers to correspond to their shifted positions.
-			var n:int = dataGroup.numElements;
+			var n:int = dataGroup.numItemRenderers;
 			for (var i:int = event.index; i < n; i++)
 			{
-				ir = dataGroup.getElementAt(i) as ISelectableItemRenderer;
+				ir = dataGroup.getItemRendererAt(i) as ISelectableItemRenderer;
 				ir.index = i;
 			}
 
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/DataGroup.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/DataGroup.as
index c0f44bc..9b6b38a 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/DataGroup.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/DataGroup.as
@@ -28,9 +28,6 @@ package org.apache.royale.html.supportClasses
     import org.apache.royale.core.UIBase;
 	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.Event;
-	import org.apache.royale.events.ItemAddedEvent;
-	import org.apache.royale.events.ItemClickedEvent;
-	import org.apache.royale.events.ItemRemovedEvent;
 
     /**
      *  The DataGroup class is the IItemRendererParent used internally
@@ -41,7 +38,7 @@ package org.apache.royale.html.supportClasses
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.0
      */
-	public class DataGroup extends ContainerContentArea implements IItemRendererParent
+	public class DataGroup extends ContainerContentArea
 	{
         /**
          *  Constructor.
@@ -56,121 +53,5 @@ package org.apache.royale.html.supportClasses
 			super();
 		}
 		
-		/*
-		* IItemRendererParent
-		*/
-		
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#addItemRenderer()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function addItemRenderer(renderer:IItemRenderer, dispatchAdded:Boolean):void
-		{
-			addElement(renderer, dispatchAdded);
-			dispatchItemAdded(renderer);
-		}
-		
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#addItemRendererAt()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9
-		 */
-		public function addItemRendererAt(renderer:IItemRenderer, index:int):void
-		{
-			addElementAt(renderer, index, true);
-			dispatchItemAdded(renderer);
-		}
-		
-		/**
-		 * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
-		 */
-		private function dispatchItemAdded(renderer:IItemRenderer):void
-		{
-			var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
-			newEvent.item = renderer;
-			
-			(host as IEventDispatcher).dispatchEvent(newEvent);
-		}
-		
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#removeItemRenderer()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function removeItemRenderer(renderer:IItemRenderer):void
-		{
-			removeElement(renderer, true);
-			
-			var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
-			newEvent.item = renderer;
-			
-			(host as IEventDispatcher).dispatchEvent(newEvent);
-		}
-		
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#removeAllItemRenderers()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function removeAllItemRenderers():void
-		{
-			while (numElements > 0) {
-				var child:IChild = getElementAt(0);
-				removeItemRenderer(child as IItemRenderer);
-			}
-		}
-		
-		/**
-		 *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererForIndex()
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function getItemRendererForIndex(index:int):IItemRenderer
-		{
-			if (index < 0 || index >= numElements) return null;
-			return getElementAt(index) as IItemRenderer;
-		}
-		
-		/**
-		 *  Refreshes the itemRenderers. Useful after a size change by the data group.
-		 *
-		 *  @copy org.apache.royale.core.IItemRendererParent#updateAllItemRenderers()
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function updateAllItemRenderers():void
-		{
-			var n:Number = numElements;
-			for (var i:Number = 0; i < n; i++)
-			{
-				var renderer:DataItemRenderer = getItemRendererForIndex(i) as DataItemRenderer;
-				if (renderer) {
-					renderer.setWidth(this.width,true);
-					renderer.adjustSize();
-				}
-			}
-		}
 	}
 }
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridControlItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridControlItemRenderer.as
index 513801d..9e3e4f0 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridControlItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeGridControlItemRenderer.as
@@ -75,6 +75,11 @@ package org.apache.royale.html.supportClasses
 		
 		// IItemRendererParent implementation
 		
+        public function get numItemRenderers():int
+        {
+            return 1;
+        }
+        
 		public function addItemRenderer(renderer:IItemRenderer, dispatchAdded:Boolean):void
 		{
 			this.addElement(renderer, dispatchAdded);
@@ -95,6 +100,11 @@ package org.apache.royale.html.supportClasses
 			return child as IItemRenderer;
 		}
 		
+        public function getItemRendererAt(index:int):IItemRenderer
+        {
+            return child as IItemRenderer;
+        }
+        
 		public function removeAllItemRenderers():void
 		{
 			this.removeElement(child);
diff --git a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartCategoryVsLinearLayout.as
b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartCategoryVsLinearLayout.as
index de21680..e6a76a4 100644
--- a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartCategoryVsLinearLayout.as
+++ b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartCategoryVsLinearLayout.as
@@ -143,7 +143,7 @@ package org.apache.royale.charts.beads.layouts
 				if (lcs.lineSegmentRenderer)
 				{
 					var renderer:ILineSegmentItemRenderer = lcs.lineSegmentRenderer.newInstance() as ILineSegmentItemRenderer;
-					chartDataGroup.addElement(renderer);
+					chartDataGroup.addItemRenderer(renderer, true);
 					renderer.itemRendererParent = chartDataGroup;
 					renderer.data = lcs;
 					renderer.points = seriesPoints[s].points;
diff --git a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartLinearVsLinearLayout.as
b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartLinearVsLinearLayout.as
index e4c3c2c..73a1829 100644
--- a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartLinearVsLinearLayout.as
+++ b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/beads/layouts/LineChartLinearVsLinearLayout.as
@@ -157,7 +157,7 @@ package org.apache.royale.charts.beads.layouts
 				if (lcs.lineSegmentRenderer)
 				{
 					var renderer:ILineSegmentItemRenderer = lcs.lineSegmentRenderer.newInstance() as ILineSegmentItemRenderer;
-					chartDataGroup.addElement(renderer);
+					chartDataGroup.addItemRenderer(renderer, true);
 					renderer.itemRendererParent = chartDataGroup;
 					renderer.data = lcs;
 					renderer.points = seriesPoints[s].points;
diff --git a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/core/IChartDataGroup.as
b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/core/IChartDataGroup.as
index 05cd8f2..e73f305 100644
--- a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/core/IChartDataGroup.as
+++ b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/core/IChartDataGroup.as
@@ -18,7 +18,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.charts.core
 {
-	import org.apache.royale.core.IItemRendererParent;
+    import org.apache.royale.core.IItemRendererParent;
 	import org.apache.royale.core.ILayoutView;
 	import org.apache.royale.geom.Point;
 
diff --git a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/optimized/SVGChartDataGroup.as
b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/optimized/SVGChartDataGroup.as
index a68db5d..5816fd4 100644
--- a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/optimized/SVGChartDataGroup.as
+++ b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/optimized/SVGChartDataGroup.as
@@ -82,6 +82,19 @@ package org.apache.royale.charts.optimized
 			return _strand;
 		}
 		
+        /**
+         *  @copy org.apache.royale.core.IItemRendererParent#numItemRenderers()
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.0
+         */
+        public function get numItemRenderers():int
+        {
+            return _children.length;
+        }
+        
 		/**
 		 *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererForIndex()
 		 *  
@@ -96,6 +109,20 @@ package org.apache.royale.charts.optimized
 			return _children[index] as IItemRenderer;
 		}
 		
+        /**
+         *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererAt()
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.0
+         */
+        public function getItemRendererAt(index:int):IItemRenderer
+        {
+            if (index < 0 || index >= _children.length) return null;
+            return _children[index] as IItemRenderer;
+        }
+        
 		/**
 		 *  Returns the itemRenderer that matches both the series and child index. A null return
is
 		 *  valid since some charts have optional itemRenderers for their series.
diff --git a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/supportClasses/ChartDataGroup.as
b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/supportClasses/ChartDataGroup.as
index f9cef89..ab78fba 100644
--- a/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/supportClasses/ChartDataGroup.as
+++ b/frameworks/projects/Charts/src/main/royale/org/apache/royale/charts/supportClasses/ChartDataGroup.as
@@ -26,6 +26,10 @@ package org.apache.royale.charts.supportClasses
 	import org.apache.royale.core.IChild;
 	import org.apache.royale.core.IUIBase;
 	import org.apache.royale.core.UIBase;
+    import org.apache.royale.events.IEventDispatcher;
+    import org.apache.royale.events.ItemAddedEvent;
+    import org.apache.royale.events.ItemClickedEvent;
+    import org.apache.royale.events.ItemRemovedEvent;
 	import org.apache.royale.html.supportClasses.DataGroup;
 	import org.apache.royale.html.supportClasses.DataItemRenderer;
 	import org.apache.royale.geom.Point;
@@ -54,7 +58,152 @@ package org.apache.royale.charts.supportClasses
 			super();
 		}
 		
-		/*
+        /*
+        * IItemRendererParent
+        */
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#numItemRenderers()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         */
+        public function get numItemRenderers():int
+        {
+            return numElements;
+        }
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#addItemRenderer()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         */
+        public function addItemRenderer(renderer:IItemRenderer, dispatchAdded:Boolean):void
+        {
+            addElement(renderer, dispatchAdded);
+            dispatchItemAdded(renderer);
+        }
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#addItemRendererAt()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9
+         */
+        public function addItemRendererAt(renderer:IItemRenderer, index:int):void
+        {
+            addElementAt(renderer, index, true);
+            dispatchItemAdded(renderer);
+        }
+        
+        /**
+         * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+         */
+        private function dispatchItemAdded(renderer:IItemRenderer):void
+        {
+            var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
+            newEvent.item = renderer;
+            
+            (host as IEventDispatcher).dispatchEvent(newEvent);
+        }
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#removeItemRenderer()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         */
+        public function removeItemRenderer(renderer:IItemRenderer):void
+        {
+            removeElement(renderer, true);
+            
+            var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
+            newEvent.item = renderer;
+            
+            (host as IEventDispatcher).dispatchEvent(newEvent);
+        }
+        
+        /**
+         * @copy org.apache.royale.core.IItemRendererParent#removeAllItemRenderers()
+         * @private
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         */
+        public function removeAllItemRenderers():void
+        {
+            while (numElements > 0) {
+                var child:IChild = getElementAt(0);
+                removeItemRenderer(child as IItemRenderer);
+            }
+        }
+        
+        /**
+         *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererForIndex()
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         */
+        public function getItemRendererForIndex(index:int):IItemRenderer
+        {
+            if (index < 0 || index >= numElements) return null;
+            return getElementAt(index) as IItemRenderer;
+        }
+        
+        /**
+         *  @copy org.apache.royale.core.IItemRendererParent#getItemRendererAt()
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         */
+        public function getItemRendererAt(index:int):IItemRenderer
+        {
+            if (index < 0 || index >= numElements) return null;
+            return getElementAt(index) as IItemRenderer;
+        }
+        
+        /**
+         *  Refreshes the itemRenderers. Useful after a size change by the data group.
+         *
+         *  @copy org.apache.royale.core.IItemRendererParent#updateAllItemRenderers()
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         */
+        public function updateAllItemRenderers():void
+        {
+            var n:Number = numElements;
+            for (var i:Number = 0; i < n; i++)
+            {
+                var renderer:DataItemRenderer = getItemRendererForIndex(i) as DataItemRenderer;
+                if (renderer) {
+                    renderer.setWidth(this.width,true);
+                    renderer.adjustSize();
+                }
+            }
+        }
+        
+        /*
 		 * IChartDataGroup
 		 */
 		
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IItemRendererParent.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IItemRendererParent.as
index 96d7c81..10ee019 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IItemRendererParent.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IItemRendererParent.as
@@ -29,7 +29,7 @@ package org.apache.royale.core
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.0
      */
-	public interface IItemRendererParent extends IParent, IEventDispatcher
+	public interface IItemRendererParent extends IEventDispatcher
 	{
         /**
          *  The IItemRendererParent interface is the basic interface for the 
@@ -49,7 +49,9 @@ package org.apache.royale.core
 		function addItemRendererAt(renderer:IItemRenderer, index:int):void;
 		function removeItemRenderer(renderer:IItemRenderer):void;
 		function getItemRendererForIndex(index:int):IItemRenderer;
+        function getItemRendererAt(index:int):IItemRenderer;
 		function removeAllItemRenderers():void;
 		function updateAllItemRenderers():void;
+        function get numItemRenderers():int;
 	}
 }
diff --git a/frameworks/projects/Effects/src/main/royale/org/apache/royale/effects/beads/EasyAccordionCollapseBead.as
b/frameworks/projects/Effects/src/main/royale/org/apache/royale/effects/beads/EasyAccordionCollapseBead.as
index 87fbf4c..e80a1a3 100644
--- a/frameworks/projects/Effects/src/main/royale/org/apache/royale/effects/beads/EasyAccordionCollapseBead.as
+++ b/frameworks/projects/Effects/src/main/royale/org/apache/royale/effects/beads/EasyAccordionCollapseBead.as
@@ -37,10 +37,10 @@ package org.apache.royale.effects.beads
 		
 		private function findPreviousNonCollapsedIndex():int
 		{
-			var n:int = view.dataGroup.numElements;
+			var n:int = view.dataGroup.numItemRenderers;
 			for (var i:int = 0; i < n; i++)
 			{
-				var collapsible:ICollapsible = view.dataGroup.getElementAt(i) as ICollapsible;
+				var collapsible:ICollapsible = view.dataGroup.getItemRendererAt(i) as ICollapsible;
 				if (collapsible.collapsedHeight != (collapsible as ILayoutChild).height)
 				{
 					return i;
@@ -56,9 +56,9 @@ package org.apache.royale.effects.beads
 		
 		override protected function selectedIndexChangedHandler(event:Event):void
 		{
-			var newChild:UIBase = view.dataGroup.getElementAt(host.selectedIndex) as UIBase;
+			var newChild:UIBase = view.dataGroup.getItemRendererAt(host.selectedIndex) as UIBase;
 			var oldChildIndex:int = findPreviousNonCollapsedIndex();
-			var oldCollapsible:ICollapsible = view.dataGroup.getElementAt(oldChildIndex) as ICollapsible;
+			var oldCollapsible:ICollapsible = view.dataGroup.getItemRendererAt(oldChildIndex) as ICollapsible;
 			if (!newChild || oldChildIndex < 0)
 			{
 				return;

-- 
To stop receiving notification emails like this one, please contact
aharui@apache.org.

Mime
View raw message