flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [05/50] [abbrv] git commit: [flex-asjs] [refs/heads/dual] - Update to MDL List component.
Date Tue, 18 Apr 2017 06:17:29 GMT
Update to MDL List component.


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

Branch: refs/heads/dual
Commit: de48d638ebc365c2d86f020f06fe51b1d428c7f4
Parents: 4a89d4d
Author: Peter Ent <pent@apache.org>
Authored: Sun Apr 2 14:32:17 2017 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Sun Apr 2 14:32:17 2017 -0400

----------------------------------------------------------------------
 .../src/main/flex/org/apache/flex/mdl/List.as   | 491 ++++++++++---------
 .../org/apache/flex/mdl/beads/views/ListView.as |  91 +---
 .../apache/flex/mdl/beads/views/TabBarView.as   |   2 +-
 .../org/apache/flex/mdl/beads/views/TabsView.as |   2 +-
 4 files changed, 261 insertions(+), 325 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/de48d638/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
index a9d78e9..3c8d3aa 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
@@ -30,6 +30,8 @@ package org.apache.flex.mdl
 	import org.apache.flex.core.IChild;
 	import org.apache.flex.events.ItemAddedEvent;
 	import org.apache.flex.events.ItemRemovedEvent;
+	import org.apache.flex.core.ListBase;
+	import org.apache.flex.html.List;
 
     COMPILE::JS
     {
@@ -47,247 +49,268 @@ package org.apache.flex.mdl
      *  @playerversion Flash 10.2
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
-     */  
-	public class List extends UIBase implements IItemRendererParent, ILayoutParent, ILayoutHost,
ILayoutView, IList
+     */ 
+	public class List extends org.apache.flex.html.List
 	{
-        /**
-         *  Constructor.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function List()
-		{
-			super();
-
-            className = ""; //set to empty string avoid 'undefined' output when no class
selector is assigned by user;
-		}
-
-		/**
-         *  @copy org.apache.flex.core.IDataProviderModel#dataProvider
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function get dataProvider():Object
-		{
-			return ISelectionModel(model).dataProvider;
-		}
-		/**
-         *  @private
-         */
-		public function set dataProvider(value:Object):void
-		{
-			ISelectionModel(model).dataProvider = value;
-		}
-
-		/**
-         *  @copy org.apache.flex.core.IDataProviderModel#labelField
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function get labelField():String
-		{
-			return ISelectionModel(model).labelField;
-		}
-		/**
-         *  @private
-         */
-		public function set labelField(value:String):void
-		{
-			ISelectionModel(model).labelField = value;
-		}
-
-		/**
-         *  get layout host
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function getLayoutHost():ILayoutHost
-		{
-			return this;
-		}
-
-		/**
-         *  get content view
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function get contentView():ILayoutView
-		{
-			return this;
-		}
-
-        /**
-         *  @copy org.apache.flex.core.IList#dataGroup
-         *
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		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.8
+		 * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
 		 */
-		public function get hasItemRenderer():Boolean
+		COMPILE::JS
+		override protected function createElement():WrappedHTMLElement
 		{
-			var result:Boolean = false;
+			typeNames = "mdl-list";
 			
-			COMPILE::SWF {
-				result = _itemRenderer != null;
-			}
-				
-				COMPILE::JS {
-					var test:* = _itemRenderer;
-					result = _itemRenderer !== null && test !== undefined;
-				}
-				
-				return result;
-		}
-		
-		/**
-		 * @copy org.apache.flex.core.IItemRendererParent#addItemRenderer()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.8
-		 */
-		public function addItemRenderer(renderer:IItemRenderer):void
-		{
-			addElement(renderer, true);
+			element = document.createElement('ul') as WrappedHTMLElement;
 			
-			var newEvent:ItemAddedEvent = new ItemAddedEvent("itemAdded");
-			newEvent.item = renderer;
+			positioner = element;
+			element.flexjs_wrapper = this;
 			
-			dispatchEvent(newEvent);
+			return positioner;
 		}
-		
-		/**
-		 * @copy org.apache.flex.core.IItemRendererParent#removeItemRenderer()
-		 * @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.8
-		 */
-		public function removeItemRenderer(renderer:IItemRenderer):void
-		{
-			removeElement(renderer, true);
-			
-			var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
-			newEvent.item = renderer;
-			
-			dispatchEvent(newEvent);
-		}
-
-		/**
-         *  get item renderer for index
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function getItemRendererForIndex(index:int):IItemRenderer
-		{
-			var child:IItemRenderer = getElementAt(index) as IItemRenderer;
-			return child;
-		}
-
-		/**
-         *  remove all elements
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function removeAllItemRenderers():void
-		{
-			while (numElements > 0) {
-				var child:IChild = getElementAt(0);
-				removeElement(child);
-			}
-		}
-
-		/**
-         *  update all item renderers
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.8
-         */
-		public function updateAllItemRenderers():void
-		{
-			//todo: IItemRenderer does not define update function but DataItemRenderer does
-			//for(var i:int = 0; i < numElements; i++) {
-			//	var child:IItemRenderer = getElementAt(i) as IItemRenderer;
-			//	child.update();
-			//}
-		}
-
-        /**
-         * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
-         */
-        COMPILE::JS
-        override protected function createElement():WrappedHTMLElement
-        {
-            typeNames = "mdl-list";
-            
-            element = document.createElement('ul') as WrappedHTMLElement;
-            
-            positioner = element;
-            element.flexjs_wrapper = this;
-            
-            return positioner;
-        }  
 	}
+	
+// This is the previous version of List. Please discard when sure the new List class works.
+// 
+//	public class List extends UIBase implements IItemRendererParent, ILayoutParent, ILayoutHost,
ILayoutView, IList
+//	{
+//        /**
+//         *  Constructor.
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function List()
+//		{
+//			super();
+//
+//            className = ""; //set to empty string avoid 'undefined' output when no class
selector is assigned by user;
+//		}
+//
+//		/**
+//         *  @copy org.apache.flex.core.IDataProviderModel#dataProvider
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function get dataProvider():Object
+//		{
+//			return ISelectionModel(model).dataProvider;
+//		}
+//		/**
+//         *  @private
+//         */
+//		public function set dataProvider(value:Object):void
+//		{
+//			ISelectionModel(model).dataProvider = value;
+//		}
+//
+//		/**
+//         *  @copy org.apache.flex.core.IDataProviderModel#labelField
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function get labelField():String
+//		{
+//			return ISelectionModel(model).labelField;
+//		}
+//		/**
+//         *  @private
+//         */
+//		public function set labelField(value:String):void
+//		{
+//			ISelectionModel(model).labelField = value;
+//		}
+//
+//		/**
+//         *  get layout host
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function getLayoutHost():ILayoutHost
+//		{
+//			return this;
+//		}
+//
+//		/**
+//         *  get content view
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function get contentView():ILayoutView
+//		{
+//			return this;
+//		}
+//
+//        /**
+//         *  @copy org.apache.flex.core.IList#dataGroup
+//         *
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		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.8
+//		 */
+//		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;
+//		}
+//		
+//		/**
+//		 * @copy org.apache.flex.core.IItemRendererParent#addItemRenderer()
+//		 * @private
+//		 *
+//		 *  @langversion 3.0
+//		 *  @playerversion Flash 10.2
+//		 *  @playerversion AIR 2.6
+//		 *  @productversion FlexJS 0.8
+//		 */
+//		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#removeItemRenderer()
+//		 * @private
+//		 *
+//		 *  @langversion 3.0
+//		 *  @playerversion Flash 10.2
+//		 *  @playerversion AIR 2.6
+//		 *  @productversion FlexJS 0.8
+//		 */
+//		public function removeItemRenderer(renderer:IItemRenderer):void
+//		{
+//			removeElement(renderer, true);
+//			
+//			var newEvent:ItemRemovedEvent = new ItemRemovedEvent("itemRemoved");
+//			newEvent.item = renderer;
+//			
+//			dispatchEvent(newEvent);
+//		}
+//
+//		/**
+//         *  get item renderer for index
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function getItemRendererForIndex(index:int):IItemRenderer
+//		{
+//			var child:IItemRenderer = getElementAt(index) as IItemRenderer;
+//			return child;
+//		}
+//
+//		/**
+//         *  remove all elements
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function removeAllItemRenderers():void
+//		{
+//			while (numElements > 0) {
+//				var child:IChild = getElementAt(0);
+//				removeElement(child);
+//			}
+//		}
+//
+//		/**
+//         *  update all item renderers
+//         *  
+//         *  @langversion 3.0
+//         *  @playerversion Flash 10.2
+//         *  @playerversion AIR 2.6
+//         *  @productversion FlexJS 0.8
+//         */
+//		public function updateAllItemRenderers():void
+//		{
+//			//todo: IItemRenderer does not define update function but DataItemRenderer does
+//			//for(var i:int = 0; i < numElements; i++) {
+//			//	var child:IItemRenderer = getElementAt(i) as IItemRenderer;
+//			//	child.update();
+//			//}
+//		}
+//
+//        /**
+//         * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+//         */
+//        COMPILE::JS
+//        override protected function createElement():WrappedHTMLElement
+//        {
+//            typeNames = "mdl-list";
+//            
+//            element = document.createElement('ul') as WrappedHTMLElement;
+//            
+//            positioner = element;
+//            element.flexjs_wrapper = this;
+//            
+//            return positioner;
+//        }  
+//	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/de48d638/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/ListView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/ListView.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/ListView.as
index f4fbb4c..95321c3 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/ListView.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/ListView.as
@@ -26,6 +26,7 @@ package org.apache.flex.mdl.beads.views
 	import org.apache.flex.core.ISelectionModel;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.html.beads.IListView;
+	import org.apache.flex.html.beads.ListView;
 
 	import org.apache.flex.events.Event;
 
@@ -37,99 +38,11 @@ package org.apache.flex.mdl.beads.views
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.8
      */
-	public class ListView extends BeadViewBase implements IListView
+	public class ListView extends org.apache.flex.html.beads.ListView
 	{
 		public function ListView()
 		{
 			super();
 		}
-
-		public function get dataGroup():IItemRendererParent
-		{
-			return _strand as IItemRendererParent;
-		}
-
-		protected var listModel:ISelectionModel;
-
-        /**
-         * @copy org.apache.flex.core.BeadViewBase#strand
-         *
-         * @param value
-		 *
-		 * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion FlexJS 0.8
-         */
-		override public function set strand(value:IStrand):void
-		{
-			super.strand = value;
-
-			var mapper:IDataProviderItemRendererMapper = _strand.getBeadByType(IDataProviderItemRendererMapper)
as IDataProviderItemRendererMapper;
-			if (mapper == null) {
-				var c:Class = ValuesManager.valuesImpl.getValue(host, "iDataProviderItemRendererMapper");
-				if (c) {
-					mapper = new c() as IDataProviderItemRendererMapper;
-					_strand.addBead(mapper);
-				}
-			}
-
-			host.addEventListener("itemsCreated", itemsCreatedHandler);
-
-			listModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
-			listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-
-			performLayout(null);
-		}
-
-		/**
-		 * @private
-		 *
-		 * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion FlexJS 0.8
-		 */
-		protected function itemsCreatedHandler(event:Event):void
-		{
-			performLayout(event);
-		}
-
-		/**
-		 * @private
-		 *
-		 * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion FlexJS 0.8
-		 */
-		protected function dataProviderChangeHandler(event:Event):void
-		{
-			performLayout(event);
-		}
-
-		/**
-		 * @private
-		 *
-		 * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion FlexJS 0.8
-		 */
-		protected function performLayout(event:Event):void
-		{
-			var layout:IBeadLayout = _strand.getBeadByType(IBeadLayout) as IBeadLayout;
-			if (layout == null) {
-				var c:Class = ValuesManager.valuesImpl.getValue(host, "iBeadLayout");
-				if (c) {
-					layout = new c() as IBeadLayout;
-					_strand.addBead(layout);
-				}
-			}
-
-			if (layout) {
-				layout.layout();
-			}
-		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/de48d638/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
index cb809ed..86d25b2 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
@@ -63,7 +63,7 @@ package org.apache.flex.mdl.beads.views
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.8
 		 */
-        protected function completeSetup():void
+        override protected function completeSetup():void
         {
             selectTabBarButton();
         }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/de48d638/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
index 7833f5d..741b0db 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
@@ -122,7 +122,7 @@ package org.apache.flex.mdl.beads.views
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.8
 		 */
-        protected function completeSetup():void
+        override protected function completeSetup():void
         {
             var tb:TabBar = (host as IContentViewHost).strandChildren.getElementAt(0) as
TabBar;
             if (!tb)


Mime
View raw message