flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [23/40] git commit: [flex-asjs] [refs/heads/tlf] - List now extends DataContainer; ListView extends DataContainerView.
Date Sun, 26 Mar 2017 13:02:15 GMT
List now extends DataContainer; ListView extends DataContainerView.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/e52f0cbf
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/e52f0cbf
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/e52f0cbf

Branch: refs/heads/tlf
Commit: e52f0cbf94747c92df365cf2d1490f7ff32f1078
Parents: f8a71b2
Author: Peter Ent <pent@apache.org>
Authored: Wed Mar 22 06:44:38 2017 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Wed Mar 22 06:44:38 2017 -0400

----------------------------------------------------------------------
 .../flex/org/apache/flex/html/DataContainer.as  |  39 ++--
 .../src/main/flex/org/apache/flex/html/List.as  | 226 +------------------
 .../apache/flex/html/beads/DataContainerView.as |  18 +-
 .../flex/org/apache/flex/html/beads/ListView.as |  84 +------
 4 files changed, 32 insertions(+), 335 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e52f0cbf/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataContainer.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataContainer.as
index 948a953..df8f0b0 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataContainer.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/DataContainer.as
@@ -124,14 +124,6 @@ package org.apache.flex.html
         {
             IDataProviderModel(model).dataProvider = value;
         }
-		
-		/**
-		 * Returns the sub-component that parents all of the item renderers.
-		 */
-		public function get dataGroup():IItemRendererParent
-		{
-			return this;
-		}
 
 			
 		/**
@@ -152,23 +144,23 @@ package org.apache.flex.html
 			return presModel;
 		}
 		
+		/*
+		 * IList and IItemRendererParent
+		 */
+		
 		/**
-		 *  The default height of each cell in every column
+		 * Returns the sub-component that parents all of the item renderers.
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function get rowHeight():Number
-		{
-			return presentationModel.rowHeight;
-		}
-		public function set rowHeight(value:Number):void
+		public function get dataGroup():IItemRendererParent
 		{
-			presentationModel.rowHeight = value;
+			return this;
 		}
-				
+		
 		private var _itemRenderer:IFactory;
 		
 		/**
@@ -205,18 +197,18 @@ package org.apache.flex.html
 			COMPILE::SWF {
 				result = _itemRenderer != null;
 			}
-			
+				
 			COMPILE::JS {
 				var test:* = _itemRenderer;
 				result = _itemRenderer !== null && test !== undefined;
 			}
-			
-			return result;
+				
+				return result;
 		}
 		
 		/*
-		* IItemRendererParent
-		*/
+		 * IItemRendererParent
+		 */
 		
 		/**
 		 * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
@@ -295,9 +287,8 @@ package org.apache.flex.html
 		}
 		
 		/*
-		* UIBase
-		*/
-		
+		 * UIBase
+		 */
 		
 		/**
 		 * @private

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e52f0cbf/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/List.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/List.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/List.as
index bb330c8..7caffff 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/List.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/List.as
@@ -89,7 +89,7 @@ package org.apache.flex.html
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
 	 */
