royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [royale-asjs] 02/03: Revert "Adding all dataProviders at once"
Date Wed, 11 Apr 2018 08:54:44 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 899da859fb1d4fb4472e095d39742116e30aad09
Author: Harbs <harbs@in-tools.com>
AuthorDate: Wed Apr 11 10:37:11 2018 +0300

    Revert "Adding all dataProviders at once"
    
    This reverts commit 83087b44e0a673613df9ad6bc04c8e491520d78d.
---
 .../org/apache/royale/core/DataContainerBase.as    | 30 ----------------------
 .../beads/DataItemRendererFactoryForArrayData.as   | 14 ++++------
 .../beads/DataItemRendererFactoryForArrayList.as   | 21 +++++----------
 .../beads/DataItemRendererFactoryForColumnData.as  | 15 +++--------
 .../beads/TextItemRendererFactoryForArrayData.as   | 16 +++++-------
 .../TextItemRendererFactoryForStringVectorData.as  | 20 ++++-----------
 .../apache/royale/html/supportClasses/DataGroup.as | 29 ---------------------
 .../supportClasses/TreeGridControlItemRenderer.as  | 23 -----------------
 .../org/apache/royale/core/IItemRendererParent.as  |  1 -
 9 files changed, 26 insertions(+), 143 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 5d6584c..af014c1 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
@@ -162,36 +162,6 @@ package org.apache.royale.core
 		/*
 		* IItemRendererParent
 		*/
-
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#addItemRenderers()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function addItemRenderers(renderers:Array,dispatch:Boolean):void
-		{
-			var len:int = renderers.length;
-			for(var i:int = 0; i < len; i++)
-			{
-				addElement(renderers[i], false);
-				
-			}
-			//TODO every other childrenAdded event is a ValueEvent with the child as payload
-			if(dispatch)
-				this.dispatchEvent(new Event("childrenAdded"));
-			// Loop a second time to dispatch events once they are all added
-			for(i = 0; i < len; i++)
-			{
-				var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
-				newEvent.item = renderers[i];
-				
-				dispatchEvent(newEvent);
-			}
-		}
 		
 		/**
 		 * @copy org.apache.royale.core.IItemRendererParent#addItemRenderer()
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayData.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayData.as
index 1d8693f..6ae7281 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayData.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayData.as
@@ -175,7 +175,7 @@ package org.apache.royale.html.beads
 			var dataGroup:IItemRendererParent = list.dataGroup;
 			
 			dataGroup.removeAllItemRenderers();
-			var renderers:Array = [];
+			
 			var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel)
as IListPresentationModel;
 			
 			var n:int = dp.length; 
@@ -184,7 +184,7 @@ package org.apache.royale.html.beads
 				var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as
ISelectableItemRenderer;
                 var dataItemRenderer:DataItemRenderer = ir as DataItemRenderer;
 
-				// dataGroup.addItemRenderer(ir);
+				dataGroup.addItemRenderer(ir);
 				ir.index = i;
 				ir.labelField = labelField;
                 if (dataItemRenderer)
@@ -199,14 +199,10 @@ package org.apache.royale.html.beads
 					UIBase(ir).height = presentationModel.rowHeight;
 					UIBase(ir).percentWidth = 100;
 				}
-				renderers[i] = ir;
-			}
-			dataGroup.addItemRenderers(renderers, false);
-			for(i=0;i<n;i++)
-			{
-				renderers[i].data = dp[i];
+				ir.data = dp[i];
+				
 				var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
-				newEvent.itemRenderer = renderers[i];
+				newEvent.itemRenderer = ir;
 				dispatchEvent(newEvent);
 			}
 			
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayList.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayList.as
index 40aa545..3060417 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayList.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForArrayList.as
@@ -147,8 +147,6 @@ package org.apache.royale.html.beads
 		
 		/**
 		 * @private
-		 * @royaleignorecoercion org.apache.royale.core.UIBase
-		 * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
 		 */
 		protected function dataProviderChangeHandler(event:Event):void
 		{
@@ -163,14 +161,13 @@ package org.apache.royale.html.beads
 			
 			var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel)
as IListPresentationModel;
 			
