Repository: flex-asjs
Updated Branches:
  refs/heads/develop 75245a623 -> caaf5cd3f


More List Examples


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

Branch: refs/heads/develop
Commit: caaf5cd3f81fa82ec92dddc4684fd321ee03a556
Parents: 75245a6
Author: Carlos Rovira <carlosrov...@apache.org>
Authored: Sat Dec 10 12:50:02 2016 +0100
Committer: Carlos Rovira <carlosrov...@apache.org>
Committed: Sat Dec 10 12:50:02 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/Lists.mxml  | 24 ++++++++---
 .../itemRenderers/ActorListItemRenderer.mxml    | 44 ++++++++++++++++++++
 .../src/main/flex/models/ListsModel.as          | 30 +++++++++----
 .../MDLExample/src/main/flex/vos/ActorVO.as     | 31 ++++++++++++++
 .../src/main/resources/mdl-styles.css           |  5 +++
 5 files changed, 120 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/caaf5cd3/examples/flexjs/MDLExample/src/main/flex/Lists.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/Lists.mxml 
b/examples/flexjs/MDLExample/src/main/flex/Lists.mxml
index fa2cd77..d18dbf5 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Lists.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Lists.mxml
@@ -28,26 +28,40 @@ limitations under the License.
        </mdl:model>
 
     <mdl:Grid>
-        <mdl:List labelField="label">
+        <mdl:List>
             <mdl:beads>
                 <js:ConstantBinding
                     sourceID="model"
-                    sourcePropertyName="productNames"
+                    sourcePropertyName="things"
                     destinationPropertyName="dataProvider" />
             </mdl:beads>
         </mdl:List>
 
-        <mdl:List labelField="label" className="customListItemRenderer">
+        <mdl:List labelField="actorName" className="actorListItemRenderer">
             <mdl:beads>
                 <js:ConstantBinding
                     sourceID="model"
-                    sourcePropertyName="productNames"
+                    sourcePropertyName="actors"
                     destinationPropertyName="dataProvider" />
             </mdl:beads>
         </mdl:List>
     </mdl:Grid>
 
-    <!--xmlns:ui="org.apache.flex.core.*"
+
+
+
+    <!--
+    <mdl:List labelField="label" className="customListItemRenderer">
+            <mdl:beads>
+                <js:ConstantBinding
+                    sourceID="model"
+                    sourcePropertyName="productNames"
+                    destinationPropertyName="dataProvider" />
+            </mdl:beads>
+        </mdl:List>
+    
+    
+    xmlns:ui="org.apache.flex.core.*"
                  xmlns:models="org.apache.flex.html.beads.models.*"
                  xmlns:beads="org.apache.flex.html.beads.*"
                  xmlns:controllers="org.apache.flex.html.beads.controllers.*"

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/caaf5cd3/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ActorListItemRenderer.mxml
----------------------------------------------------------------------
diff --git 
a/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ActorListItemRenderer.mxml
 
b/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ActorListItemRenderer.mxml
new file mode 100644
index 0000000..b4b33b5
--- /dev/null
+++ 
b/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ActorListItemRenderer.mxml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009";
+                      xmlns:js="library://ns.apache.org/flexjs/basic"
+                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
+                      xmlns="http://www.w3.org/1999/xhtml";>
+
+    <fx:Script>
+               <![CDATA[
+                       import vos.ActorVO;
+            
+            [Bindable("dataChange")]
+            public function get actor():ActorVO
+            {
+                return data as ActorVO;
+            }
+               ]]>
+       </fx:Script>
+
+    <js:beads>
+        <js:ItemRendererDataBinding />
+    </js:beads>
+    
+    <mdl:ListItemPrimaryContent text="{actor.actorName}"/>
+      
+</mdl:ListItemRenderer>
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/caaf5cd3/examples/flexjs/MDLExample/src/main/flex/models/ListsModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/models/ListsModel.as 
b/examples/flexjs/MDLExample/src/main/flex/models/ListsModel.as
index dabcc46..3480999 100644
--- a/examples/flexjs/MDLExample/src/main/flex/models/ListsModel.as
+++ b/examples/flexjs/MDLExample/src/main/flex/models/ListsModel.as
@@ -19,26 +19,38 @@
 package models
 {
        import org.apache.flex.events.EventDispatcher;
+       import vos.*;
 
        public class ListsModel extends EventDispatcher
        {
-               public function ListsModel()
+               /**
+                * Used in the List example.
+                */
+               private var _things:Array = [
+                       "A", 
+                       "Simple", 
+                       "List",
+                       "Example"
+               ];
+               
+               public function get things():Array
                {
+                       return _things;
                }
 
                /**
                 * Used in the List example.
                 */
-               private var _productNames:Array = [
-                       {label:"Widgets"},
-                       {label:"Thingys"},
-                       {label:"Sprockets"},
-                       {label:"Doohickies"}
+               private var _actors:Array = [
+                       new ActorVO("Bryan Cranston"),
+                       new ActorVO("Aaron Paul"),
+                       new ActorVO("Bob Odenkirk")
                ];
                
-               public function get productNames():Array
+               public function get actors():Array
                {
-                       return _productNames;
-               }
+                       return _actors;
+               }               
+
        }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/caaf5cd3/examples/flexjs/MDLExample/src/main/flex/vos/ActorVO.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/vos/ActorVO.as 
b/examples/flexjs/MDLExample/src/main/flex/vos/ActorVO.as
new file mode 100644
index 0000000..808948f
--- /dev/null
+++ b/examples/flexjs/MDLExample/src/main/flex/vos/ActorVO.as
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package vos
+{
+    [Bindable]
+       public class ActorVO
+       {
+               public function ActorVO(actorName:String = null)
+               {
+                       this.actorName = actorName;
+               }
+
+               public var actorName:String = "";
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/caaf5cd3/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css 
b/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css
index 3136d47..aac2219 100644
--- a/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css
+++ b/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css
@@ -41,6 +41,11 @@ js|Image
        IBeadView:  ClassReference("org.apache.flex.html.beads.ImageView");
 }
 
+.actorListItemRenderer
+{
+    IItemRenderer: ClassReference("itemRenderers.ActorListItemRenderer");
+}
+
 .customListItemRenderer
 {
     IItemRenderer: ClassReference("itemRenderers.CustomListItemRenderer");

Reply via email to