You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2020/10/23 07:39:01 UTC

[royale-asjs] branch develop updated: Make mx tree more compatible with original flex code

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

yishayw 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 561793b  Make mx tree more compatible with original flex code
     new b98499f  Merge branch 'develop' of https://github.com/apache/royale-asjs into develop
561793b is described below

commit 561793b01391bce58d1546a6f7481011e49d70ec
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Fri Oct 23 08:38:27 2020 +0100

    Make mx tree more compatible with original flex code
---
 .../controls/beads/TreeItemRendererInitializer.as  |   4 +-
 .../mx/controls/treeClasses/TreeItemRenderer.as    |   6 +-
 .../royale/mx/controls/treeClasses/TreeListData.as | 229 +++++++++++++++++----
 3 files changed, 195 insertions(+), 44 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TreeItemRendererInitializer.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TreeItemRendererInitializer.as
index 6fe40d1..4198307 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TreeItemRendererInitializer.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/TreeItemRendererInitializer.as
@@ -31,6 +31,7 @@ package mx.controls.beads
     import org.apache.royale.core.SimpleCSSStyles;
     import org.apache.royale.core.UIBase;
     import mx.controls.treeClasses.TreeListData;
+    import mx.controls.listClasses.ListBase;
     
 	/**
 	 *  The TreeItemRendererInitializer class initializes item renderers
@@ -72,11 +73,10 @@ package mx.controls.beads
             var hasChildren:Boolean = treeData.hasChildren(data);
             
             // Set the listData with the depth of this item
-            var treeListData:TreeListData = new TreeListData();
+            var treeListData:TreeListData = new TreeListData("", "", _strand as ListBase);
             treeListData.depth = depth;
             treeListData.isOpen = isOpen;
             treeListData.hasChildren = hasChildren;
-            treeListData.owner = _strand;
             
             (ir as IListDataItemRenderer).listData = treeListData;
             
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeItemRenderer.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeItemRenderer.as
index 146d621..31f5909 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeItemRenderer.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeItemRenderer.as
@@ -271,7 +271,7 @@ public class TreeItemRenderer extends UIComponent
         return getLabelFromData(this,value);
     }
 
-    private var _listData:Object;
+    private var _listData:BaseListData;
     
     [Bindable("__NoChangeEvent__")]
     /**
@@ -283,11 +283,11 @@ public class TreeItemRenderer extends UIComponent
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.0
      */
-    public function get listData():Object
+    public function get listData():BaseListData
     {
         return _listData;
     }
-    public function set listData(value:Object):void
+    public function set listData(value:BaseListData):void
     {
         _listData = value;
     }
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeListData.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeListData.as
index 6fd0d43..f938e17 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeListData.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/TreeListData.as
@@ -16,51 +16,202 @@
 //  limitations under the License.
 //
 ////////////////////////////////////////////////////////////////////////////////
+
 package mx.controls.treeClasses
 {
-	import org.apache.royale.html.supportClasses.TreeListData;
+
+import mx.controls.listClasses.BaseListData;
+import mx.controls.listClasses.ListBase;
+
+/**
+ *  The TreeListData class defines the data type of the <code>listData</code> property 
+ *  implemented by drop-in item renderers or drop-in item editors for the Tree control. 
+ *  All drop-in item renderers and drop-in item editors must implement the 
+ *  IDropInListItemRenderer interface, which defines the <code>listData</code> property.
+ *
+ *  <p>While the properties of this class are writable, you should considered them to 
+ *  be read only. They are initialized by the Tree class, and read by an item renderer 
+ *  or item editor. Changing these values can lead to unexpected results.</p>
+ *
+ *  @see mx.controls.listClasses.IDropInListItemRenderer
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class TreeListData extends BaseListData
+{
+    //include "../../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
 	/**
-	 *  The TreeListData class contains information that Tree item renderers may
-	 *  find useful when displaying the data for a node in the tree.
+	 *  Constructor.
+	 *
+	 *  @param text Text representation of the item data.
+	 *
+	 *  @param uid A unique identifier for the item.
+	 *
+	 *  @param owner A reference to the Tree control.
+	 *
+	 *  @param rowIndex The index of the item in the data provider for the Tree control.
+	 * 
+	 *  @param columnIndex The index of the column in the currently visible columns of the 
+     *  control.
+	 *
 	 *  
 	 *  @langversion 3.0
-	 *  @playerversion Flash 10.2
-	 *  @playerversion AIR 2.6
-	 *  @productversion Royale 0.0
-     *  @royalesuppresspublicvarwarning
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
 	 */
-	public class TreeListData extends org.apache.royale.html.supportClasses.TreeListData
+	public function TreeListData(text:String, uid:String,
+								 owner:ListBase, rowIndex:int = 0,
+								 columnIndex:int = 0)
 	{
-		/**
-		 *  constructor.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.0
-		 */
-		public function TreeListData()
-		{
-		super();
-		}
-
-		 /**
-		 *  The data for this item in the Tree control.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.0
-		 */
-		public var item:Object;
-		 /**
-		 *  The data for this owner in the Tree control.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.0
-		 */
-		public var owner:Object;
+		super(text, uid, owner, rowIndex, columnIndex);
 	}
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+	//  depth
+    //----------------------------------
+
+	[Bindable("__NoChangeEvent__")]
+
+    /**
+	 *  The level of the item in the tree. The top level is 1.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var depth:int;
+
+    //----------------------------------
+	//  disclosureIcon
+    //----------------------------------
+
+	[Bindable("__NoChangeEvent__")]
+
+    /**
+	 *  A Class representing the disclosure icon for the item in the Tree control.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var disclosureIcon:Class;
+
+    //----------------------------------
+	//  hasChildren
+    //----------------------------------
+
+	[Bindable("__NoChangeEvent__")]
+
+    /**
+	 *  Contains <code>true</code> if the node has children.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var hasChildren:Boolean; 
+
+    //----------------------------------
+	//  icon
+    //----------------------------------
+	
+	[Bindable("__NoChangeEvent__")]
+
+    /**
+	 *  A Class representing the icon for the item in the Tree control.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var icon:Class;
+
+    //----------------------------------
+	//  indent
+    //----------------------------------
+
+	[Bindable("__NoChangeEvent__")]
+
+    /**
+	 *  The default indentation for this row of the Tree control.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var indent:int;
+
+    //----------------------------------
+	//  node
+    //----------------------------------
+
+	[Bindable("__NoChangeEvent__")]
+
+    /**
+	 *  The data for this item in the Tree control.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var item:Object;
+
+    //----------------------------------
+	//  open
+    //----------------------------------
+
+	[Bindable("__NoChangeEvent__")]
+
+    /**
+	 *  Contains <code>true</code> if the node is open.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var open:Boolean; 
+
+    /**
+     *  TODO keeping this for backwards compatibility, consider removing
+     *  @private
+     */
+	public function get isOpen():Boolean
+	{
+		return open;
+	}
+	
+    /**
+     *  TODO keeping this for backwards compatibility, consider removing
+     *  @private
+     */
+	public function set isOpen(value:Boolean):void
+	{
+		open = value;
+	}
+}
+
 }