royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject [royale-asjs] branch develop updated: Single selection of MDL Table row implementation
Date Sun, 03 Dec 2017 11:34:01 GMT
This is an automated email from the ASF dual-hosted git repository.

piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new e0bcb89  Single selection of MDL Table row implementation
e0bcb89 is described below

commit e0bcb8984e826f32957aa6f5e90690e531b8c74d
Author: Piotr Zarzycki <piotrzarzycki21@gmail.com>
AuthorDate: Sun Dec 3 12:33:52 2017 +0100

    Single selection of MDL Table row implementation
    
    - Single selection of MDL Table row implementation
    - MDL TableView now extends ListView
    - Rename TableRowItemMouseRenderer to TableRowItemSingleSelectionMouseRenderer
---
 .../src/main/resources/mdl-manifest.xml            |   2 +-
 .../org/apache/royale/mdl/beads/views/TableView.as | 110 +--------------------
 .../mdl/itemRenderers/TableRowItemRenderer.as      |  19 ++--
 ...=> TableRowItemSingleSelectionMouseRenderer.as} |  18 +++-
 4 files changed, 29 insertions(+), 120 deletions(-)

diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
index db665b5..13e745c 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
@@ -60,7 +60,7 @@
     <component id="THead" class="org.apache.royale.mdl.THead"/>
     <component id="TableColumn" class="org.apache.royale.mdl.TableColumn"/>
     <component id="TableRowItemRenderer" class="org.apache.royale.mdl.itemRenderers.TableRowItemRenderer"/>
-    <component id="TableRowItemMouseRenderer" class="org.apache.royale.mdl.itemRenderers.TableRowItemMouseRenderer"/>
+    <component id="TableRowItemMouseRenderer" class="org.apache.royale.mdl.itemRenderers.TableRowItemSingleSelectionMouseRenderer"/>
     <component id="TableCell" class="org.apache.royale.mdl.TableCell"/>
     <component id="TableView" class="org.apache.royale.mdl.beads.views.TableView"/>
     <component id="TableNumericCellEnable" class="org.apache.royale.mdl.beads.TableNumericEnable"/>
diff --git a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/views/TableView.as
b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/views/TableView.as
index b047086..994a002 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/views/TableView.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/beads/views/TableView.as
@@ -18,15 +18,12 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.mdl.beads.views
 {
-	import org.apache.royale.core.BeadViewBase;
 	import org.apache.royale.core.IBeadLayout;
 	import org.apache.royale.core.IDataProviderItemRendererMapper;
-	import org.apache.royale.core.IItemRendererParent;
 	import org.apache.royale.core.IStrand;
 	import org.apache.royale.core.ISelectionModel;
 	import org.apache.royale.core.ValuesManager;
 	import org.apache.royale.events.Event;
-	import org.apache.royale.html.beads.IListView;
 	import org.apache.royale.utils.loadBeadFromValuesManager;
 
 	/**
@@ -37,116 +34,11 @@ package org.apache.royale.mdl.beads.views
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.8
      */
-	public class TableView extends BeadViewBase implements IListView
+	public class TableView extends ListView
 	{
-		/**
-		 *  constructor.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
 		public function TableView()
 		{
 			super();
 		}
-
-		/**
-		 *  data group
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		public function get dataGroup():IItemRendererParent
-		{
-			return _strand as IItemRendererParent;
-		}
-
-		/**
-		 *  table model
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		protected var tableModel:ISelectionModel;
-
-        /**
-         * @copy org.apache.royale.core.BeadViewBase#strand
-         *
-         * @param value
-		 *
-		 * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion Royale 0.8
-         */
-		override public function set strand(value:IStrand):void
-		{
-			super.strand = value;
-    		
-			loadBeadFromValuesManager(IDataProviderItemRendererMapper, "iDataProviderItemRendererMapper",
_strand);
-
-			host.addEventListener("itemsCreated", itemsCreatedHandler);
-
-			tableModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
-			tableModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
-
-			performLayout(null);
-		}
-		
-		/**
-		 *  @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		protected function itemsCreatedHandler(event:Event):void
-		{
-			performLayout(event);
-		}
-
-		/**
-		 *  @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		protected function dataProviderChangeHandler(event:Event):void
-		{
-			performLayout(event);
-		}
-
-		private var _layout:IBeadLayout;
-		private function get layout():IBeadLayout
-		{
-			if(!_layout)
-				_layout = loadBeadFromValuesManager(IBeadLayout, "iBeadLayout", _strand) as IBeadLayout;
-			
-			return _layout;
-		}
-
-		/**
-		 *  @private
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.8
-		 */
-		protected function performLayout(event:Event):void
-		{
-			if (layout) {
-				layout.layout();
-			}
-		}
 	}
 }
