You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2020/05/13 06:58:37 UTC

[royale-asjs] branch develop updated (d0a5835 -> deb1e0c)

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

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


    from d0a5835  NOTICE: add Open Sans and Lato
     new 7610f52  new interfaces for Menus
     new 9c69d22  use interfaces for Menu
     new b98a1a5  mx:Menu.  Should fix #815
     new deb1e0c  use systemManager as the stage for JS

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../CascadingMenuSelectionMouseController.as       |  12 +-
 .../royale/html/beads/models/CascadingMenuModel.as |   3 +-
 .../projects/Core/src/main/royale/CoreClasses.as   |   2 +
 .../{IBeadController.as => ICascadingMenuModel.as} |  12 +-
 .../royale/core/{IPopUp.as => IMenuModel.as}       |  10 +-
 .../MXRoyale/src/main/resources/defaults.css       |  19 +-
 .../src/main/resources/mx-royale-manifest.xml      |   1 +
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../MXRoyale/src/main/royale/mx/controls/Menu.as   | 485 +++++++++++++++++----
 .../controls/beads/models/CascadingMenuModel.as}   |  56 ++-
 .../royale/mx/controls/listClasses/ListBase.as     |   2 +-
 .../src/main/royale/mx/core/UIComponent.as         |   4 +-
 12 files changed, 475 insertions(+), 132 deletions(-)
 copy frameworks/projects/Core/src/main/royale/org/apache/royale/core/{IBeadController.as => ICascadingMenuModel.as} (77%)
 copy frameworks/projects/Core/src/main/royale/org/apache/royale/core/{IPopUp.as => IMenuModel.as} (86%)
 copy frameworks/projects/{Basic/src/main/royale/org/apache/royale/html/beads/models/MenuModel.as => MXRoyale/src/main/royale/mx/controls/beads/models/CascadingMenuModel.as} (79%)


[royale-asjs] 02/04: use interfaces for Menu

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9c69d22540c40b00fde8dd8a0760b64125190b92
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue May 12 00:40:04 2020 -0700

    use interfaces for Menu
---
 .../controllers/CascadingMenuSelectionMouseController.as     | 12 ++++++------
 .../apache/royale/html/beads/models/CascadingMenuModel.as    |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/CascadingMenuSelectionMouseController.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/CascadingMenuSelectionMouseController.as
index 874448d..eaa15be 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/CascadingMenuSelectionMouseController.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/CascadingMenuSelectionMouseController.as
@@ -22,12 +22,12 @@ package org.apache.royale.html.beads.controllers
 	import org.apache.royale.core.IMenu;
 	import org.apache.royale.core.IStrand;
 	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.core.ICascadingMenuModel;
 	import org.apache.royale.events.Event;
 	import org.apache.royale.events.ItemClickedEvent;
 	import org.apache.royale.html.CascadingMenu;
-	import org.apache.royale.html.beads.models.CascadingMenuModel;
-	import org.apache.royale.html.beads.models.MenuModel;
 	import org.apache.royale.html.Menu;
+	import org.apache.royale.html.beads.models.MenuModel;
 	import org.apache.royale.core.ISelectionModel;
 	import org.apache.royale.core.UIBase;
 	import org.apache.royale.core.ValuesManager;
