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/22 08:23:47 UTC

[royale-asjs] 02/03: Emulation stubs

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

commit 300bbf446882ba7b52546ad4032a36860b94b35d
Author: Yishay Weiss <yi...@yell.com>
AuthorDate: Thu Oct 22 09:11:47 2020 +0100

    Emulation stubs
---
 .../MXRoyale/src/main/royale/mx/controls/Tree.as   | 246 +++++++++++----------
 .../mx/controls/listClasses/DataGridListBase.as    |  24 +-
 .../src/main/royale/spark/components/List.as       |  60 ++---
 3 files changed, 168 insertions(+), 162 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Tree.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Tree.as
index f3df2e5..b55559e 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Tree.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Tree.as
@@ -1283,35 +1283,36 @@ public class Tree extends List
      *  @private
      *  Position indicator bar that shows where an item will be placed in the list.
      */
-    /* override public function showDropFeedback(event:DragEvent):void
-    {
-        super.showDropFeedback(event);
-        // Adjust for indent
-        var vm:EdgeMetrics = viewMetrics;
-        var offset:int = 0;
-        updateDropData(event);
-        var indent:int = 0;
-        var depth:int;
-        if (_dropData.parent)
-        {
-            offset = getItemIndex(iterator.current);
-            depth = getItemDepth(_dropData.parent, Math.abs(offset - getItemIndex(_dropData.parent)));
-            indent = (depth + 1) * getStyle("indentation");
-        }
-        else 
-        {
-            indent = getStyle("indentation");
-        }
-        if (indent < 0)
-            indent = 0;
-        //position drop indicator
-        dropIndicator.width = listContent.width - indent;
-        dropIndicator.x = indent + vm.left + 2;
-        if (_dropData.emptyFolder)
-        {
-            dropIndicator.y += _dropData.rowHeight / 2;
-        }
-    } */
+	// not implemented
+    /*override */public function showDropFeedback(event:DragEvent):void
+    {
+        //super.showDropFeedback(event);
+        //// Adjust for indent
+        //var vm:EdgeMetrics = viewMetrics;
+        //var offset:int = 0;
+        //updateDropData(event);
+        //var indent:int = 0;
+        //var depth:int;
+        //if (_dropData.parent)
+        //{
+            //offset = getItemIndex(iterator.current);
+            //depth = getItemDepth(_dropData.parent, Math.abs(offset - getItemIndex(_dropData.parent)));
+            //indent = (depth + 1) * getStyle("indentation");
+        //}
+        //else 
+        //{
+            //indent = getStyle("indentation");
+        //}
+        //if (indent < 0)
+            //indent = 0;
+        ////position drop indicator
+        //dropIndicator.width = listContent.width - indent;
+        //dropIndicator.x = indent + vm.left + 2;
+        //if (_dropData.emptyFolder)
+        //{
+            //dropIndicator.y += _dropData.rowHeight / 2;
+        //}
+    }
 
     /**
      *  @private
@@ -3383,100 +3384,101 @@ public class Tree extends List
      *  @playerversion AIR 1.1
      *  @productversion Royale 0.9.3
      */
