You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/12/29 12:07:48 UTC

[royale-asjs] branch develop updated: jewel-group: Make StyledUIBase the base class for Jewel Group and DataGroup. This ends the refsactor for Jewel to have StyledUIBase as the base of all components

This is an automated email from the ASF dual-hosted git repository.

carlosrovira 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 7af0616  jewel-group: Make StyledUIBase the base class for Jewel Group and DataGroup. This ends the refsactor for Jewel to have StyledUIBase as the base of all components
7af0616 is described below

commit 7af0616be036abe83dd36780c551ab3a75a9d92c
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Dec 29 13:07:36 2019 +0100

    jewel-group: Make StyledUIBase the base class for Jewel Group and DataGroup. This ends the refsactor for Jewel to have StyledUIBase as the base of all components
---
 .../royale/org/apache/royale/jewel/Container.as    |   8 +-
 .../royale/org/apache/royale/jewel/DataGrid.as     |  34 +---
 .../main/royale/org/apache/royale/jewel/Group.as   | 188 +++++++++++----------
 .../royale/jewel/supportClasses/list/DataGroup.as  |   7 +-
 4 files changed, 101 insertions(+), 136 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
index b60757c..a1a305d 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Container.as
@@ -84,13 +84,7 @@ package org.apache.royale.jewel
 			super();
 			typeNames = "";
 		}
-
-        COMPILE::JS
-        override protected function setClassName(value:String):void
-        {
-            classSelectorList.addNames(value);
-        }
-
+		
         protected var _layout:StyledLayoutBase;
 
         /**
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataGrid.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataGrid.as
index 7d5a3ff..6662754 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataGrid.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataGrid.as
@@ -23,7 +23,6 @@ package org.apache.royale.jewel
 	import org.apache.royale.core.IDataGridModel;
 	import org.apache.royale.core.IDataGridPresentationModel;
 	import org.apache.royale.core.ValuesManager;
-	import org.apache.royale.utils.IEmphasis;
 	
 	[Event(name="change", type="org.apache.royale.events.Event")]
 	
@@ -41,7 +40,7 @@ package org.apache.royale.jewel
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.7
 	 */