@@ -93,7 +93,7 @@ package org.apache.royale.html.beads.controllers
 		{
 			var node:Object = event.data;
 			
-			var model:CascadingMenuModel = _strand.getBeadByType(IBeadModel) as CascadingMenuModel;
+			var model:ICascadingMenuModel = _strand.getBeadByType(IBeadModel) as ICascadingMenuModel;
 			
 			if (getHasMenu(node, model)) {
 				var c:Class = ValuesManager.valuesImpl.getValue(_strand, "iMenu");
@@ -139,7 +139,7 @@ package org.apache.royale.html.beads.controllers
 				var menuModel:ISelectionModel = menu.model as ISelectionModel;
 				if (menuModel && menuModel.selectedItem == selectedItem)
 				{
-					var dp:Object = getSubMenuDataProvider(selectedItem, menuModel as CascadingMenuModel);
+					var dp:Object = getSubMenuDataProvider(selectedItem, menuModel as ICascadingMenuModel);
 					if (dp)
 					{
 						// though this is being called in a loop, performance shouldn't be a big issue as
@@ -180,12 +180,12 @@ package org.apache.royale.html.beads.controllers
 			return null;
 		}
 
-		protected function getSubMenuDataProvider(node:Object, model:CascadingMenuModel):Object
+		protected function getSubMenuDataProvider(node:Object, model:ICascadingMenuModel):Object
 		{
 			return node[model.submenuField];
 		}
 		
-		protected function getHasMenu(node:Object, model:CascadingMenuModel):Boolean
+		protected function getHasMenu(node:Object, model:ICascadingMenuModel):Boolean
 		{
 			return node.hasOwnProperty(model.submenuField);
 		}
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/CascadingMenuModel.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/CascadingMenuModel.as
index a89ea04..8f7fab8 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/CascadingMenuModel.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/CascadingMenuModel.as
@@ -19,9 +19,10 @@
 package org.apache.royale.html.beads.models
 {
 	import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.ICascadingMenuModel;
 	import org.apache.royale.events.Event;
 
-	public class CascadingMenuModel extends MenuModel
+	public class CascadingMenuModel extends MenuModel implements ICascadingMenuModel
 	{
 		public function CascadingMenuModel()
 		{


[royale-asjs] 04/04: use systemManager as the stage for JS

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit deb1e0c13d3544516f4f074a8827003843fc9bc6
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue May 12 23:58:01 2020 -0700

    use systemManager as the stage for JS
---
 frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index f19496b..9927196 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -1819,9 +1819,7 @@ COMPILE::JS
 {
     public function get stage():Object
     {
-        // TODO
-        trace("stage not implemented");
-        return null;
+        return systemManager;
     }
 }
     //--------------------------------------------------------------------------


[royale-asjs] 03/04: mx:Menu. Should fix #815

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b98a1a5aad52cb7f087675f1d23fb14e937ccf30
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue May 12 00:40:19 2020 -0700

    mx:Menu.  Should fix #815
---
 .../MXRoyale/src/main/resources/defaults.css       |  19 +-
 .../src/main/resources/mx-royale-manifest.xml      |   1 +
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../MXRoyale/src/main/royale/mx/controls/Menu.as   | 485 +++++++++++++++++----
 .../mx/controls/beads/models/CascadingMenuModel.as | 107 +++++
 .../royale/mx/controls/listClasses/ListBase.as     |   2 +-
 6 files changed, 535 insertions(+), 80 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index a188d11..dd0837c 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -356,11 +356,20 @@ menu|MenuBarItemRenderer {
 	margin-right: 10px;
 	cursor: pointer;
 }
-/*
+
 Menu {
-	IBeadModel: ClassReference("org.apache.royale.html.beads.models.CascadingMenuModel");
-	IBeadController: ClassReference("org.apache.royale.html.beads.controllers.CascadingMenuSelectionMouseController");
-	IItemRenderer: ClassReference("org.apache.royale.html.supportClasses.CascadingMenuItemRenderer");
+	IMenu: ClassReference("org.apache.royale.html.CascadingMenu");
+	IBeadModel: ClassReference("mx.controls.beads.models.CascadingMenuModel");
+	IBeadController: ClassReference("mx.controls.beads.controllers.CascadingMenuSelectionMouseController");
+	IItemRenderer: ClassReference("mx.controls.menuClasses.CascadingMenuItemRenderer");
+	IBeadView:  ClassReference("org.apache.royale.html.beads.ListView");			
+	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.VerticalLayout");
+	IDataProviderItemRendererMapper: ClassReference("mx.controls.listClasses.DataItemRendererFactoryForICollectionViewData");
+	IItemRendererClassFactory: ClassReference("org.apache.royale.core.SelectableItemRendererClassFactory");
+	IItemRendererInitializer: ClassReference("mx.controls.beads.ListItemRendererInitializer");
+	ISelectableItemRenderer: ClassReference("org.apache.royale.html.beads.SolidBackgroundSelectableItemRendererBead");
+	IListPresentationModel: ClassReference("org.apache.royale.html.beads.models.ListPresentationModel");
+	
 	position: absolute;
 	background-color: white;
 	border-width: 1px;
@@ -368,7 +377,7 @@ Menu {
 	border-color: #222222;
 	box-shadow: 2px 2px 5px gray;
 }
-
+/*
 MenuItemRenderer {
 	margin-top: 4px;
 	margin-left: 2px;
diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
index 04b0943..45a65d6 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml
@@ -118,6 +118,7 @@
 	<component id="Validator" class="mx.validators.Validator"/>
 	<component id="DateFormatter" class="mx.formatters.DateFormatter"/>
 	<component id="MenuBar" class="mx.controls.MenuBar"/>
+    <component id="Menu" class="mx.controls.Menu"/>
 	<component id="Glow" class="mx.effects.Glow"/>
 	<component id="StringValidator" class="mx.validators.StringValidator"/>
 	<component id="RegExpValidator" class="mx.validators.RegExpValidator"/>
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index d8d0c0a..b58e00b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -266,6 +266,7 @@ internal class MXRoyaleClasses
     import mx.containers.beads.TabNavigatorView; TabNavigatorView;
     import mx.controls.TabBar; TabBar;
     import mx.controls.beads.models.ComboBoxModel; ComboBoxModel;
+    import mx.controls.beads.models.CascadingMenuModel; CascadingMenuModel;
     
     import mx.controls.beads.models.SingleSelectionICollectionViewModel; SingleSelectionICollectionViewModel;
 	import mx.controls.beads.models.DataGridColumnICollectionViewModel; DataGridColumnICollectionViewModel;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as
index 42f1cd2..b4d292b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Menu.as
@@ -21,8 +21,25 @@ package mx.controls
 {
 	
 	import org.apache.royale.events.Event;
+	import org.apache.royale.events.IEventDispatcher;
 	import org.apache.royale.geom.Rectangle;
 	import org.apache.royale.geom.Point;
+	import org.apache.royale.core.IListPresentationModel;
+	import org.apache.royale.core.ISelectionModel;
+	import org.apache.royale.core.ValuesManager;
+	import org.apache.royale.core.IFactory;
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IBeadLayout;
+	import org.apache.royale.core.ILayoutHost;
+	import org.apache.royale.core.IMenu;
+	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.core.IDataProviderItemRendererMapper;
+	import org.apache.royale.core.IItemRendererClassFactory;
+	import org.apache.royale.core.IItemRendererProvider;
+	import org.apache.royale.html.beads.models.CascadingMenuModel;
+	import org.apache.royale.html.beads.models.MenuModel;
+	import org.apache.royale.utils.loadBeadFromValuesManager;
+	
 	import mx.core.UIComponent;
 	import mx.events.MouseEvent;
 	
@@ -571,7 +588,7 @@ package mx.controls
 	 *  @playerversion AIR 1.1
 	 *  @productversion Flex 3
 	 */
-	public class Menu extends List implements IFocusManagerContainer
+	public class Menu extends UIComponent implements IFocusManagerContainer, IMenu
 	{
 		// include "../core/Version.as";
 		
@@ -697,6 +714,7 @@ package mx.controls
 			/*itemRenderer = new ClassFactory(MenuItemRenderer);
 			setRowHeight(19);
 			iconField = "icon";*/
+			typeNames = "Menu";
 			
 			visible = false;
 		}
@@ -906,13 +924,13 @@ package mx.controls
 		 *  @see mx.controls.List
 		 *  @see mx.controls.Tree
 		 */
-		/*override public function set dataProvider(value:Object):void
+		public function set dataProvider(value:Object):void
 		{
 			// handle strings and xml
 			if (typeof(value)=="string")
 				value = new XML(value);
-			else if (value is XMLNode)
-				value = new XML(XMLNode(value).toString());
+			//else if (value is XMLNode)
+			//	value = new XML(XMLNode(value).toString());
 			else if (value is XMLList)
 				value = new XMLListCollection(value as XMLList);
 			
@@ -948,29 +966,18 @@ package mx.controls
 				_rootModel = new ArrayCollection();
 			}
 			
+			(model as ISelectionModel).dataProvider = _rootModel;
 			//flag for processing in commitProps
 			dataProviderChanged = true;
 			invalidateProperties();
-		}*/
+		}
 		
 		/**
 		 *  @private
 		 */
-		override public function get dataProvider():Object
+		public function get dataProvider():Object
 		{
-			var model:* = super.dataProvider;
-			if (model == null)
-			{
-				if (_rootModel != null )
-				{
-					return _rootModel;
-				}
-			}
-			else
-			{ 
-				return model;
-			}
-			return null;
+			return (model as ISelectionModel).dataProvider;
 		}
 		
 		//--------------------------------------------------------------------------
@@ -1137,48 +1144,6 @@ package mx.controls
 			itemRenderer = parentMenu.itemRenderer;
 		}
 		
-		// -------------------------------------------------------------------------
-		// horizontalScrollPolicy
-		// -------------------------------------------------------------------------
-		
-		[Inspectable(environment="none")]
-		
-		/**
-		 *  @private
-		 */
-		override public function get horizontalScrollPolicy():String
-		{
-			return ScrollPolicy.OFF;
-		}
-		
-		/**
-		 *  @private
-		 */
-		override public function set horizontalScrollPolicy(value:String):void
-		{
-		}
-		
-		// -------------------------------------------------------------------------
-		// verticalScrollPolicy
-		// -------------------------------------------------------------------------
-		
-		[Inspectable(environment="none")]
-		
-		/**
-		 *  @private
-		 */
-		override public function get verticalScrollPolicy():String
-		{
-			return ScrollPolicy.OFF;
-		}
-		
-		/**
-		 *  @private
-		 */
-		override public function set verticalScrollPolicy(value:String):void
-		{
-		}
-		
 		//--------------------------------------------------------------------------
 		//
 		//  Overridden methods
@@ -1252,7 +1217,7 @@ package mx.controls
 				else
 				{
 					_listDataProvider = null;
-					super.dataProvider = null;
+					vider = null;
 				}
 			}
 			
@@ -1649,11 +1614,14 @@ package mx.controls
 		 *  @playerversion AIR 1.1
 		 *  @productversion Flex 3
 		 */
-		public function show(xShow:Object = null, yShow:Object = null):void
+		public function show(parent:IUIBase, xShow:Number = 0, yShow:Number = 0):void
 		{
-			/*//this could be an empty menu so we'll return if it is
-			if (collection && collection.length == 0)
-				return;
+			if (parent is UIComponent)
+				parentDisplayObject = (parent as UIComponent);
+				
+			//this could be an empty menu so we'll return if it is
+			//if (collection && collection.length == 0)
+			//	return;
 			
 			// If parent is closed, then don't show this submenu
 			if (parentMenu && !parentMenu.visible)
@@ -1663,12 +1631,13 @@ package mx.controls
 			if (visible)
 				return;
 			
-			if (parentDisplayObject && (!parent || !parent.contains(parentDisplayObject)))
+			if (parentDisplayObject && (!parent /* || !parent.contains(parentDisplayObject)*/))
 			{
 				PopUpManager.addPopUp(this, parentDisplayObject, false);
-				addEventListener(MenuEvent.MENU_HIDE, menuHideHandler, false, EventPriority.DEFAULT_HANDLER);
+				//addEventListener(MenuEvent.MENU_HIDE, menuHideHandler, false, EventPriority.DEFAULT_HANDLER);
+				MenuModel.menuList.push(this);
 			}
-			
+			/*
 			// Fire an event
 			var menuEvent:MenuEvent = new MenuEvent(MenuEvent.MENU_SHOW);
 			menuEvent.menu = this;
@@ -1680,12 +1649,13 @@ package mx.controls
 				IActiveWindowManager(systemManager.getImplementation("mx.managers::IActiveWindowManager"));
 			awm.activate(this);
 			
+			*/
 			// Position it
-			if (xShow !== null && !isNaN(Number(xShow)))
+			if (/*xShow !== null && */!isNaN(Number(xShow)))
 				x = Number(xShow);
-			if (yShow !== null && !isNaN(Number(yShow)))
+			if (/*yShow !== null && */!isNaN(Number(yShow)))
 				y = Number(yShow);
-			
+			/*
 			// Adjust for menus that extend out of bounds
 			var sm:ISystemManager = systemManager.topLevelSystemManager;
 			var sbRoot:UIComponent = sm.getSandboxRoot();
@@ -1711,8 +1681,9 @@ package mx.controls
 			// Make sure the Menu's width and height has been determined
 			// before we try to set the size for its mask
 			UIComponentGlobals.layoutManager.validateClient(this, true);
+			*/
 			setActualSize(getExplicitOrMeasuredWidth(), getExplicitOrMeasuredHeight());
-			
+			/*
 			cacheAsBitmap = true;
 			
 			var duration:Number = getStyle("openDuration");
@@ -1720,9 +1691,10 @@ package mx.controls
 			{
 				scrollRect = new Rectangle(0, 0, unscaledWidth, 0);
 				
+				*/
 				// Make it visible
 				visible = true;
-				
+				/*
 				UIComponentGlobals.layoutManager.validateNow();
 				
 				// Block all layout, responses from web service, and other background
@@ -2638,6 +2610,371 @@ package mx.controls
 			return arr;
 		}
 		
+        //--------------------------------------------------------------------------
+        //
+        //  Methods: Item fields
+        //
+        //--------------------------------------------------------------------------
+        
+        /**
+         *  Returns the string the renderer would display for the given data object
+         *  based on the labelField and labelFunction properties.
+         *  If the method cannot convert the parameter to a string, it returns a
+         *  single space.
+         *
+         *  @param data Object to be rendered.
+         *
+         *  @return The string to be displayed based on the data.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 9
+         *  @playerversion AIR 1.1
+         *  @productversion Flex 3
+         */
+        public function itemToLabel(data:Object):String
+        {
+            if (data == null)
+                return " ";
+            
+            /*
+            if (labelFunction != null)
+                return labelFunction(data);
+            */
+            
+            if (data is XML)
+            {
+                try
+                {
+                    if ((data as XML)[labelField].length() != 0)
+                        data = (data as XML)[labelField];
+                    //by popular demand, this is a default XML labelField
+                    //else if (data.@label.length() != 0)
+                    //  data = data.@label;
+                }
+                catch(e:Error)
+                {
+                }
+            }
+            else if (data is Object)
+            {
+                try
+                {
+                    if (data[labelField] != null)
+                        data = data[labelField];
+                }
+                catch(e:Error)
+                {
+                }
+            }
+            
+            if (data is String)
+                return String(data);
+            
+            try
+            {
+                return data.toString();
+            }
+            catch(e:Error)
+            {
+            }
+            
+            return " ";
+        }
+
+        /*
+        * IItemRendererProvider
+        */
+        
+        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 Royale 0.0
+         */
+        public function get itemRenderer():IFactory
+        {
+            return _itemRenderer;
+        }
+        public function set itemRenderer(value:IFactory):void
+        {
+            _itemRenderer = value;
+        }
+
+        //----------------------------------
+        //  labelField
+        //----------------------------------
+                
+        [Bindable("labelFieldChanged")]
+        [Inspectable(category="Data", defaultValue="label")]
+        
+        /**
+         *  The name of the field in the data provider items to display as the label. 
+         *  By default the list looks for a property named <code>label</code> 
+         *  on each item and displays it.
+         *  However, if the data objects do not contain a <code>label</code> 
+         *  property, you can set the <code>labelField</code> property to
+         *  use a different property in the data object. An example would be 
+         *  "FullName" when viewing a set of people names fetched from a database.
+         *
+         *  @default "label"
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 9
+         *  @playerversion AIR 1.1
+         *  @productversion Flex 3
+         *  @royaleignorecoercion org.apache.royale.core.ISelectionModel
+         */
+        public function get labelField():String
+        {
+            return (model as ISelectionModel).labelField;
+        }
+        
+        /**
+         *  @private
+         *  @royaleignorecoercion org.apache.royale.core.ISelectionModel
+         */
+        public function set labelField(value:String):void
+        {
+            (model as ISelectionModel).labelField = value;
+        }
+        
+		        //----------------------------------
+        //  rowHeight
+        //----------------------------------
+        
+        /**
+         *  @private
+         *  Storage for the rowHeight property.
+         */
+        private var _rowHeight:Number;
+        
+        /**
+         *  @private
+         */
+        private var rowHeightChanged:Boolean = false;
+        
+        [Inspectable(category="General")]
+        
+        /**
+         *  The height of the rows in pixels.
+         *  Unless the <code>variableRowHeight</code> property is
+         *  <code>true</code>, all rows are the same height.  
+         *  If not specified, the row height is based on
+         *  the font size and other properties of the renderer.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 9
+         *  @playerversion AIR 1.1
+         *  @productversion Flex 3
+         */
+        public function get rowHeight():Number
+        {
+            return _rowHeight;
+        }
+        
+        /**
+         *  @private
+         *  @royaleignorecoercion org.apache.royale.core.IListPresentationModel
+         */
+        public function set rowHeight(value:Number):void
+        {
+            //explicitRowHeight = value;
+            
+            if (_rowHeight != value)
+            {
+                _rowHeight = value;
+                
+                (presentationModel as IListPresentationModel).rowHeight = value;
+                /*
+                invalidateSize();
+                itemsSizeChanged = true;
+                invalidateDisplayList();
+                
+                dispatchEvent(new Event("rowHeightChanged"));
+                */
+            }
+        }
+
+        /**
+         * @private
+         */
+        private var _presentationModel:IListPresentationModel;
+        
+        /**
+         *  The DataGrid's presentation model
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9
+         *  @royaleignorecoercion org.apache.royale.core.IListPresentationModel
+         *  @royaleignorecoercion org.apache.royale.core.IBead
+         */
+        public function get presentationModel():IBead
+        {
+            if (_presentationModel == null) {
+                var bead:IBead = getBeadByType(IListPresentationModel);
+                if (bead)
+                    _presentationModel = bead as IListPresentationModel;
+                else
+                {
+                    var c:Class = ValuesManager.valuesImpl.getValue(this, "iListPresentationModel");
+                    if (c) {
+                        _presentationModel = new c() as IListPresentationModel;
+                        addBead(_presentationModel as IBead);
+                    }
+                }
+            }
+            
+            return _presentationModel;
+        }
+
+		override public function addedToParent():void
+		{
+			super.addedToParent();		
+			
+            // Load the layout bead if it hasn't already been loaded.
+            loadBeadFromValuesManager(IBeadLayout, "iBeadLayout", this);
+
+            // Even though super.addedToParent dispatched "beadsAdded", DataContainer still needs its data mapper
+            // and item factory beads. These beads are added after super.addedToParent is called in case substitutions
+            // were made; these are just defaults extracted from CSS.
+            loadBeadFromValuesManager(IDataProviderItemRendererMapper, "iDataProviderItemRendererMapper", this);
+            loadBeadFromValuesManager(IItemRendererClassFactory, "iItemRendererClassFactory", this);
+
+	        dispatchEvent(new Event("initComplete"));
+		}
+		
+		/**
+         * Returns the ILayoutHost which is its view. From ILayoutParent.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.8
+         *  @royaleignorecoercion org.apache.royale.core.ILayoutHost
+         */
+        public function getLayoutHost():ILayoutHost
+        {
+            return view as ILayoutHost;
+        }
+
+	    //----------------------------------
+	    //  selectedIndex
+	    //----------------------------------
+	
+	    [Bindable("change")]
+	    [Bindable("valueCommit")]
+	    [Inspectable(category="General", defaultValue="-1")]
+	
+	    /**
+	     *  The index in the data provider of the selected item.
+	     * 
+	     *  <p>The default value is -1 (no selected item).</p>
+	     *
+	     *  
+	     *  @langversion 3.0
+	     *  @playerversion Flash 9
+	     *  @playerversion AIR 1.1
+	     *  @productversion Flex 3
+	     *  @royaleignorecoercion org.apache.royale.core.ISelectionModel
+	     */
+	    public function get selectedIndex():int
+	    {
+	        return (model as ISelectionModel).selectedIndex;
+	    }
+	
+	    /**
+	     *  @private
+	     *  @royaleignorecoercion org.apache.royale.core.ISelectionModel
+	     */
+	    public function set selectedIndex(value:int):void
+	    {
+	       // if (!collection || collection.length == 0)
+	       // {
+	        (model as ISelectionModel).selectedIndex = value;
+	         //   bSelectionChanged = true;
+	         //   bSelectedIndexChanged = true;
+	          //  invalidateDisplayList();
+	            return;
+	       // }
+	        //commitSelectedIndex(value);
+	    }
+
+	    //----------------------------------
+	    //  selectedItem
+	    //----------------------------------
+	    
+	    [Bindable("change")]
+	    [Bindable("valueCommit")]
+	    
+	    /**
+	     *  The selected item in the data provider.
+	     *  
+	     *  @langversion 3.0
+	     *  @playerversion Flash 9
+	     *  @playerversion AIR 1.1
+	     *  @productversion Flex 3
+	     */
+	    public function get selectedItem():Object
+	    {
+	        return (model as ISelectionModel).selectedItem;
+	    }
+	    
+	    /**
+	     *  @private
+	     */
+	    public function set selectedItem(item:Object):void
+	    {
+	        (model as ISelectionModel).selectedItem = item;
+	    }
+	    
+		private var _parentMenuBar:IEventDispatcher;
+		
+		/**
+		 * @private
+		 * 
+		 * If this menu is used as part of a menu bar system, this property should reference
+		 * that menu bar. If this property is set, the "change" event is dispatched against this
+		 * object rather than the Menu itself.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get parentMenuBar():IEventDispatcher
+		{
+			return _parentMenuBar;
+		}
+		public function set parentMenuBar(value:IEventDispatcher):void
+		{
+			_parentMenuBar = value;
+		}
+		
+		/**
+		 * The name of the field to use in the data that indicates a sub-menu. The
+		 * default value is "menu".
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get submenuField():String
+		{
+			return (model as CascadingMenuModel).submenuField;
+		}
+		
+		public function set submenuField(value:String):void
+		{
+			(model as CascadingMenuModel).submenuField = value;
+		}
+		        
 	}
 	
 }
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/models/CascadingMenuModel.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/models/CascadingMenuModel.as
new file mode 100644
index 0000000..2110d82
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/models/CascadingMenuModel.as
@@ -0,0 +1,107 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.controls.beads.models
+{
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.ICascadingMenuModel;
+	import org.apache.royale.events.Event;
+
+	public class CascadingMenuModel extends SingleSelectionICollectionViewModel implements ICascadingMenuModel
+	{
+		public function CascadingMenuModel()
+		{
+			super();
+		}
+		
+		private var _strand:IStrand;
+		override public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			super.strand = value;
+		}
+		
+		private static var _menuList:Array = [];
+		
+		/**
+		 * The array of active IMenu instances. This list is maintained so that any of the
+		 * instances can close all of them. Imagine several cascading menus open the user
+		 * selects one of the items. That menu uses this array to close itself and the others.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public static function get menuList():Array
+		{
+			return _menuList;
+		}
+		
+		/**
+		 * Empties the menuList.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public static function clearMenuList():void
+		{
+			_menuList = [];
+		}
+		
+		/**
+		 * Removes a specific menu from the menuList.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public static function removeMenu(menu:Object):void
+		{
+			for(var i:int=0; i < menuList.length; i++) {
+				if (menuList[i] == menu) {
+					menuList.splice(i,1);
+					break;
+				}
+			}
+		}
+
+		private var _submenuField:String = "menu";
+		
+		/**
+		 * The field in the data object that identifies sub-menus. The default is "menu".
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9
+		 */
+		public function get submenuField():String
+		{
+			return _submenuField;
+		}
+		public function set submenuField(value:String):void
+		{
+			_submenuField = value;
+			dispatchEvent(new Event("submenuFieldChanged"));
+		}
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as
index 12dd221..232b5b0 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as
@@ -386,7 +386,7 @@ use namespace mx_internal;
             _labelFunction = value;
         }
 
-        //----------------------------------
+    //----------------------------------
     //  selectedIndex
     //----------------------------------
 


[royale-asjs] 01/04: new interfaces for Menus

Posted by ah...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7610f525803ea9d1e14523b5c2a610594eba3191
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue May 12 00:38:46 2020 -0700

    new interfaces for Menus
---
 .../projects/Core/src/main/royale/CoreClasses.as   |  2 ++
 .../org/apache/royale/core/ICascadingMenuModel.as  | 37 ++++++++++++++++++++++
 .../royale/org/apache/royale/core/IMenuModel.as    | 33 +++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 8a6c776..e4a28d7 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -155,6 +155,8 @@ internal class CoreClasses
 	import org.apache.royale.core.IStrandWithModel; IStrandWithModel;
 	import org.apache.royale.core.IStrandWithModelView; IStrandWithModelView;
 	import org.apache.royale.core.ITextModel; ITextModel;
+	import org.apache.royale.core.IMenuModel; IMenuModel;
+	import org.apache.royale.core.ICascadingMenuModel; ICascadingMenuModel;
 	import org.apache.royale.core.IColorModel; IColorModel;
 	import org.apache.royale.core.IColorSpectrumModel; IColorSpectrumModel;
 	import org.apache.royale.core.ITitleBarModel; ITitleBarModel;
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ICascadingMenuModel.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ICascadingMenuModel.as
new file mode 100644
index 0000000..256df72
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ICascadingMenuModel.as
@@ -0,0 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.core
+{
+    /**
+     *  The ITextModel interface describes the minimum set of properties
+     *  available to control that displays text.  More sophisticated controls
+     *  often have models that extend ITextModel.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+     */
+	public interface ICascadingMenuModel extends IMenuModel
+	{
+		function get submenuField():String;
+		function set submenuField(value:String):void
+		
+	}
+}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IMenuModel.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IMenuModel.as
new file mode 100644
index 0000000..261a3fc
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IMenuModel.as
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.core
+{
+    /**
+     *  The IMenuModel interface describes the minimum set of properties
+     *  available for a Menu.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+     */
+	public interface IMenuModel extends ISelectionModel
+	{        
+	}
+}