-    /* override protected function dragDropHandler(event:DragEvent):void
+ 	// not implemented
+    /* override */protected function dragDropHandler(event:DragEvent):void
     {
-        if (event.isDefaultPrevented())
-            return;
-
-        hideDropFeedback(event);
-
-		if (event.dragSource.hasFormat("treeItems"))
-		{
-        	var items:Array = event.dragSource.dataForFormat("treeItems") as Array;
-        	var i:int;
-        	var n:int;
-            	
-			// if we're moving to ourselves, we need to treat it specially and check for "parent" 
-			// problems where we could recurse forever.
-			if (event.action == DragManager.MOVE && dragMoveEnabled)
-			{
-				if (event.dragInitiator == this)
-				{
-					// If we're dropping onto ourselves or a child of a descendant then dont actually drop
-					
-					calculateDropIndex(event);
-									
-					// If we did start this drag op then we need to remove first
-					var index:int;
-					var parent:*;
-					var parentItem:*;
-					var dropIndex:int = _dropData.index;
-                
-					//get ancestors of the drop target item
-					var dropParentStack:Array = getParentStack(_dropData.parent);
-					dropParentStack.unshift(_dropData.parent);
-                
-					n = items.length;
-					for (i = 0; i < n; i++) 
-					{ 
-						parent = getParentItem(items[i]);
-						index = getChildIndexInParent(parent, items[i]);
-						//check ancestors of the dropTarget if the item matches, we're invalid
-                    
-						for each (parentItem in dropParentStack)
-						{ 
-							//we dont want to drop into one of our own sets of children
-							if (items[i] === parentItem)
-								return;
-						}
-                    
-						//we remove before we add due to the behavior 
-						//of structures with parent pointers like e4x
-						removeChildItem(parent, items[i], index);
-                    
-						//is the removed item before the drop location?
-						// then we need to shift the dropIndex accordingly
-						if (parent == _dropData.parent && index < _dropData.index)
-                        	dropIndex--;
-                    
-						addChildItem(_dropData.parent, items[i], dropIndex);
-					}
-                
-					return;
-				}
-			}
-        
-			// If not dropping onto ourselves, then add the 
-			// items here if it's a copy operation.
-			// If it's a move operation (and not on ourselves), then they 
-			// are added in dragCompleteHandler and are removed from 
-			// the source's dragCompleteHandler.  We do both in dragCompleteHandler
-			// because in order to be re-parented, they must be removed from their
-			// original source FIRST.  This means our code isn't coupled fantastically 
-			// as dragCompleteHandler must get the destination tree and 
-			// cast it to a Tree.
-        
-			if (event.action == DragManager.COPY)
-			{
-				if (!dataProvider) {
-					// Create an empty collection to drop items into.
-					dataProvider = [];
-					validateNow();
-				}
-				
-				n = items.length;
-				for (i = 0; i < n; i++) 
-				{ 
-	            	var item:Object = copyItemWithUID(items[i]);
-	            	
-					addChildItem(_dropData.parent, 
-	                   			 item, 
-	                       		 _dropData.index);
-				}
-	    	}
-		}
-		lastDragEvent = null;
-    } */
+        //if (event.isDefaultPrevented())
+            //return;
+//
+        //hideDropFeedback(event);
+//
+		//if (event.dragSource.hasFormat("treeItems"))
+		//{
+        	//var items:Array = event.dragSource.dataForFormat("treeItems") as Array;
+        	//var i:int;
+        	//var n:int;
+            	//
+			//// if we're moving to ourselves, we need to treat it specially and check for "parent" 
+			//// problems where we could recurse forever.
+			//if (event.action == DragManager.MOVE && dragMoveEnabled)
+			//{
+				//if (event.dragInitiator == this)
+				//{
+					//// If we're dropping onto ourselves or a child of a descendant then dont actually drop
+					//
+					//calculateDropIndex(event);
+									//
+					//// If we did start this drag op then we need to remove first
+					//var index:int;
+					//var parent:*;
+					//var parentItem:*;
+					//var dropIndex:int = _dropData.index;
+                //
+					////get ancestors of the drop target item
+					//var dropParentStack:Array = getParentStack(_dropData.parent);
+					//dropParentStack.unshift(_dropData.parent);
+                //
+					//n = items.length;
+					//for (i = 0; i < n; i++) 
+					//{ 
+						//parent = getParentItem(items[i]);
+						//index = getChildIndexInParent(parent, items[i]);
+						////check ancestors of the dropTarget if the item matches, we're invalid
+                    //
+						//for each (parentItem in dropParentStack)
+						//{ 
+							////we dont want to drop into one of our own sets of children
+							//if (items[i] === parentItem)
+								//return;
+						//}
+                    //
+						////we remove before we add due to the behavior 
+						////of structures with parent pointers like e4x
+						//removeChildItem(parent, items[i], index);
+                    //
+						////is the removed item before the drop location?
+						//// then we need to shift the dropIndex accordingly
+						//if (parent == _dropData.parent && index < _dropData.index)
+                        	//dropIndex--;
+                    //
+						//addChildItem(_dropData.parent, items[i], dropIndex);
+					//}
+                //
+					//return;
+				//}
+			//}
+        //
+			//// If not dropping onto ourselves, then add the 
+			//// items here if it's a copy operation.
+			//// If it's a move operation (and not on ourselves), then they 
+			//// are added in dragCompleteHandler and are removed from 
+			//// the source's dragCompleteHandler.  We do both in dragCompleteHandler
+			//// because in order to be re-parented, they must be removed from their
+			//// original source FIRST.  This means our code isn't coupled fantastically 
+			//// as dragCompleteHandler must get the destination tree and 
+			//// cast it to a Tree.
+        //
+			//if (event.action == DragManager.COPY)
+			//{
+				//if (!dataProvider) {
+					//// Create an empty collection to drop items into.
+					//dataProvider = [];
+					//validateNow();
+				//}
+				//
+				//n = items.length;
+				//for (i = 0; i < n; i++) 
+				//{ 
+	            	//var item:Object = copyItemWithUID(items[i]);
+	            	//
+					//addChildItem(_dropData.parent, 
+	                   			 //item, 
+	                       		 //_dropData.index);
+				//}
+	    	//}
+		//}
+		//lastDragEvent = null;
+    }
 
     /**
      *  Handles <code>DragEvent.DRAG_COMPLETE</code> events.  This method
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
index 52416b1..29dc2f9 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataGridListBase.as
@@ -21,6 +21,7 @@
 package mx.controls.listClasses
 {
 import mx.controls.dataGridClasses.DataGridColumnList;
+import mx.events.DragEvent;
 
 /* import flash.display.DisplayObject;
 import flash.display.Graphics;
@@ -9222,18 +9223,19 @@ public class DataGridListBase extends ListBase /* extends UIComponent
      *  @playerversion AIR 1.1
      *  @productversion Royale 0.9.4
      */