-	public class DataGrid extends Group implements IDataGrid, IEmphasis
+	public class DataGrid extends Group implements IDataGrid
 	{
 		/**
 		 *  constructor.
@@ -223,36 +222,5 @@ package org.apache.royale.jewel
 		{
 			(presentationModel as IDataGridPresentationModel).rowHeight = value;
 		}
-
-		private var _emphasis:String;
-        /**
-		 *  Applies emphasis color display. Possible constant values are: PRIMARY, SECONDARY, EMPHASIZED.
-         *  Colors are defined in royale jewel theme CSS.
-         * 
-         *  Left without value to get the default look (light or dark).
-         *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.7
-		 */
-        public function get emphasis():String
-        {
-            return _emphasis;
-        }
-        [Inspectable(category="General", enumeration="primary,secondary,emphasized")]
-        public function set emphasis(value:String):void
-        {
-            if (_emphasis != value)
-            {
-                if(_emphasis)
-                {
-					toggleClass(_emphasis, false);
-                }
-                _emphasis = value;
-
-                toggleClass(_emphasis, value);
-            }
-        }
 	}
 }
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as
index 89a8bda..5bf88c8 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Group.as
@@ -18,14 +18,32 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.jewel
 {
-	import org.apache.royale.html.Group;
-	import org.apache.royale.jewel.beads.layouts.StyledLayoutBase;
-	import org.apache.royale.utils.ClassSelectorList;
-	import org.apache.royale.utils.IClassSelectorListSupport;
-	import org.apache.royale.utils.StringUtil;
+    import org.apache.royale.core.IMXMLDocument;
+    import org.apache.royale.core.ValuesManager;
+    import org.apache.royale.events.Event;
+    import org.apache.royale.jewel.beads.layouts.StyledLayoutBase;
+    import org.apache.royale.jewel.supportClasses.group.GroupBase;
+    import org.apache.royale.utils.MXMLDataInterpreter;
+    import org.apache.royale.utils.StringUtil;
 
     /**
-     *  The Group class provides a light-weight container for visual elements. By default
+	 *  Indicates that the children of the container is have been added.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.8
+	 */
+	[Event(name="childrenAdded", type="org.apache.royale.events.Event")]
+	
+	/**
+	 * The default property uses when additional MXML content appears within an element's
+	 * definition in an MXML file.
+	 */
+	[DefaultProperty("mxmlContent")]
+
+    /**
+     *  The Jewel Group class provides a light-weight container for visual elements. By default
 	 *  the Group does not have a layout, allowing its children to be sized and positioned
 	 *  using styles or CSS.
      *
@@ -37,7 +55,7 @@ package org.apache.royale.jewel
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.9.4
      */
-	public class Group extends org.apache.royale.html.Group implements IClassSelectorListSupport
+	public class Group extends GroupBase implements IMXMLDocument
 	{
         /**
          *  Constructor.
@@ -50,98 +68,84 @@ package org.apache.royale.jewel
 		public function Group()
 		{
 			super();
-            classSelectorList = new ClassSelectorList(this);
             typeNames = "";
 		}
 
-        protected var classSelectorList:ClassSelectorList;
-
-        COMPILE::JS
-        override protected function setClassName(value:String):void
-        {
-            classSelectorList.addNames(value);
-        }
-
-        /**
-         * Add a class selector to the list.
-         * 
-         * @param name Name of selector to add.
-         * 
-         * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion Royale 0.9.4
-         */
-        public function addClass(name:String):void
-        {
-            COMPILE::JS
-            {
-            classSelectorList.add(name);
-            }
-        }
-
-        /**
-         * Removes a class selector from the list.
-         * 
-         * @param name Name of selector to remove.
-         *
-         * @royaleignorecoercion HTMLElement
-         * @royaleignorecoercion DOMTokenList
-         * 
-         * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion Royale 0.9.4
-         */
-        public function removeClass(name:String):void
-        {
-            COMPILE::JS
-            {
-            classSelectorList.remove(name);
-            }
-        }
-
-        /**
-         * Add or remove a class selector to/from the list.
-         * 
-         * @param name Name of selector to add or remove.
-         * @param value True to add, False to remove.
-         * 
-         * @langversion 3.0
-         * @playerversion Flash 10.2
-         * @playerversion AIR 2.6
-         * @productversion Royale 0.9.4
-         */
-        public function toggleClass(name:String, value:Boolean):void
-        {
-            COMPILE::JS
-            {
-            classSelectorList.toggle(name, value);
-            }
-        }
-
-        /**
-		 *  Search for the name in the element class list 
-		 *
-         *  @param name Name of selector to find.
-         *  @return return true if the name is found or false otherwise.
-         * 
+        private var _mxmlDescriptor:Array;
+		private var _mxmlDocument:Object = this;
+		private var _initialized:Boolean;
+		
+		/**
+		 * @private
+		 */
+		override public function addedToParent():void
+		{
+			if (!_initialized)
+			{
+				// each MXML file can also have styles in fx:Style block
+				ValuesManager.valuesImpl.init(this);
+			}
+			
+			super.addedToParent();
+			
+			if (!_initialized)
+			{
+				MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor);
+				
+				dispatchEvent(new Event("initBindings"));
+				dispatchEvent(new Event("initComplete"));
+				_initialized = true;
+				
+				//?? why was this added here? childrenAdded(); //?? Is this needed since MXMLDataInterpreter will already have called it
+			}
+		}
+		
+		/**
+		 *  @copy org.apache.royale.core.Application#MXMLDescriptor
+		 *  
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.4
+		 *  @productversion Royale 0.8
 		 */
-		public function containsClass(name:String):Boolean
-        {
-            COMPILE::JS
-            {
-            return classSelectorList.contains(name);
-            }
-            COMPILE::SWF
-            {//not implemented
-            return false;
-            }
-        }
+		public function get MXMLDescriptor():Array
+		{
+			return _mxmlDescriptor;
+		}
+		
+		/**
+		 *  @private
+		 */
+		public function setMXMLDescriptor(document:Object, value:Array):void
+		{
+			_mxmlDocument = document;
+			_mxmlDescriptor = value;
+		}
+		
+		/**
+		 *  @copy org.apache.royale.core.Application#generateMXMLAttributes()
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.8
+		 */
+		public function generateMXMLAttributes(data:Array):void
+		{
+			MXMLDataInterpreter.generateMXMLProperties(this, data);
+		}
+		
+		/**
+		 *  @copy org.apache.royale.core.ItemRendererClassFactory#mxmlContent
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.8
+         * 
+         *  @royalesuppresspublicvarwarning
+		 */
+		public var mxmlContent:Array;
 
         protected var _layout:StyledLayoutBase;
         
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/list/DataGroup.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/list/DataGroup.as
index 2e37891..c6e6458 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/list/DataGroup.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/list/DataGroup.as
@@ -22,11 +22,10 @@ package org.apache.royale.jewel.supportClasses.list
     {
 	import org.apache.royale.core.WrappedHTMLElement;
 	import org.apache.royale.html.util.addElementToWrapper;
-	import org.apache.royale.html.beads.DataContainerView;
     }
-	import org.apache.royale.html.DataContainer;
-    import org.apache.royale.core.IBead;
-    import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.jewel.DataContainer;
 	
 	/**
 	 *  The DataGroup class is the IItemRendererParent used internally