-			var renderers:Array = [];
 			var n:int = dp.length; 
 			for (var i:int = 0; i < n; i++)
 			{				
 				var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as
ISelectableItemRenderer;
 				var dataItemRenderer:DataItemRenderer = ir as DataItemRenderer;
 
-				// dataGroup.addItemRenderer(ir);
+				dataGroup.addItemRenderer(ir);
 				if (presentationModel) {
 					var style:SimpleCSSStyles = new SimpleCSSStyles();
 					style.marginBottom = presentationModel.separatorThickness;
@@ -179,25 +176,21 @@ package org.apache.royale.html.beads
 					UIBase(ir).percentWidth = 100;
 				}
 
-				// var data:Object = dp.getItemAt(i);
-                // ir.index = i;
+				var data:Object = dp.getItemAt(i);
+                ir.index = i;
                 ir.labelField = labelField;
 				if (dataItemRenderer)
 				{
 					dataItemRenderer.dataField = dataField;
 				}
 
-				renderers[i] = ir;
-			}
-			dataGroup.addItemRenderers(renderers, false);
-			for(i=0;i<n;i++)
-			{
-				setData(renderers[i], dp.getItemAt(i), i);
+				setData(ir, data, i);
+
 				var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
-				newEvent.itemRenderer = renderers[i];
+				newEvent.itemRenderer = ir;
 				dispatchEvent(newEvent);
-
 			}
+
 			IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
 		}
 	}
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForColumnData.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForColumnData.as
index 0f982aa..8a0e169 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForColumnData.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DataItemRendererFactoryForColumnData.as
@@ -124,10 +124,6 @@ package org.apache.royale.html.beads
 		
 		/**
 		 * @private
-		 * @royaleignorecoercion Array
-		 * @royaleignorecoercion org.apache.royale.core.IList
-		 * @royaleignorecoercion org.apache.royale.html.supportClasses.DataItemRenderer
-		 * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
 		 */
 		private function dataProviderChangeHandler(event:Event):void
 		{
@@ -139,7 +135,7 @@ package org.apache.royale.html.beads
 			var dataGroup:IItemRendererParent = list.dataGroup;
 			
 			dataGroup.removeAllItemRenderers();
-			var renderers:Array = [];
+						
 			var view:DataGridColumnView = _strand.getBeadByType(IBeadView) as DataGridColumnView;
 			if (view == null) return;
 						
@@ -147,15 +143,10 @@ package org.apache.royale.html.beads
 			for (var i:int = 0; i < n; i++)
 			{
 				var tf:DataItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as DataItemRenderer;
-				// dataGroup.addItemRenderer(tf);
+				dataGroup.addItemRenderer(tf);
 				tf.index = i;
 				tf.labelField = view.column.dataField;
-				renderers[i] = tf;
-			}
-			dataGroup.addItemRenderers(renderers, false);
-			for(i=0;i<n;i++)
-			{
-                renderers[i].data = dp[i];
+				tf.data = dp[i];
 			}
 			
 			IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForArrayData.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForArrayData.as
index ecac388..9ab6424 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForArrayData.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForArrayData.as
@@ -137,7 +137,7 @@ package org.apache.royale.html.beads
          *  @royaleignorecoercion Array
          *  @royaleignorecoercion org.apache.royale.html.beads.ITextItemRenderer
          *  @royaleignorecoercion org.apache.royale.events.IEventDispatcher
-         *  @royaleignorecoercion org.apache.royale.core.IList
+         * @royaleignorecoercion org.apache.royale.core.IList
          */
 		private function dataProviderChangeHandler(event:Event):void
 		{
@@ -149,24 +149,20 @@ package org.apache.royale.html.beads
 			var dataGroup:IItemRendererParent = list.dataGroup;
 
 			dataGroup.removeAllItemRenderers();
-            var renderers:Array = [];
+
 			var n:int = dp.length;
 			for (var i:int = 0; i < n; i++)
 			{
 				var tf:ITextItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITextItemRenderer;
                 tf.index = i;
-                // dataGroup.addItemRenderer(tf);
+                dataGroup.addItemRenderer(tf);
                 if (selectionModel.labelField) {
                 	tf.labelField = selectionModel.labelField;
                 }
-                renderers[i] = tf;
-			}
-			dataGroup.addItemRenderers(renderers, false);
-			for(i=0;i<n;i++)
-			{
-                renderers[i].data = dp[i];
+                tf.data = dp[i];
+
 				var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
-				newEvent.itemRenderer = renderers[i];
+				newEvent.itemRenderer = tf;
 				dispatchEvent(newEvent);
 			}
 
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForStringVectorData.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForStringVectorData.as
index d329955..48e1b48 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForStringVectorData.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/TextItemRendererFactoryForStringVectorData.as
@@ -131,10 +131,6 @@ package org.apache.royale.html.beads
          */
         protected var dataGroup:IItemRendererParent;
 		
-        /**
-         * @royaleignorecoercion Vector.<String>
-         * @royaleignorecoercion org.apache.royale.html.beads.ITextItemRenderer
-         */
 		private function dataProviderChangeHandler(event:Event):void
 		{
 			var dp:Vector.<String> = selectionModel.dataProvider as Vector.<String>;
@@ -143,25 +139,19 @@ package org.apache.royale.html.beads
 			var dataGroup:IItemRendererParent = list.dataGroup;
 			
 			dataGroup.removeAllItemRenderers();
-			var renderers:Array = [];
+			
 			var n:int = dp.length; 
 			for (var i:int = 0; i < n; i++)
 			{
 				var tf:ITextItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITextItemRenderer;
                 tf.index = i;
-                // dataGroup.addItemRenderer(tf);
+                dataGroup.addItemRenderer(tf);
+				tf.text = dp[i];
 				
-                renderers[i] = tf;
-			}
-			dataGroup.addItemRenderers(renderers, true);
-			for(i=0;i<n;i++)
-			{
-				renderers[i].text = dp[i];
 				var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
-				newEvent.itemRenderer = renderers[i];
+				newEvent.itemRenderer = tf;
 				dispatchEvent(newEvent);
-
-			}
+			}			
 		}
 		
 	}
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 4e2f117..5c60482 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
@@ -59,35 +59,6 @@ package org.apache.royale.html.supportClasses
 		/*
 		* IItemRendererParent
 		*/
