flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - - Add to MDL TabsItemRendererFactoryForArrayListData logic for handling adding item do data provider
Date Wed, 01 Mar 2017 20:11:28 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 5921ec3cd -> ad1f49fa2


- Add to MDL TabsItemRendererFactoryForArrayListData logic for handling adding item do data
provider


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

Branch: refs/heads/develop
Commit: ad1f49fa2a74dff93611742a16520efc7129433c
Parents: 5921ec3
Author: piotrz <piotrz@apache.org>
Authored: Wed Mar 1 21:11:24 2017 +0100
Committer: piotrz <piotrz@apache.org>
Committed: Wed Mar 1 21:11:24 2017 +0100

----------------------------------------------------------------------
 .../flex/org/apache/flex/mdl/RadioButton.as     |  2 +-
 .../TabsItemRendererFactoryForArrayListData.as  | 33 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad1f49fa/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as
index 10453d6..e23f8bc 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as
@@ -467,7 +467,7 @@ package org.apache.flex.mdl
         {
             if (_isDynamic && ripple)
             {
-                var elementChildren:Object = element.children;
+                var elementChildren:Object = (element as HTMLElement).children;
                 for (var i:int = 0; i < elementChildren.length; i++)
                 {
                     var child:Object = elementChildren[i];

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad1f49fa/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 fb4131c..b1c191d 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
@@ -28,6 +28,8 @@ package org.apache.flex.mdl.beads
     import org.apache.flex.core.SimpleCSSStyles;
     import org.apache.flex.core.UIBase;
     import org.apache.flex.core.ValuesManager;
+    import org.apache.flex.events.CollectionEvent;
+
     import org.apache.flex.events.EventDispatcher;
     import org.apache.flex.events.IEventDispatcher;
     import org.apache.flex.events.ItemRendererEvent;
@@ -94,6 +96,7 @@ package org.apache.flex.mdl.beads
             var listView:IListView = _strand.getBeadByType(IListView) as IListView;
             dataGroup = listView.dataGroup;
             dataProviderModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+            dataProviderModel.addEventListener(CollectionEvent.ITEM_ADDED, itemAddedHandler);
 
             tabsIdField = dataProviderModel.tabIdField;
             labelField = dataProviderModel.labelField;
@@ -177,5 +180,35 @@ package org.apache.flex.mdl.beads
 
             IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
         }
+
+        private function itemAddedHandler(event:CollectionEvent):void
+        {
+            var dp:IArrayList = dataProviderModel.dataProvider as IArrayList;
+            if (!dp)
+                return;
+
+            var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel)
as IListPresentationModel;
+
+            var ir:ITabItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as
ITabItemRenderer;
+            dataGroup.addElement(ir);
+            ir.index = dp.length - 1;
+            ir.labelField = labelField;
+            ir.tabIdField = tabsIdField;
+
+            if (presentationModel) {
+                var style:SimpleCSSStyles = new SimpleCSSStyles();
+                style.marginBottom = presentationModel.separatorThickness;
+                UIBase(ir).style = style;
+                UIBase(ir).height = presentationModel.rowHeight;
+                UIBase(ir).percentWidth = 100;
+            }
+            ir.data = event.item;
+
+            var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
+            newEvent.itemRenderer = ir;
+            dispatchEvent(newEvent);
+
+            IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+        }
     }
 }


Mime
View raw message