-	public class List extends ListBase implements IList, IItemRendererParent, ILayoutObject
+	public class List extends DataContainer
 	{
 		/**
 		 *  constructor.
@@ -102,43 +102,7 @@ package org.apache.flex.html
 		public function List()
 		{
 			super();
-			addEventListener("beadsAdded", beadsAddedHandler);
 		}
-		
-		/**
-		 *  The name of field within the data used for display. Each item of the
-		 *  data should have a property with this name.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get labelField():String
-		{
-			return ISelectionModel(model).labelField;
-		}
-		public function set labelField(value:String):void
-		{
-			ISelectionModel(model).labelField = value;
-		}
-		
-		/**
-		 *  The data being display by the List.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-        public function get dataProvider():Object
-        {
-            return ISelectionModel(model).dataProvider;
-        }
-        public function set dataProvider(value:Object):void
-        {
-            ISelectionModel(model).dataProvider = value;
-        }
 
 		/**
 		 *  The index of the currently selected item. Changing this value
@@ -174,24 +138,6 @@ package org.apache.flex.html
 		{
 			IRollOverModel(model).rollOverIndex = value;
 		}
-			
-		/**
-		 *  The presentation model for the list.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get presentationModel():IListPresentationModel
-		{
-			var presModel:IListPresentationModel = getBeadByType(IListPresentationModel) as IListPresentationModel;
-			if (presModel == null) {
-				presModel = new ListPresentationModel();
-				addBead(presModel);
-			}
-			return presModel;
-		}
 		
 		/**
 		 *  The default height of each cell in every column
@@ -229,179 +175,9 @@ package org.apache.flex.html
 		}
 		
 		/*
-		 * IList and IItemRendererProvider
-		 */
-		
-		/**
-		 * Provides the DataGroup for this List.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get dataGroup():IItemRendererParent
-		{
-			return this;
-		}
-		
-		private var _itemRenderer:IFactory;
-		
-		/**
-		 *  The class or factory used to display each item.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get itemRenderer():IFactory
-		{
-			return _itemRenderer;
-		}
-		public function set itemRenderer(value:IFactory):void
-		{
-			_itemRenderer = value;
-		}
-		
-		/**
-		 * Returns whether or not the itemRenderer property has been set.
-		 *
-		 *  @see org.apache.flex.core.IItemRendererProvider
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get hasItemRenderer():Boolean
-		{
-			var result:Boolean = false;
-			
-			COMPILE::SWF {
-				result = _itemRenderer != null;
-			}
-			
-			COMPILE::JS {
-				var test:* = _itemRenderer;
-				result = _itemRenderer !== null && test !== undefined;
-			}
-			
-			return result;
-		}
-		
-		/*
-		 * IItemRendererParent
-		 */
-		
-		/**
-		 * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
-		 * @private
-		 */
-		public function addItemRenderer(renderer:IItemRenderer):void
-		{			
-			addElement(renderer, true);
-			
-			var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
-			newEvent.item = renderer;
-			
-			dispatchEvent(newEvent);
-		}
-		
-		/**
-		 * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
-		 * @private
-		 */
-		public function removeItemRenderer(renderer:IItemRenderer):void
-		{				
-			removeElement(renderer, true);
-			
-			var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
-			newEvent.item = renderer;
-			
-			dispatchEvent(newEvent);
-		}
-		
-		/**
-		 * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
-		 * @private
-		 */
-		public function removeAllItemRenderers():void
-		{			
-			while (numElements > 0) {
-				var child:IChild = getElementAt(0);
-				removeElement(child);
-			}
-		}
-		
-		/**
-		 *  @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		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.flex.core.IItemRendererParent#getItemRendererForIndex()
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		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();
-				}
-			}
-		}
-		
-		/*
 		 * UIBase
 		 */
 		
-		/**
-		 * @private
-		 */
-		override public function addedToParent():void
-		{
-            super.addedToParent();
-            		
-			dispatchEvent(new Event("initComplete"));
-		}
-        
-		/**
-		 * @private
-		 */
-	    private function beadsAddedHandler(e:Event):void
-		{
-            if (getBeadByType(IDataProviderItemRendererMapper) == null)
-            {
-                var mapper:IDataProviderItemRendererMapper = new (ValuesManager.valuesImpl.getValue(this,
"iDataProviderItemRendererMapper")) as IDataProviderItemRendererMapper;
-                addBead(mapper);
-            }
-			var itemRendererFactory:IItemRendererClassFactory = getBeadByType(IItemRendererClassFactory)
as IItemRendererClassFactory;
-			if (!itemRendererFactory)
-			{
-				itemRendererFactory = new (ValuesManager.valuesImpl.getValue(this, "iItemRendererClassFactory"))
as IItemRendererClassFactory;
-				addBead(itemRendererFactory);
-			}
-		}
-		
         /**
          * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
          */

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e52f0cbf/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataContainerView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataContainerView.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataContainerView.as
index 5036b6b..de3587e 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataContainerView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataContainerView.as
@@ -62,7 +62,7 @@ package org.apache.flex.html.beads
 			super();
 		}
 		
-		protected var listModel:IDataProviderModel;
+		protected var dataModel:IDataProviderModel;
 		
 		public function get dataGroup():IItemRendererParent
 		{
@@ -72,9 +72,9 @@ package org.apache.flex.html.beads
 		override protected function beadsAddedHandler(event:Event):void
 		{
 			
-			listModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel;
+			dataModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel;
 			host.addEventListener("itemsCreated", itemsCreatedHandler);
-			listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+			dataModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
 			
 			super.beadsAddedHandler(event);
 		}
@@ -104,7 +104,7 @@ package org.apache.flex.html.beads
 			super();
 		}
 						