-
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#addItemRenderers()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function addItemRenderers(renderers:Array, dispatch:Boolean):void
-		{
-			var len:int = renderers.length;
-			for(var i:int = 0; i < len; i++)
-			{
-				addElement(renderers[i], false);
-				
-			}
-			//TODO every other childrenAdded event is a ValueEvent with the child as payload
-			if(dispatch)
-				this.dispatchEvent(new Event("childrenAdded"));
-			// Loop a second time to dispatch events once they are all added
-			for(i = 0; i < len; i++)
-			{
-				var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
-				newEvent.item = renderers[i];	
-				dispatchEvent(newEvent);
-			}
-		}
 		
 		/**
 		 * @copy org.apache.royale.core.IItemRendererParent#addItemRenderer()
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 3725f1a..b18ee9a 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
@@ -22,7 +22,6 @@ package org.apache.royale.html.supportClasses
 	import org.apache.royale.core.IItemRendererClassFactory;
 	import org.apache.royale.core.IItemRendererParent;
 	import org.apache.royale.core.UIBase;
-	import org.apache.royale.events.Event;
 	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.events.ItemAddedEvent;
 	import org.apache.royale.html.TextButton;
@@ -75,28 +74,6 @@ package org.apache.royale.html.supportClasses
 		}
 		
 		// IItemRendererParent implementation
-
-		/**
-		 * @copy org.apache.royale.core.IItemRendererParent#addItemRenderers()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function addItemRenderers(renderers:Array, dispatch:Boolean):void
-		{
-			var len:int = renderers.length;
-			for(var i:int = 0; i < len; i++)
-			{
-				addElement(renderers[i], false);
-				
-			}
-			//TODO every other childrenAdded event is a ValueEvent with the child as payload
-			if(dispatch)
-				this.dispatchEvent(new Event("childrenAdded"));
-		}
 		
 		public function addItemRenderer(renderer:IItemRenderer):void
 		{
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 5177c81..d7cd5cc 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
@@ -46,7 +46,6 @@ package org.apache.royale.core
          *  @productversion Royale 0.0
          */
 		function addItemRenderer(renderer:IItemRenderer):void;
-		function addItemRenderers(renderers:Array,dispatch:Boolean):void;
 		function addItemRendererAt(renderer:IItemRenderer, index:int):void;
 		function removeItemRenderer(renderer:IItemRenderer):void;
 		function getItemRendererForIndex(index:int):IItemRenderer;

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

Mime
View raw message