flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject [3/5] git commit: [flex-asjs] [refs/heads/feature/fontawesome] - - Make MDL TabBar as sub component of Tabs - Update MDL example
Date Fri, 06 Jan 2017 23:55:20 GMT
- Make MDL TabBar as sub component of Tabs
- Update MDL example


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

Branch: refs/heads/feature/fontawesome
Commit: ae56b06c080b25d598f8db0e86098e7f5215879e
Parents: c2c4860
Author: piotrz <piotrz@apache.org>
Authored: Fri Jan 6 19:24:55 2017 +0100
Committer: piotrz <piotrz@apache.org>
Committed: Fri Jan 6 19:24:55 2017 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/Tabs.mxml   | 10 +----
 .../src/main/flex/org/apache/flex/mdl/TabBar.as |  3 +-
 .../src/main/flex/org/apache/flex/mdl/Tabs.as   |  9 +++++
 .../org/apache/flex/mdl/beads/views/TabsView.as | 40 ++++++++++++++++++++
 4 files changed, 52 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae56b06c/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml b/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
index d6d36cd..170b469 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
@@ -29,21 +29,13 @@ limitations under the License.
     <mdl:Grid>
 
         <mdl:GridCell column="1" percentWidth="100">
-            <mdl:Tabs width="400" tabIdField="tabId" className="customTabBarPanelItemRenderer">
+            <mdl:Tabs width="400" tabIdField="tabId" labelField="label" className="customTabBarPanelItemRenderer">
                 <mdl:beads>
                     <js:ConstantBinding
                             sourceID="tabsModel"
                             sourcePropertyName="tabs"
                             destinationPropertyName="dataProvider" />
                 </mdl:beads>
-                <mdl:TabBar tabIdField="tabId" labelField="label">
-                    <mdl:beads>
-                        <js:ConstantBinding
-                                sourceID="tabsModel"
-                                sourcePropertyName="tabs"
-                                destinationPropertyName="dataProvider" />
-                    </mdl:beads>
-                </mdl:TabBar>
             </mdl:Tabs>
         </mdl:GridCell>
         <mdl:GridCell column="1" percentWidth="100">

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae56b06c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
index cb487cf..7914818 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
@@ -20,6 +20,7 @@ package org.apache.flex.mdl
 {
 	import org.apache.flex.core.ContainerBase;
     import org.apache.flex.core.IChild;
+    import org.apache.flex.core.IChrome;
     import org.apache.flex.core.IItemRenderer;
     import org.apache.flex.core.IItemRendererParent;
     import org.apache.flex.core.ILayoutHost;
@@ -41,7 +42,7 @@ package org.apache.flex.mdl
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.0
 	 */
-	public class TabBar extends ContainerBase implements IItemRendererParent, ILayoutParent,
ILayoutHost
+	public class TabBar extends ContainerBase implements IItemRendererParent, ILayoutParent,
ILayoutHost, IChrome
 	{
 		/**
 		 *  constructor.

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae56b06c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
index 9ed138a..a5d0a75 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
@@ -77,6 +77,15 @@ package org.apache.flex.mdl
 			ITabModel(model).tabIdField = value;
 		}
 
+        public function get labelField():String
+        {
+            return ITabModel(model).labelField;
+        }
+        public function set labelField(value:String):void
+        {
+            ITabModel(model).labelField = value;
+        }
+
         public function getLayoutHost():ILayoutHost
         {
             return this;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae56b06c/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 bf882d4..e6ffaa6 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
@@ -18,11 +18,51 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.mdl.beads.views
 {
+    import org.apache.flex.core.IContentViewHost;
+    import org.apache.flex.core.IStrandWithModel;
+    import org.apache.flex.events.Event;
+    import org.apache.flex.core.IStrand;
+    import org.apache.flex.mdl.TabBar;
+
     public class TabsView extends ListView
     {
         public function TabsView()
         {
             super();
         }
+
+        private var _tabBar:TabBar;
+
+        public function get tabBar():TabBar
+        {
+            return _tabBar;
+        }
+
+        public function set tabBar(value:TabBar):void
+        {
+            _tabBar = value;
+        }
+
+        override public function set strand(value:IStrand):void
+        {
+            super.strand = value;
+
+            if (!_tabBar)
+            {
+                _tabBar = new TabBar();
+                _tabBar.id = "tabsTabBar";
+            }
+
+            _tabBar.model = (value as IStrandWithModel).model;
+
+            host.addEventListener("initComplete", initCompleteHandler);
+        }
+
+        private function initCompleteHandler(event:Event):void
+        {
+            host.removeEventListener("initComplete", initCompleteHandler);
+            
+            (host as IContentViewHost).strandChildren.addElementAt(tabBar, 0);
+        }
     }
 }


Mime
View raw message