-		protected var listModel:IDataProviderModel;
+		protected var dataModel:IDataProviderModel;
 		
 		/**
 		 * @private
@@ -137,9 +137,14 @@ package org.apache.flex.html.beads
 			host.removeEventListener("childrenAdded", childrenChangedHandler);
 			host.removeEventListener("childrenAdded", performLayout);
 			host.addEventListener("itemsCreated", itemsCreatedHandler);
+		}
+		
+		override protected function beadsAddedHandler(event:Event):void
+		{
+			super.beadsAddedHandler(event);
 			
-			listModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel;
-			listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+			dataModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel;
+			dataModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
 		}
 		
 		/**
@@ -189,6 +194,7 @@ package org.apache.flex.html.beads
          */
 		override protected function resizeHandler(event:Event):void
 		{
+			// might need to do something here, not sure yet.
 			super.resizeHandler(event);
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e52f0cbf/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ListView.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ListView.as
index f27d388..4087f1c 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ListView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ListView.as
@@ -58,7 +58,7 @@ package org.apache.flex.html.beads
 	 *  @productversion FlexJS 0.0
 	 */
 	COMPILE::JS
-	public class ListView extends ContainerView implements IListView
+	public class ListView extends DataContainerView
 	{
 		public function ListView()
 		{
@@ -66,21 +66,15 @@ package org.apache.flex.html.beads
 		}
 		
 		protected var listModel:ISelectionModel;
-		protected var lastSelectedIndex:int = -1;
 		
-		public function get dataGroup():IItemRendererParent
-		{
-			return (_strand as IList).dataGroup;
-		}
+		protected var lastSelectedIndex:int = -1;
 		
 		override protected function beadsAddedHandler(event:Event):void
 		{
 			
 			listModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
-			host.addEventListener("itemsCreated", itemsCreatedHandler);
 			listModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
 			//listModel.addEventListener("rollOverIndexChanged", rollOverIndexChangeHandler);
-			listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
 			
 			super.beadsAddedHandler(event);
 		}
@@ -99,41 +93,17 @@ package org.apache.flex.html.beads
 			}
 			lastSelectedIndex = listModel.selectedIndex;
 		}
-		
-		/**
-		 * @private
-		 */
-		protected function itemsCreatedHandler(event:Event):void
-		{
-			performLayout(event);
-		}
-		
-		/**
-		 * @private
-		 */
-		protected function dataProviderChangeHandler(event:Event):void
-		{
-			performLayout(event);
-		}
 	}
 	
 	COMPILE::SWF
-	public class ListView extends ContainerView implements IListView
+	public class ListView extends DataContainerView
 	{
 		public function ListView()
 		{
 			super();
 		}
-						
+		
 		protected var listModel:ISelectionModel;
-        
-        /**
-         * @private
-         */
-        override public function get host():IUIBase
-        {
-            return _strand as IUIBase;
-        }
         		
 		/**
 		 *  @copy org.apache.flex.core.IBead#strand
@@ -149,17 +119,6 @@ package org.apache.flex.html.beads
 			super.strand = value;
 		}
 		
-		override protected function completeSetup():void
-		{
-			super.completeSetup();
-			
-			// list is not interested in UI children, it wants to know when new items
-			// have been added or the dataProvider has changed.
-			host.removeEventListener("childrenAdded", childrenChangedHandler);
-			host.removeEventListener("childrenAdded", performLayout);
-			host.addEventListener("itemsCreated", itemsCreatedHandler);
-		}
-		
 		override protected function beadsAddedHandler(event:Event):void
 		{
 			super.beadsAddedHandler(event);
@@ -167,12 +126,6 @@ package org.apache.flex.html.beads
 			listModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
 			listModel.addEventListener("selectedIndexChanged", selectionChangeHandler);
 			listModel.addEventListener("rollOverIndexChanged", rollOverIndexChangeHandler);
-			listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-		}
-		
-		public function get dataGroup():IItemRendererParent
-		{
-			return (_strand as IList).dataGroup;
 		}
 		
 		protected var lastSelectedIndex:int = -1;
@@ -180,22 +133,6 @@ package org.apache.flex.html.beads
 		/**
 		 * @private
 		 */
-		protected function itemsCreatedHandler(event:Event):void
-		{
-			performLayout(event);
-		}
-		
-		/**
-		 * @private
-		 */
-		protected function dataProviderChangeHandler(event:Event):void
-		{
-			performLayout(event);
-		}
-		
-		/**
-		 * @private
-		 */
 		protected function selectionChangeHandler(event:Event):void
 		{
 			if (lastSelectedIndex != -1)
@@ -230,18 +167,5 @@ package org.apache.flex.html.beads
 			}
 			lastRollOverIndex = IRollOverModel(listModel).rollOverIndex;
 		}
-        
-        /**
-         *  respond to a change in size or request to re-layout everything
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-		override protected function resizeHandler(event:Event):void
-		{
-			super.resizeHandler(event);
-		}
 	}
 }


Mime
View raw message