-   /*  protected function dragStartHandler(event:DragEvent):void
+// not implemented
+    protected function dragStartHandler(event:DragEvent):void
     {
-        if (event.isDefaultPrevented())
-            return;
-
-        var dragSource:DragSource = new DragSource();
-
-        addDragData(dragSource);
-
-        DragManager.doDrag(this, dragSource, event, dragImage,
-                           0, 0, 0.5, dragMoveEnabled);
-    } */
+        //if (event.isDefaultPrevented())
+            //return;
+//
+        //var dragSource:DragSource = new DragSource();
+//
+        //addDragData(dragSource);
+//
+        //DragManager.doDrag(this, dragSource, event, dragImage,
+                           //0, 0, 0.5, dragMoveEnabled);
+    }
 
     /**
      *  Handles <code>DragEvent.DRAG_ENTER</code> events.  This method
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/List.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/List.as
index 8744367..81cf37f 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/List.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/List.as
@@ -1738,8 +1738,9 @@ public class List extends ListBase implements IFocusManagerComponent
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    // protected function dragStartHandler(event:DragEvent):void
-    // {
+	// not implemented
+    protected function dragStartHandler(event:DragEvent):void
+    {
         // if (event.isDefaultPrevented())
             // return;
         
@@ -1753,7 +1754,7 @@ public class List extends ListBase implements IFocusManagerComponent
                            // 0 /*yOffset*/, 
                            // 0.5 /*imageAlpha*/, 
                            // dragMoveEnabled);
-    // } 
+    } 
     
     /**
      *  @private
@@ -1776,33 +1777,34 @@ public class List extends ListBase implements IFocusManagerComponent
      *  @playerversion AIR 1.5
      *  @productversion Flex 4
      */
-    /* protected function dragCompleteHandler(event:DragEvent):void
+	// not implemented
+    protected function dragCompleteHandler(event:DragEvent):void
     {
-        if (event.isDefaultPrevented())
-            return;
-        
-        // Remove the dragged items only if they were drag moved to
-        // a different list. If the items were drag moved to this
-        // list, the reordering was already handles in the 
-        // DragEvent.DRAG_DROP listener.
-        if (!dragMoveEnabled ||
-            event.action != DragManager.MOVE || 
-            event.relatedObject == this)
-            return;
-        
-        // Clear the selection, but remember which items were moved
-        var movedIndices:Vector.<int> = selectedIndices;
-        setSelectedIndices(new Vector.<int>(), true);
-        validateProperties(); // To commit the selection
-        
-        // Remove the moved items
-        movedIndices.sort(compareValues);
-        var count:int = movedIndices.length;
-        for (var i:int = count - 1; i >= 0; i--)
-        {
-            dataProvider.removeItemAt(movedIndices[i]);
-        }
-    } */
+        //if (event.isDefaultPrevented())
+            //return;
+        //
+        //// Remove the dragged items only if they were drag moved to
+        //// a different list. If the items were drag moved to this
+        //// list, the reordering was already handles in the 
+        //// DragEvent.DRAG_DROP listener.
+        //if (!dragMoveEnabled ||
+            //event.action != DragManager.MOVE || 
+            //event.relatedObject == this)
+            //return;
+        //
+        //// Clear the selection, but remember which items were moved
+        //var movedIndices:Vector.<int> = selectedIndices;
+        //setSelectedIndices(new Vector.<int>(), true);
+        //validateProperties(); // To commit the selection
+        //
+        //// Remove the moved items
+        //movedIndices.sort(compareValues);
+        //var count:int = movedIndices.length;
+        //for (var i:int = count - 1; i >= 0; i--)
+        //{
+            //dataProvider.removeItemAt(movedIndices[i]);
+        //}
+    }
     
     /**
      *  Creates an instance of a class that is used to display the visuals