flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [31/50] [abbrv] git commit: [flex-asjs] [refs/heads/dual] - - Fix issue with double generated Tabs - completeSetup method was called to many times in TabsView - Dispatch itemsCreated even if we add only one Tab
Date Tue, 18 Apr 2017 06:17:55 GMT
- Fix issue with double generated Tabs - completeSetup method was called to many times in TabsView
- Dispatch itemsCreated even if we add only one Tab


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

Branch: refs/heads/dual
Commit: 7f8b440dc725a0d2fae5e4535511418c10b7b8be
Parents: f4138d0
Author: piotrz <piotrz@apache.org>
Authored: Sun Apr 9 23:50:40 2017 +0200
Committer: piotrz <piotrz@apache.org>
Committed: Sun Apr 9 23:50:40 2017 +0200

----------------------------------------------------------------------
 .../TabsItemRendererFactoryForArrayListData.as  | 16 +++------------
 .../org/apache/flex/mdl/beads/views/TabsView.as | 21 ++++++++------------
 2 files changed, 11 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7f8b440d/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
index defa8e8..97fac23 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
@@ -32,7 +32,6 @@ package org.apache.flex.mdl.beads
 
     import org.apache.flex.events.EventDispatcher;
     import org.apache.flex.events.IEventDispatcher;
-    import org.apache.flex.events.ItemRendererEvent;
     import org.apache.flex.html.beads.IListView;
     import org.apache.flex.mdl.beads.models.ITabModel;
     import org.apache.flex.mdl.supportClasses.ITabItemRenderer;
@@ -89,7 +88,6 @@ package org.apache.flex.mdl.beads
          */
         private function finishSetup(event:Event):void
         {
-            IEventDispatcher(_strand).removeEventListener("beadsAdded",finishSetup);
             IEventDispatcher(_strand).removeEventListener("initComplete",finishSetup);
 
             dataProviderModel = _strand.getBeadByType(ITabModel) as ITabModel;
@@ -172,10 +170,6 @@ package org.apache.flex.mdl.beads
                     UIBase(ir).percentWidth = 100;
                 }
                 ir.data = dp.getItemAt(i);
-
-                var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
-                newEvent.itemRenderer = ir;
-                dispatchEvent(newEvent);
             }
 
             IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
@@ -190,7 +184,8 @@ package org.apache.flex.mdl.beads
             var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel)
as IListPresentationModel;
 
             var ir:ITabItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as
ITabItemRenderer;
-            dataGroup.addElement(ir);
+            dataGroup.addItemRenderer(ir);
+            
             ir.index = dp.length - 1;
             ir.labelField = labelField;
             ir.tabIdField = tabsIdField;
@@ -204,12 +199,7 @@ package org.apache.flex.mdl.beads
             }
             ir.data = event.item;
 
-            var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
-            newEvent.itemRenderer = ir;
-            dispatchEvent(newEvent);
-
-            //??IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
-			IEventDispatcher(_strand).dispatchEvent(new Event("itemAdded"));
+            IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7f8b440d/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 3516123..ffe291a 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
@@ -94,11 +94,10 @@ package org.apache.flex.mdl.beads.views
             }
 
             _tabBar.model = (value as IStrandWithModel).model;
-
+            
             if (!isTabsDynamic())
             {
                 _tabBar.addEventListener("itemsCreated", tabBarItemsCreatedHandler);
-				_tabBar.addEventListener("itemAdded", tabBarItemsCreatedHandler);
             }
         }
 
@@ -106,7 +105,7 @@ package org.apache.flex.mdl.beads.views
         {
             super.itemsCreatedHandler(event);
 
-            completeSetup();
+            completeTabBarSetup();
         }
 
         private function tabBarItemsCreatedHandler(event:Event):void
@@ -114,17 +113,13 @@ package org.apache.flex.mdl.beads.views
             forceUpgradeTabs();
         }
 
-        /**
-		 *  complete setup
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.8
-		 */
-        override protected function completeSetup():void
+        protected function completeTabBarSetup():void
         {
-			(host as IContentViewHost).addElementAt(tabBar,0);
+			var tb:TabBar = (host as IContentViewHost).getElementAt(0) as TabBar;
+            if (!tb)
+            {
+                (host as IContentViewHost).strandChildren.addElementAt(tabBar, 0);
+            }
 
             selectTabBarPanel();
         }


Mime
View raw message