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 List (not working) initial commit
Date Mon, 21 Nov 2016 21:21:28 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 9626c44b2 -> 863f18f34


MDL List (not working) initial commit


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

Branch: refs/heads/develop
Commit: 863f18f341806b7d210cae3e84690a8f5160800f
Parents: 9626c44
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Mon Nov 21 22:21:21 2016 +0100
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Mon Nov 21 22:21:21 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/App.mxml    |  11 +
 .../src/main/flex/org/apache/flex/mdl/Card.as   |   2 +-
 .../src/main/flex/org/apache/flex/mdl/List.as   | 311 +++++++++++++++++++
 .../src/main/resources/defaults.css             |  15 +
 .../src/main/resources/mdl-manifest.xml         |   1 +
 5 files changed, 339 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/863f18f3/examples/flexjs/MDLExample/src/main/flex/App.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/App.mxml b/examples/flexjs/MDLExample/src/main/flex/App.mxml
index 125d155..88a4c15 100644
--- a/examples/flexjs/MDLExample/src/main/flex/App.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml
@@ -109,6 +109,17 @@ limitations under the License.
                     
                 </js:VContainer>
 
+                <mdl:List id="list" width="130" labelField="label">
+                    <js:dataProvider>
+                        <fx:Array>
+                            <fx:Object label="Install SIM Card"/>
+                            <fx:Object label="Install SIM Card 1"/>
+                            <fx:Object label="Install SIM Card 2"/>
+                        </fx:Array>
+                    </js:dataProvider>
+                </mdl:List>
+
+
                 <js:HContainer>
                     <mdl:Card width="512" shadow="2" style="margin:10;">
                         <mdl:CardTitle className="cardTitle">

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/863f18f3/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Card.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Card.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Card.as
index 14f155b..fbf4196 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Card.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Card.as
@@ -82,7 +82,7 @@ package org.apache.flex.mdl
 		
 		protected var _shadow:Number = 0;
         /**
-		 *  A boolean flag to activate "mdl-shadow--4dp" effect selector.
+		 *  A boolean flag to activate "mdl-shadow--Xdp" effect selector.
 		 *  Assigns variable shadow depths (0, 2, 3, 4, 6, 8, or 16) to card
 		 *
 		 *  @langversion 3.0

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/863f18f3/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
new file mode 100644
index 0000000..4cea3ed
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/List.as
@@ -0,0 +1,311 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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
+{
+	import org.apache.flex.core.ContainerBaseStrandChildren;
+	import org.apache.flex.core.IContentViewHost;
+	import org.apache.flex.core.IDataProviderItemRendererMapper;
+	import org.apache.flex.core.IFactory;
+	import org.apache.flex.core.IItemRendererClassFactory;
+	import org.apache.flex.core.IItemRendererProvider;
+	import org.apache.flex.core.IListPresentationModel;
+	import org.apache.flex.core.IRollOverModel;
+	import org.apache.flex.core.ISelectionModel;
+	import org.apache.flex.core.ListBase;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.core.ValuesManager;
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;
+        import org.apache.flex.html.beads.ListView;
+        import org.apache.flex.html.supportClasses.DataGroup;
+    }
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.html.beads.models.ListPresentationModel;
+	
+	/**
+	 *  Indicates that the initialization of the list is complete.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	[Event(name="initComplete", type="org.apache.flex.events.Event")]
+	
+	/**
+	 * The change event is dispatched whenever the list's selection changes.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+    [Event(name="change", type="org.apache.flex.events.Event")]
+    
+	/**
+	 *  The List class is a component that displays multiple data items. The List uses
+	 *  the following bead types:
+	 * 
+	 *  org.apache.flex.core.IBeadModel: the data model, which includes the dataProvider, selectedItem,
and
+	 *  so forth.
+	 *  org.apache.flex.core.IBeadView:  the bead that constructs the visual parts of the list.
+	 *  org.apache.flex.core.IBeadController: the bead that handles input and output.
+	 *  org.apache.flex.core.IBeadLayout: the bead responsible for the size and position of
the itemRenderers.
+	 *  org.apache.flex.core.IDataProviderItemRendererMapper: the bead responsible for creating
the itemRenders.
+	 *  org.apache.flex.core.IItemRenderer: the class or factory used to display an item in
the list.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class List extends ListBase implements IItemRendererProvider
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function List()
+		{
+			super();
+		}
+		
+		/**
+		 *  The name of field within the data used for display. Each item of the
+		 *  data should have a property with this name.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get labelField():String
+		{
+			return ISelectionModel(model).labelField;
+		}
+		public function set labelField(value:String):void
+		{
+			ISelectionModel(model).labelField = value;
+		}
+		
+		/**
+		 *  The data being display by the List.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+        public function get dataProvider():Object
+        {
+            return ISelectionModel(model).dataProvider;
+        }
+        public function set dataProvider(value:Object):void
+        {
+            ISelectionModel(model).dataProvider = value;
+        }
+
+		/**
+		 *  The index of the currently selected item. Changing this value
+		 *  also changes the selectedItem property.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+        public function get selectedIndex():int
+		{
+			return ISelectionModel(model).selectedIndex;
+		}
+		public function set selectedIndex(value:int):void
+		{
+			ISelectionModel(model).selectedIndex = value;
+		}
+
+		/**
+		 *  The index of the item currently below the pointer.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+        public function get rollOverIndex():int
+		{
+			return IRollOverModel(model).rollOverIndex;
+		}
+		public function set rollOverIndex(value:int):void
+		{
+			IRollOverModel(model).rollOverIndex = value;
+		}
+			
+		/**
+		 *  The presentation model for the list.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get presentationModel():IListPresentationModel
+		{
+			var presModel:IListPresentationModel = getBeadByType(IListPresentationModel) as IListPresentationModel;
+			if (presModel == null) {
+				presModel = new ListPresentationModel();
+				addBead(presModel);
+			}
+			return presModel;
+		}
+		
+		/**
+		 *  The default height of each cell in every column
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get rowHeight():Number
+		{
+			return presentationModel.rowHeight;
+		}
+		public function set rowHeight(value:Number):void
+		{
+			presentationModel.rowHeight = value;
+		}
+		
+		/**
+		 *  The item currently selected. Changing this value also 
+		 *  changes the selectedIndex property.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get selectedItem():Object
+		{
+			return ISelectionModel(model).selectedItem;
+		}
+		public function set selectedItem(value:Object):void
+		{
+			ISelectionModel(model).selectedItem = value;
+		}
+		
+		private var _itemRenderer:IFactory;
+		
+		/**
+		 *  The class or factory used to display each item.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get itemRenderer():IFactory
+		{
+			return _itemRenderer;
+		}
+		public function set itemRenderer(value:IFactory):void
+		{
+			_itemRenderer = value;
+		}
+		
+		/**
+		 * Returns whether or not the itemRenderer property has been set.
+		 *
+		 *  @see org.apache.flex.core.IItemRendererProvider
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function get hasItemRenderer():Boolean
+		{
+			var result:Boolean = false;
+			
+			COMPILE::SWF {
+				result = _itemRenderer != null;
+			}
+			
+			COMPILE::JS {
+				var test:* = _itemRenderer;
+				result = _itemRenderer !== null && test !== undefined;
+			}
+			
+			return result;
+		}
+		
+		
+		/**
+		 * @private
+		 */
+		override public function addedToParent():void
+		{
+            super.addedToParent();
+            
+            if (getBeadByType(IDataProviderItemRendererMapper) == null)
+            {
+                var mapper:IDataProviderItemRendererMapper = new (ValuesManager.valuesImpl.getValue(this,
"iDataProviderItemRendererMapper")) as IDataProviderItemRendererMapper;
+                addBead(mapper);
+            }
+			var itemRendererFactory:IItemRendererClassFactory = getBeadByType(IItemRendererClassFactory)
as IItemRendererClassFactory;
+			if (!itemRendererFactory)
+			{
+				itemRendererFactory = new (ValuesManager.valuesImpl.getValue(this, "iItemRendererClassFactory"))
as IItemRendererClassFactory;
+				addBead(itemRendererFactory);
+			}
+			
+			dispatchEvent(new Event("initComplete"));
+		}
+        
+        /**
+         * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         */
+        COMPILE::JS
+        override protected function createElement():WrappedHTMLElement
+        {
+            super.createElement();
+            className = 'List';
+            
+            return element;
+        }        
+
+        /**
+         * @flexjsignorecoercion org.apache.flex.html.beads.ListView 
+         * @flexjsignorecoercion org.apache.flex.html.supportClasses.DataGroup 
+         */
+        COMPILE::JS
+        override public function internalChildren():Array
+        {
+            var listView:ListView = getBeadByType(ListView) as ListView;
+            var dg:DataGroup = listView.dataGroup as DataGroup;
+            var renderers:Array = dg.internalChildren();
+            return renderers;
+        };
+   	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/863f18f3/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 1d2ef51..40d29f8 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
@@ -30,4 +30,19 @@ Slider
     IBeadModel: ClassReference("org.apache.flex.html.beads.models.RangeModel");
 }
 
+List
+{
+    IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+    IBeadView:  ClassReference("org.apache.flex.html.beads.ListView");			
+    IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+    IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.VerticalLayout");
+    IContentView: ClassReference("org.apache.flex.html.supportClasses.DataGroup");
+    IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");
+    IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+    IItemRenderer: ClassReference("org.apache.flex.html.supportClasses.StringItemRenderer");
+	IViewport: ClassReference("org.apache.flex.html.supportClasses.ScrollingViewport");
+	IViewportModel: ClassReference("org.apache.flex.html.beads.models.ViewportModel");
+	border-style: solid;
+	border-color: #222222;
+}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/863f18f3/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 6540110..53c80e8 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
@@ -40,5 +40,6 @@
     <component id="CardActions" class="org.apache.flex.mdl.CardActions"/>
     <component id="CardMenu" class="org.apache.flex.mdl.CardMenu"/>
     <component id="Spacer" class="org.apache.flex.mdl.Spacer"/>
+    <component id="List" class="org.apache.flex.mdl.List"/>
 
 </componentPackage>


Mime
View raw message