flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - MDL ListItemRenderer working
Date Thu, 08 Dec 2016 18:33:23 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 88b398194 -> cd83687f7


MDL ListItemRenderer working


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

Branch: refs/heads/develop
Commit: cd83687f7a55e3d27ef98b0b6d85523a7f84317d
Parents: 88b3981
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Thu Dec 8 19:33:18 2016 +0100
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Thu Dec 8 19:33:18 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/Lists.mxml  |   9 ++
 .../itemRenderers/CustomListItemRenderer.mxml   |  30 ++++
 .../main/flex/itemRenderers/ListItemRenderer.as | 139 -------------------
 .../src/main/resources/mdl-styles.css           |   4 +-
 .../flex/mdl/itemRenderers/ListItemRenderer.as  | 139 +++++++++++++++++++
 .../src/main/resources/defaults.css             |   4 +-
 .../src/main/resources/mdl-manifest.xml         |   1 +
 7 files changed, 183 insertions(+), 143 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cd83687f/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 5a48a68..fa2cd77 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Lists.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Lists.mxml
@@ -36,6 +36,15 @@ limitations under the License.
                     destinationPropertyName="dataProvider" />
             </mdl:beads>
         </mdl:List>
+
+        <mdl:List labelField="label" className="customListItemRenderer">
+            <mdl:beads>
+                <js:ConstantBinding
+                    sourceID="model"
+                    sourcePropertyName="productNames"
+                    destinationPropertyName="dataProvider" />
+            </mdl:beads>
+        </mdl:List>
     </mdl:Grid>
 
     <!--xmlns:ui="org.apache.flex.core.*"

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cd83687f/examples/flexjs/MDLExample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml
b/examples/flexjs/MDLExample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml
new file mode 100644
index 0000000..6486a27
--- /dev/null
+++ b/examples/flexjs/MDLExample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml
@@ -0,0 +1,30 @@
+<?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">
+
+    <js:Container>
+        <js:Span text="hello"/>
+        
+    </js:Container>
+</mdl:ListItemRenderer>
+

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cd83687f/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ListItemRenderer.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ListItemRenderer.as b/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ListItemRenderer.as
deleted file mode 100644
index 6c17275..0000000
--- a/examples/flexjs/MDLExample/src/main/flex/itemRenderers/ListItemRenderer.as
+++ /dev/null
@@ -1,139 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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 itemRenderers
-{
-    COMPILE::JS
-    {
-        import org.apache.flex.core.WrappedHTMLElement;
-        import org.apache.flex.html.beads.controllers.ItemRendererMouseController;      
 
-    }
-    import org.apache.flex.events.Event;
-    import org.apache.flex.html.beads.ITextItemRenderer;
-
-    import org.apache.flex.html.supportClasses.DataItemRenderer;
-    
-	/**
-	 *  The StringItemRenderer class displays data in string form using the data's toString()
-	 *  function.
-	 *
-	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion FlexJS 0.0
-	 */
-	public class ListItemRenderer extends DataItemRenderer implements ITextItemRenderer
-	{
-		/**
-		 *  constructor.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function ListItemRenderer()
-		{
-			super();
-			
-            className = ""; //set to empty string avoid 'undefined' output when no class
selector is assigned by user;
-		}
-		
-        private var _text:String = "";
-		/**
-		 *  The text currently displayed by the itemRenderer instance.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		public function get text():String
-		{
-            return _text;
-
-            COMPILE::JS
-            {
-                return this.element.innerHTML;
-            }
-		}
-		
-		public function set text(value:String):void
-		{
-            _text = value;                    
-            
-            COMPILE::JS
-            {
-                this.element.innerHTML = value;
-            }
-		}
-		
-		/**
-		 *  Sets the data value and uses the String version of the data for display.
-		 * 
-		 *  @param Object data The object being displayed by the itemRenderer instance.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.0
-		 */
-		override public function set data(value:Object):void
-		{
-			super.data = value;
-            var text:String;
-			if (labelField) {
-                text = String(value[labelField]);
-            } else if (dataField) {
-                text = String(value[dataField]);
-            } else {
-                text = String(value);
-            }
-            
-            trace("the text: " + text);
-            this.text = text;
-		}
-		
-        COMPILE::JS
-        private var controller:ItemRendererMouseController;
-            
-        COMPILE::JS
-        private var backgroundView:WrappedHTMLElement;
-        
-        /**
-         * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
-         */
-        COMPILE::JS
-        override protected function createElement():WrappedHTMLElement
-        {
-            typeNames = "mdl-list__item";
-
-            element = document.createElement('li') as WrappedHTMLElement;
-            
-            positioner = element;
-            element.flexjs_wrapper = this;
-            
-            // itemRenderers should provide something for the background to handle
-            // the selection and highlight
-            backgroundView = element;
-            
-            return element;
-        }
-
-	}
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cd83687f/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 42bd916..3136d47 100644
--- a/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css
+++ b/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css
@@ -41,9 +41,9 @@ js|Image
 	IBeadView:  ClassReference("org.apache.flex.html.beads.ImageView");
 }
 