diff --git a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemRenderer.as
b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemRenderer.as
index 34400f9..0ef30f7 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemRenderer.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemRenderer.as
@@ -24,6 +24,7 @@ package org.apache.royale.mdl.itemRenderers
 		import org.apache.royale.html.util.addElementToWrapper;
     }
 
+	import org.apache.royale.html.TableRow;
 	import org.apache.royale.html.supportClasses.MXMLItemRenderer;
     
 	/**
@@ -48,7 +49,9 @@ package org.apache.royale.mdl.itemRenderers
 		{
 			super();
 		}
-		
+
+		protected var row:TableRow;
+
 		private var _text:String = "";
 
         /**
@@ -98,7 +101,7 @@ package org.apache.royale.mdl.itemRenderers
 				if(textNode != null)
 				{
 					textNode.nodeValue = text;
-				}	
+				}
 			}
 		}
 		COMPILE::JS
@@ -123,9 +126,11 @@ package org.apache.royale.mdl.itemRenderers
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
+            row = new TableRow();
+
             if(MXMLDescriptor == null)
 			{
-                positioner = document.createElement('tr') as WrappedHTMLElement;
+                positioner = row.element;
 				
 				addElementToWrapper(this,'td');
                 element.classList.add("mdl-data-table__cell--non-numeric");
@@ -136,9 +141,11 @@ package org.apache.royale.mdl.itemRenderers
 				element.appendChild(textNode);
                 positioner.royale_wrapper = this;
                 return positioner;
-			} else {
-				addElementToWrapper(this,'tr');
-                positioner = element;
+			}
+			else
+			{
+                positioner = row.element;
+				element = row.element;
                 return element;
             }
         }
diff --git a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemMouseRenderer.as
b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemSingleSelectionMouseRenderer.as
similarity index 76%
rename from frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemMouseRenderer.as
rename to frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemSingleSelectionMouseRenderer.as
index 965c4de..ac16b81 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemMouseRenderer.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/royale/org/apache/royale/mdl/itemRenderers/TableRowItemSingleSelectionMouseRenderer.as
@@ -25,14 +25,14 @@ package org.apache.royale.mdl.itemRenderers
     }
     
 	/**
-	 *  The TableRowItemMouseRenderer defines the basic Item Renderer for a MDL Table Component
and handles mouse events, notifying about them host component.
+	 *  The TableRowItemSingleSelectionMouseRenderer defines the basic Item Renderer for a MDL
Table Component and handles mouse events, notifying about them host component.
 	 *
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10.2
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.8
 	 */
-	public class TableRowItemMouseRenderer extends TableRowItemRenderer
+	public class TableRowItemSingleSelectionMouseRenderer extends TableRowItemRenderer
 	{
 		/**
 		 *  constructor.
@@ -42,7 +42,7 @@ package org.apache.royale.mdl.itemRenderers
 		 *  @playerversion AIR 2.6
 		 *  @productversion Royale 0.9
 		 */
-		public function TableRowItemMouseRenderer()
+		public function TableRowItemSingleSelectionMouseRenderer()
 		{
 			super();
 		}
@@ -63,7 +63,17 @@ package org.apache.royale.mdl.itemRenderers
 
         override public function updateRenderer():void
         {
-
+            COMPILE::JS
+            {
+                if (selected)
+                {
+                    row.element.classList.add("is-selected");
+                }
+                else
+                {
+                    row.element.classList.remove("is-selected");
+                }
+            }
         }
 	}
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <commits@royale.apache.org>'].

Mime
View raw message