-List
+.customListItemRenderer
 {
-    IItemRenderer: ClassReference("itemRenderers.ListItemRenderer");
+    IItemRenderer: ClassReference("itemRenderers.CustomListItemRenderer");
 }
 
 .layoutTransparent {

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cd83687f/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/ListItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/ListItemRenderer.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/ListItemRenderer.as
new file mode 100644
index 0000000..c09a91a
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/ListItemRenderer.as
@@ -0,0 +1,139 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.flex.mdl.itemRenderers
+{
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+        import org.apache.flex.html.beads.controllers.ItemRendererMouseController;      
 
+    }
+    import org.apache.flex.events.Event;
+    import org.apache.flex.html.beads.ITextItemRenderer;
+
+    import org.apache.flex.html.supportClasses.DataItemRenderer;
+    
+	/**
+	 *  The StringItemRenderer class displays data in string form using the data's toString()
+	 *  function.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class ListItemRenderer extends DataItemRenderer implements ITextItemRenderer
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function ListItemRenderer()
+		{
+			super();
+			
+            className = ""; //set to empty string avoid 'undefined' output when no class
selector is assigned by user;
+		}
+		
+        private var _text:String = "";
+		/**
+		 *  The text currently displayed by the itemRenderer instance.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get text():String
+		{
+            return _text;
+
+            COMPILE::JS
+            {
+                return this.element.innerHTML;
+            }
+		}
+		
+		public function set text(value:String):void
+		{
+            _text = value;                    
+            
+            COMPILE::JS
+            {
+                this.element.innerHTML = value;
+            }
+		}
+		
+		/**
+		 *  Sets the data value and uses the String version of the data for display.
+		 * 
+		 *  @param Object data The object being displayed by the itemRenderer instance.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		override public function set data(value:Object):void
+		{
+			super.data = value;
+            var text:String;
+			if (labelField) {
+                text = String(value[labelField]);
+            } else if (dataField) {
+                text = String(value[dataField]);
+            } else {
+                text = String(value);
+            }
+            
+            trace("the text: " + text);
+            this.text = text;
+		}
+		
+        COMPILE::JS
+        private var controller:ItemRendererMouseController;
+            
+        COMPILE::JS
+        private var backgroundView:WrappedHTMLElement;
+        
+        /**
+         * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         */
+        COMPILE::JS
+        override protected function createElement():WrappedHTMLElement
+        {
+            typeNames = "mdl-list__item";
+
+            element = document.createElement('li') as WrappedHTMLElement;
+            
+            positioner = element;
+            element.flexjs_wrapper = this;
+            
+            // itemRenderers should provide something for the background to handle
+            // the selection and highlight
+            backgroundView = element;
+            
+            return element;
+        }
+
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cd83687f/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
index c871bc9..2894c29 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
@@ -42,9 +42,9 @@ List
 {
     IBeadView: ClassReference("org.apache.flex.mdl.beads.views.ListView");
     IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
-    IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+    IBeadLayout: ClassReference(null); /*"org.apache.flex.html.beads.layouts.VerticalLayout"*/
     IDataProviderItemRendererMapper: ClassReference("org.apache.flex.mdl.supportClasses.ItemRendererFactoryForArrayData");
     IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
-    IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+    IItemRenderer: ClassReference("org.apache.flex.mdl.itemRenderers.ListItemRenderer");
 }
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cd83687f/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
index 02fa733..b33b148 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
@@ -44,6 +44,7 @@
     <component id="Spacer" class="org.apache.flex.mdl.Spacer"/>
     <component id="List" class="org.apache.flex.mdl.List"/>
     <component id="ListView" class="org.apache.flex.mdl.beads.views.ListView"/>
+    <component id="ListItemRenderer" class="org.apache.flex.mdl.itemRenderers.ListItemRenderer"/>
     <component id="ItemRendererFactoryForArrayData" class="org.apache.flex.mdl.supportClasses.ItemRendererFactoryForArrayData"/>
     <component id="NavigationLayout" class="org.apache.flex.mdl.NavigationLayout"/>
     <component id="LayoutTitle" class="org.apache.flex.mdl.LayoutTitle"/>


Mime
View raw message