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 2022/08/23 14:32:28 UTC

[royale-asjs] branch develop updated (8cae19e2c6 -> 1efd61a4e6)

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

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


    from 8cae19e2c6 The preventDefault was not allowing the VirtualList to scroll while navigating to up and down
     new 82ee0bd37a Starting DragManagerImpl
     new 92cc6d69fb Merge branch 'develop' of https://github.com/apache/royale-asjs into develop
     new 1efd61a4e6 Fix some compile issues and show dragging - still no drop

The 3 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:
 .../MXRoyale/src/main/resources/defaults.css       |   1 +
 .../src/main/royale/mx/core/Application.as         |   2 +
 .../src/main/royale/mx/managers/DragManager.as     |  36 +-
 .../src/main/resources/mx-royale-manifest.xml      |   1 +
 .../src/main/royale/MXRoyaleBaseClasses.as         |   2 +
 .../src/main/royale/mx/core/DragSource.as          | 482 ++++++++---------
 .../src/main/royale/mx/managers/DragManagerImpl.as | 589 +++++++++++++++++++++
 .../{ICursorManager.as => IDragManager.as}         |  41 +-
 .../SparkRoyale/src/main/resources/defaults.css    |   1 +
 .../main/royale/spark/components/Application.as    |   2 +
 10 files changed, 890 insertions(+), 267 deletions(-)
 rename frameworks/projects/{MXRoyale => MXRoyaleBase}/src/main/royale/mx/core/DragSource.as (96%)
 create mode 100644 frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
 copy frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/{ICursorManager.as => IDragManager.as} (60%)


[royale-asjs] 02/03: Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

Posted by yi...@apache.org.
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 92cc6d69fb2ed84d3b6558750b4f97a212f12d38
Merge: 82ee0bd37a 8cae19e2c6
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Tue Aug 23 16:15:19 2022 +0300

    Merge branch 'develop' of https://github.com/apache/royale-asjs into develop

 .../src/main/assembly/component-royale.xml         | 15 +++-
 .../js/projects/BasicJS/src/test/royale/build.xml  | 83 +++++-----------------
 .../projects/BindingJS/src/test/royale/build.xml   | 83 +++++-----------------
 .../CollectionsJS/src/test/royale/build.xml        | 83 +++++-----------------
 .../js/projects/CoreJS/src/test/royale/build.xml   | 83 +++++-----------------
 .../MXRoyaleBaseJS/src/test/royale/build.xml       | 83 +++++-----------------
 .../projects/NetworkJS/src/test/royale/build.xml   | 83 +++++-----------------
 .../ReflectionJS/src/test/royale/build.xml         | 83 +++++-----------------
 .../RoyaleUnitJS/src/test/royale/build.xml         | 83 +++++-----------------
 .../js/projects/XMLJS/src/test/royale/build.xml    | 83 +++++-----------------
 .../apache/royale/html/util/getLabelFromData.as    | 22 +++---
 .../controllers/VirtualListKeyDownController.as    |  2 +-
 .../MXRoyale/src/main/resources/defaults.css       | 12 +++-
 .../src/main/resources/mx-royale-manifest.xml      |  1 +
 .../src/main/royale/mx/containers/Panel.as         |  2 +
 .../MXRoyale/src/main/royale/mx/controls/HRule.as  | 69 +++++++++++++++++-
 .../MXRoyale/src/main/royale/mx/controls/VRule.as  | 38 ++++++++--
 .../main/royale/mx/controls/beads/TitleBarTitle.as | 35 +++++++++
 .../royale/mx/controls/beads/TitleBarView.mxml     | 55 ++++++++++++++
 .../mx/controls/listClasses/DataGridListBase.as    |  9 +++
 ...ataItemRendererFactoryForICollectionViewData.as |  3 +-
 .../src/main/royale/mx/core/UITextField.as         |  2 +
 22 files changed, 384 insertions(+), 628 deletions(-)



[royale-asjs] 01/03: Starting DragManagerImpl

Posted by yi...@apache.org.
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 82ee0bd37a361beedb254e89aa68116c9a701a30
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Tue Aug 23 16:13:31 2022 +0300

    Starting DragManagerImpl
---
 .../MXRoyale/src/main/resources/defaults.css       |   1 +
 .../src/main/royale/mx/core/Application.as         |   2 +
 .../src/main/royale/mx/managers/DragManager.as     |  26 +
 .../src/main/royale/MXRoyaleBaseClasses.as         |   1 +
 .../src/main/royale/mx/managers/DragManagerImpl.as | 558 +++++++++++++++++++++
 .../src/main/royale/mx/managers/IDragManager.as    |  54 ++
 .../SparkRoyale/src/main/resources/defaults.css    |   1 +
 .../main/royale/spark/components/Application.as    |   2 +
 8 files changed, 645 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 8aafb41356..a20ec45870 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -117,6 +117,7 @@ Application
 {
 	IBeadLayout: ClassReference("mx.containers.beads.ApplicationLayout");
 	ICursorManager: ClassReference("mx.managers.CursorManagerImpl");
+	IDragManager: ClassReference("mx.managers.DragManagerImpl");
 }
 
 AdvancedDataGrid
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
index 4ff24f7c06..7358db821c 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
@@ -66,6 +66,7 @@ import mx.managers.FocusManager;
 import mx.managers.ISystemManager;
 import mx.events.FlexEvent;
 import mx.managers.ICursorManager;
+import mx.managers.IDragManager;
 
 
 COMPILE::JS {
@@ -319,6 +320,7 @@ public class Application extends Container implements IStrand, IParent, IEventDi
 		addBead(new ContainerDataBinding()); // ApplicationDataBinding fires too soon
         addBead(new ClassAliasBead());
         loadBeadFromValuesManager(ICursorManager, "iCursorManager", FlexGlobals.topLevelApplication as IStrand);
+        loadBeadFromValuesManager(IDragManager, "iDragManager", FlexGlobals.topLevelApplication as IStrand);
 
         instanceParent = this;
         
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
index 8a944b6527..67c7266ef4 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
@@ -27,6 +27,8 @@ package mx.managers
 import mx.core.DragSource;
 import mx.core.IFlexDisplayObject;
 import mx.core.IUIComponent;
+import mx.core.FlexGlobals;
+import org.apache.royale.core.IStrand;
 //import mx.core.Singleton;
 import mx.core.mx_internal;
 //import mx.managers.dragClasses.DragProxy;
@@ -120,7 +122,31 @@ public class DragManager
     public static const LINK:String = "link";
     
    
+    /**
+     *  @private
+     *  Storage for the impl getter.
+     *  This gets initialized on first access,
+     *  not at static initialization time, in order to ensure
+     *  that the Singleton registry has already been initialized.
+     */
+    private static var _impl:IDragManager;
+    
+    /**
+     *  @private
+     *  The singleton instance of DragManagerImpl which was
+     *  registered as implementing the IDragManager interface.
+     */
+     private static function get impl():IDragManager
+    {
+        if (!_impl)
+        {
+            // _impl = IDragManager(
+            //     getInstance("mx.managers::IDragManager"));
+            _impl = (FlexGlobals.topLevelApplication as IStrand).getBeadByType(IDragManager) as IDragManager;
+        }
 
+        return _impl;
+    } 
     //--------------------------------------------------------------------------
     //
     //  Class properties
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
index 76ba29d144..a78f4ef767 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
@@ -172,6 +172,7 @@ internal class MXRoyaleBaseClasses
 	import mx.managers.CursorManager;CursorManager;
 	import mx.managers.CursorManagerPriority;CursorManagerPriority;
 	import mx.managers.ICursorManager;ICursorManager;
+	import mx.managers.IDragManager;IDragManager;
 	import mx.managers.ISystemManager;ISystemManager;
 	import mx.managers.SystemManagerGlobals;SystemManagerGlobals;
 
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
new file mode 100644
index 0000000000..7a4986c426
--- /dev/null
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
@@ -0,0 +1,558 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.managers
+{
+
+import org.apache.royale.events.EventDispatcher;
+import org.apache.royale.events.IEventDispatcher;
+import org.apache.royale.core.IStrand;
+
+
+import mx.core.DragSource;
+import mx.core.IFlexDisplayObject;
+import mx.core.IFlexModule;
+import mx.core.IFlexModuleFactory;
+import mx.core.IUIComponent;
+import mx.core.LayoutDirection;
+import mx.core.UIComponentGlobals;
+import mx.core.mx_internal;
+// import mx.events.DragEvent;
+import mx.styles.CSSStyleDeclaration;
+import mx.styles.IStyleManager2;
+import mx.styles.StyleManager;
+import org.apache.royale.core.IBead;
+import org.apache.royale.html.beads.controllers.DragMouseController;
+import org.apache.royale.html.beads.DragDropListView;
+import org.apache.royale.events.DragEvent;
+import org.apache.royale.html.beads.controllers.DropMouseController;
+import org.apache.royale.html.accessories.RestrictTextInputBead;
+
+// use namespace mx_internal;
+
+// [ExcludeClass]
+
+/**
+ *  @private
+ */
+public class DragManagerImpl extends EventDispatcher implements IDragManager, IBead
+{
+//     include "../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class variables
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private static var sm:ISystemManager;
+
+	/**
+	 *  @private
+	 */
+	private static var instance:IDragManager;
+
+	/**
+	 * @private
+	 * 
+	 * Place to hook in additional classes
+	 */
+	public static var mixins:Array;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	public static function getInstance():IDragManager
+	{
+		if (!instance)
+		instance = new DragManagerImpl();
+
+		return instance;
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	public function DragManagerImpl()
+	{
+		super();
+
+		if (instance)
+			throw new Error("Instance already exists.");
+			
+		if (mixins)
+		{
+			var n:int = mixins.length;
+			for (var i:int = 0; i < n; i++)
+			{
+				new mixins[i](this);
+			}
+		}
+
+		// sandboxRoot = sm.getSandboxRoot();
+
+		// if (sm.isTopLevelRoot())
+		// {
+		// 	sm.addEventListener(MouseEvent.MOUSE_DOWN, sm_mouseDownHandler, false, 0, true);
+		// 	sm.addEventListener(MouseEvent.MOUSE_UP, sm_mouseUpHandler, false, 0, true);
+		// }
+
+        if (hasEventListener("initialize"))
+		    dispatchEvent(new Event("initialize"));
+
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Variables
+	//
+	//--------------------------------------------------------------------------
+	
+
+	/**
+	 *  @private
+	 *  The highest place we can listen for events in our DOM
+	 */
+	private var sandboxRoot:IEventDispatcher;
+
+	/**
+	 *  @private
+	 *  Object that initiated the drag.
+	 */
+	private var dragInitiator:IUIComponent;
+
+	/**
+	 *  @private
+	 *  Object being dragged around.
+	 */
+	public var dragProxy:DragProxy;
+
+	/**
+	 *  @private
+	 */
+	public var bDoingDrag:Boolean = false;
+
+	/**
+	 *  @private
+	 */
+	private var mouseIsDown:Boolean = false;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+	
+	/**
+	 *  Read-only property that returns <code>true</code>
+	 *  if a drag is in progress.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function get isDragging():Boolean
+	{
+		return bDoingDrag;
+	}
+	
+	//--------------------------------------------------------------------------
+	//
+	//  Methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Initiates a drag and drop operation.
+	 *
+	 *  @param dragInitiator IUIComponent that specifies the component initiating
+	 *  the drag.
+	 *
+	 *  @param dragSource DragSource object that contains the data
+	 *  being dragged.
+	 *
+	 *  @param mouseEvent The MouseEvent that contains the mouse information
+	 *  for the start of the drag.
+	 *
+	 *  @param dragImage The image to drag. This argument is optional.
+	 *  If omitted, a standard drag rectangle is used during the drag and
+	 *  drop operation. If you specify an image, you must explicitly set a 
+	 *  height and width of the image or else it will not appear.
+	 *
+	 *  @param xOffset Number that specifies the x offset, in pixels, for the
+	 *  <code>dragImage</code>. This argument is optional. If omitted, the drag proxy
+	 *  is shown at the upper-left corner of the drag initiator. The offset is expressed
+	 *  in pixels from the left edge of the drag proxy to the left edge of the drag
+	 *  initiator, and is usually a negative number.
+	 *
+	 *  @param yOffset Number that specifies the y offset, in pixels, for the
+	 *  <code>dragImage</code>. This argument is optional. If omitted, the drag proxy
+	 *  is shown at the upper-left corner of the drag initiator. The offset is expressed
+	 *  in pixels from the top edge of the drag proxy to the top edge of the drag
+	 *  initiator, and is usually a negative number.
+	 *
+	 *  @param imageAlpha Number that specifies the alpha value used for the
+	 *  drag image. This argument is optional. If omitted, the default alpha
+	 *  value is 0.5. A value of 0.0 indicates that the image is transparent;
+	 *  a value of 1.0 indicates it is fully opaque. 
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function doDrag(
+			dragInitiator:IUIComponent, 
+			dragSource:DragSource, 
+			mouseEvent:MouseEvent,
+			dragImage:IFlexDisplayObject = null, // instance of dragged item(s)
+			xOffset:Number = 0,
+			yOffset:Number = 0,
+			imageAlpha:Number = 0.5,
+			allowMove:Boolean = true):void
+	{
+	// 	var proxyWidth:Number;
+	// 	var proxyHeight:Number;
+		
+	// 	// Can't start a new drag if we're already in the middle of one...
+	// 	if (bDoingDrag)
+	// 		return;
+		
+	// 	// Can't do a drag if the mouse isn't down
+	// 	if (!(mouseEvent.type == MouseEvent.MOUSE_DOWN ||
+	// 		  mouseEvent.type == MouseEvent.CLICK ||
+	// 		  mouseIsDown ||
+	// 		  mouseEvent.buttonDown))
+	// 	{
+	// 		return;
+	// 	}    
+			
+	// 	bDoingDrag = true;
+
+        if (hasEventListener("doDrag"))
+    		dispatchEvent(new Event("doDrag"));
+
+	// 	this.dragInitiator = dragInitiator;
+
+	// 	// The drag proxy is a UIComponent with a single child -
+	// 	// an instance of the dragImage.
+	// 	dragProxy = new DragProxy(dragInitiator, dragSource);
+
+        // var e:Event; 
+        // if (hasEventListener("popUpChildren"))
+        //     e = new DragEvent("popUpChildren", false, true, dragProxy);
+        // if (!e || dispatchEvent(e))	
+	// 		sm.popUpChildren.addChild(dragProxy);	
+
+	// 	if (!dragImage)
+	// 	{
+	// 		// No drag image specified, use default
+	// 		var dragManagerStyleDeclaration:CSSStyleDeclaration =
+        //         getStyleManager(dragInitiator).getMergedStyleDeclaration("mx.managers.DragManager");
+	// 		var dragImageClass:Class =
+	// 			dragManagerStyleDeclaration.getStyle("defaultDragImageSkin");
+	// 		dragImage = new dragImageClass();
+	// 		dragProxy.addChild(DisplayObject(dragImage));
+	// 		proxyWidth = dragInitiator.width;
+	// 		proxyHeight = dragInitiator.height;
+	// 	}
+	// 	else
+	// 	{
+	// 		dragProxy.addChild(DisplayObject(dragImage));
+	// 		if (dragImage is ILayoutManagerClient )
+	// 			UIComponentGlobals.layoutManager.validateClient(ILayoutManagerClient (dragImage), true);
+	// 		if (dragImage is IUIComponent)
+	// 		{
+	// 			proxyWidth = (dragImage as IUIComponent).getExplicitOrMeasuredWidth();
+	// 			proxyHeight = (dragImage as IUIComponent).getExplicitOrMeasuredHeight();
+	// 		}
+	// 		else
+	// 		{
+	// 			proxyWidth = dragImage.measuredWidth;
+	// 			proxyHeight = dragImage.measuredHeight;
+	// 		}
+	// 	}
+
+        // // Set the layoutDirection of the dragProxy and dragImage to match the dragInitiator
+        // // to ensure that they will be in the right position and orientation.
+        // if (dragInitiator is ILayoutDirectionElement &&
+        //     ILayoutDirectionElement(dragInitiator).layoutDirection == LayoutDirection.RTL)
+        //     dragProxy.layoutDirection = LayoutDirection.RTL;
+        
+	// 	dragImage.setActualSize(proxyWidth, proxyHeight);
+	// 	dragProxy.setActualSize(proxyWidth, proxyHeight);
+		
+	// 	// Alpha
+	// 	dragProxy.alpha = imageAlpha;
+
+	// 	dragProxy.allowMove = allowMove;
+		
+        // // Make sure any scale/rotation from the initiator will be reflected.
+        // var concatenatedMatrix:Matrix = 
+        //     MatrixUtil.getConcatenatedMatrix(DisplayObject(dragInitiator), 
+        //                                      DisplayObject(sandboxRoot));
+        
+        // // Zero out the translation part of the matrix, as we're going to 
+        // // position the dragProxy explicitly further below.        
+        // concatenatedMatrix.tx = 0;
+        // concatenatedMatrix.ty = 0;
+        // // Combine with the matrix of the dragImage if it has any.
+        // var m:Matrix = dragImage.transform.matrix;
+        // if (m)
+        // {
+        //     concatenatedMatrix.concat(dragImage.transform.matrix);
+        //     dragImage.transform.matrix = concatenatedMatrix;
+        // }
+        
+        // // Find mouse coordinates in global space
+        // var nonNullTarget:Object = mouseEvent.target;
+	// 	if (nonNullTarget == null)
+	// 		nonNullTarget = dragInitiator;
+		
+	// 	var point:Point = new Point(mouseEvent.localX, mouseEvent.localY);
+	// 	point = DisplayObject(nonNullTarget).localToGlobal(point);
+	// 	point = DisplayObject(sandboxRoot).globalToLocal(point);
+	// 	var mouseX:Number = point.x;
+	// 	var mouseY:Number = point.y;
+
+        // // Find the proxy origin in global space
+        // var proxyOrigin:Point = DisplayObject(dragInitiator).localToGlobal(new Point(-xOffset, -yOffset));
+        // proxyOrigin = DisplayObject(sandboxRoot).globalToLocal(proxyOrigin);
+        
+        // // Set dragProxy.offset to the mouse offset within the drag proxy.
+        // dragProxy.xOffset = mouseX - proxyOrigin.x;
+        // dragProxy.yOffset = mouseY - proxyOrigin.y;
+                
+        // // Setup the initial position of the drag proxy.
+        // dragProxy.x = proxyOrigin.x;
+        // dragProxy.y = proxyOrigin.y;
+		
+	// 	// Remember the starting location of the drag proxy so it can be
+	// 	// "snapped" back if the drop was refused.
+	// 	dragProxy.startX = dragProxy.x;
+	// 	dragProxy.startY = dragProxy.y;
+
+	// 	// Turn on caching.
+	// 	if (dragImage is DisplayObject) 
+	// 		DisplayObject(dragImage).cacheAsBitmap = true;
+			
+
+	// 	var delegate:Object = dragProxy.automationDelegate;
+	// 	if (delegate)
+	// 		delegate.recordAutomatableDragStart(dragInitiator, mouseEvent);
+		
+		var dragController:DragMouseController = (dragInitiator as IStrand).getBeadByType(DragMouseController) as DragMouseController;
+		if (!dragController)
+		{
+			dragController = new DragMouseController();
+		}
+		(dragInitiator as IStrand).addBead(dragController);
+		dragController.addEventListener("dragMove", dragMoveHandler)
+	}
+
+	private function dragMoveHandler(event:DragEvent):void
+	{
+		var relatedObject:IEventDispatcher = event.relatedObject as IEventDispatcher;
+		if (!relatedObject)
+		{
+			return;
+		}
+		if (relatedObject.hasEventListener(DragEvent.DRAG_ENTER) || relatedObject.hasEventListener(DragEvent.DRAG_EXIT) || relatedObject.hasEventListener(DragEvent.DRAG_OVER) || relatedObject.hasEventListener(DragEvent.DRAG_DROP))
+		{
+			var relatedStrand:IStrand = relatedObject as IStrand;
+			var dropController:DropMouseController = relatedStrand.getBeadByType(DropMouseController) as DropMouseController;
+			if (!dropController)
+			{
+				dropController = new DropMouseController();
+				relatedStrand.addBead(dropController);
+			}
+		}
+	}
+	
+	/**
+	 *  Call this method from your <code>dragEnter</code> event handler if you accept
+	 *  the drag/drop data.
+	 *  For example: 
+	 *
+	 *  <pre>DragManager.acceptDragDrop(event.target);</pre>
+	 *
+	 *	@param target The drop target accepting the drag.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function acceptDragDrop(target:IUIComponent):void
+	{
+		// trace("-->acceptDragDrop for DragManagerImpl", sm, target);
+
+		if (dragProxy)
+			dragProxy.target = target as DisplayObject;
+
+        if (hasEventListener("acceptDragDrop"))
+    		dispatchEvent(new Request("acceptDragDrop", false, false, target));
+
+	}
+	
+	/**
+	 *  Sets the feedback indicator for the drag and drop operation.
+	 *  Possible values are <code>DragManager.COPY</code>, <code>DragManager.MOVE</code>,
+	 *  <code>DragManager.LINK</code>, or <code>DragManager.NONE</code>.
+	 *
+	 *  @param feedback The type of feedback indicator to display.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function showFeedback(feedback:String):void
+	{
+		// trace("-->showFeedback for DragManagerImpl", sm, feedback);
+		if (dragProxy)
+		{
+			if (feedback == DragManager.MOVE && !dragProxy.allowMove)
+				feedback = DragManager.COPY;
+
+			dragProxy.action = feedback;
+		}
+
+        if (hasEventListener("showFeedback"))
+    		dispatchEvent(new Request("showFeedback", false, false, feedback));
+
+	}
+	
+	/**
+	 *  Returns the current drag and drop feedback.
+	 *
+	 *  @return  Possible return values are <code>DragManager.COPY</code>, 
+	 *  <code>DragManager.MOVE</code>,
+	 *  <code>DragManager.LINK</code>, or <code>DragManager.NONE</code>.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function getFeedback():String
+	{
+        if (hasEventListener("getFeedback"))
+        {
+		    var request:Request = new Request("getFeedback", false, true);
+		    if (!dispatchEvent(request))
+		    {
+			    return request.value as String;
+		    }
+        }
+
+		// trace("<--getFeedback for DragManagerImpl", sm);
+		return dragProxy ? dragProxy.action : DragManager.NONE;
+	}
+	
+	/**
+	 *  @private
+	 */
+	public function endDrag():void
+	{
+        var e:Event;
+        if (hasEventListener("endDrag"))
+        {
+            e = new Event("endDrag", false, true);
+        }
+        
+		if (!e || dispatchEvent(e))
+		{
+			if (dragProxy)
+			{
+				sm.popUpChildren.removeChild(dragProxy);	
+				
+                if (dragProxy.numChildren > 0)
+				    dragProxy.removeChildAt(0);	// The drag image is the only child
+				dragProxy = null;
+			}
+		}
+
+		dragInitiator = null;
+		bDoingDrag = false;
+
+	}
+
+    /**
+     *  @private
+     */
+    static private function getStyleManager(dragInitiator:IUIComponent):IStyleManager2
+    {
+        // If the dragInitiator has a styleManager, use that one.
+        // In a situation where a main application that loads a module with drag initiator,
+        // the main application may not link in the DragManager and appropriate styles.
+        // We want to use the styles of the module of the dragInitiator. See SDK-24324.
+        if (dragInitiator is IFlexModule)
+            return StyleManager.getStyleManager(IFlexModule(dragInitiator).moduleFactory);
+        
+        return StyleManager.getStyleManager(sm as IFlexModuleFactory);
+    }
+
+	//--------------------------------------------------------------------------
+	//
+	//  Event handlers
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private function sm_mouseDownHandler(event:MouseEvent):void
+	{
+		mouseIsDown = true;
+	}
+	
+	/**
+	 *  @private
+	 */
+	private function sm_mouseUpHandler(event:MouseEvent):void
+	{
+		mouseIsDown = false;
+	}
+
+	private var _strand:IStrand;
+	public function set strand(value:IStrand):void
+	{
+		_strand = value;
+	}
+
+}
+
+}
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as
new file mode 100644
index 0000000000..0408ad1016
--- /dev/null
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as
@@ -0,0 +1,54 @@
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.managers
+{
+
+import flash.events.MouseEvent;
+
+import mx.core.DragSource;
+import mx.core.IFlexDisplayObject;
+import mx.core.IUIComponent;
+
+// [ExcludeClass]
+
+/**
+ *  @private
+ */
+public interface IDragManager
+{
+	function get isDragging():Boolean;
+	function doDrag(
+			dragInitiator:IUIComponent, 
+			dragSource:DragSource,
+			mouseEvent:MouseEvent,
+			dragImage:IFlexDisplayObject = null, // instance of dragged item(s)
+			xOffset:Number = 0,
+			yOffset:Number = 0,
+			imageAlpha:Number = 0.5,
+			allowMove:Boolean = true):void;
+	function acceptDragDrop(target:IUIComponent):void;
+	function showFeedback(feedback:String):void;
+	function getFeedback():String;
+	function endDrag():void;
+}
+
+}
+
diff --git a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
index fbcfa460e9..573fe910b5 100644
--- a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
@@ -38,6 +38,7 @@ global {
 Application
 {
 	ICursorManager: ClassReference("mx.managers.CursorManagerImpl");
+	IDragManager: ClassReference("mx.managers.DragManagerImpl");
 }
 
 Button
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
index 8ebc58cad6..fb02078b07 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
@@ -67,6 +67,7 @@ import mx.core.IUIComponent;
 import mx.events.utils.MouseEventConverter;
 import mx.managers.ISystemManager;
 import mx.managers.ICursorManager;
+import mx.managers.IDragManager;
 
 COMPILE::JS {
     import org.apache.royale.core.ElementWrapper;
@@ -333,6 +334,7 @@ public class Application extends SkinnableContainer implements IStrand, IParent,
             ElementWrapper.converterMap["MouseEvent"] = MouseEventConverter.convert;
         }
         loadBeadFromValuesManager(ICursorManager, "iCursorManager", FlexGlobals.topLevelApplication as IStrand);
+        loadBeadFromValuesManager(IDragManager, "iDragManager", FlexGlobals.topLevelApplication as IStrand);
     }
 
     


[royale-asjs] 03/03: Fix some compile issues and show dragging - still no drop

Posted by yi...@apache.org.
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 1efd61a4e668b60c8bf1e83d63679a634c3e0b8a
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Tue Aug 23 17:32:17 2022 +0300

    Fix some compile issues and show dragging - still no drop
---
 .../src/main/royale/mx/managers/DragManager.as     |  10 +-
 .../src/main/resources/mx-royale-manifest.xml      |   1 +
 .../src/main/royale/MXRoyaleBaseClasses.as         |   1 +
 .../src/main/royale/mx/core/DragSource.as          | 482 ++++++++++-----------
 .../src/main/royale/mx/managers/DragManagerImpl.as | 175 +++++---
 .../src/main/royale/mx/managers/IDragManager.as    |   2 +-
 6 files changed, 351 insertions(+), 320 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
index 67c7266ef4..01f10bc235 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
@@ -231,8 +231,8 @@ public class DragManager
             imageAlpha:Number = 0.5,
             allowMove:Boolean = true):void
     {
-      /*   impl.doDrag(dragInitiator, dragSource, mouseEvent, dragImage, xOffset,
-                yOffset, imageAlpha, allowMove); */
+            impl.doDrag(dragInitiator, dragSource, mouseEvent, dragImage, xOffset,
+                yOffset, imageAlpha, allowMove);
     }
     
 
@@ -254,7 +254,7 @@ public class DragManager
      */
     public static function acceptDragDrop(target:IUIComponent):void
     {
-       /*  impl.acceptDragDrop(target); */
+        impl.acceptDragDrop(target);
     }
     
     /**
@@ -271,9 +271,7 @@ public class DragManager
      */
     public static function showFeedback(feedback:String):void
     {
-	/*        
-	impl.showFeedback(feedback);
-	*/    
+        impl.showFeedback(feedback);
 	}
         
     /**
diff --git a/frameworks/projects/MXRoyaleBase/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyaleBase/src/main/resources/mx-royale-manifest.xml
index bb901995da..bf8239f702 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/resources/mx-royale-manifest.xml
+++ b/frameworks/projects/MXRoyaleBase/src/main/resources/mx-royale-manifest.xml
@@ -71,6 +71,7 @@
 	<component id="EmailValidator" 						class="mx.validators.EmailValidator"/>
 	<component id="ZipCodeValidator" 					class="mx.validators.ZipCodeValidator"/>
 	<component id="CursorManagerImpl" 					class="mx.managers.CursorManagerImpl"/>
+	<component id="DragManagerImpl" 					class="mx.managers.DragManagerImpl"/>
 
 
 </componentPackage>
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
index a78f4ef767..73d4b42c63 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
@@ -288,6 +288,7 @@ internal class MXRoyaleBaseClasses
 	import mx.validators.StringValidator;StringValidator;
 	import mx.validators.ValidationResult;ValidationResult;
 	import mx.validators.Validator;Validator;
+	import mx.core.DragSource; DragSource;
 
 
 
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/DragSource.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/core/DragSource.as
similarity index 96%
rename from frameworks/projects/MXRoyale/src/main/royale/mx/core/DragSource.as
rename to frameworks/projects/MXRoyaleBase/src/main/royale/mx/core/DragSource.as
index 729e864fc2..1172592b20 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/DragSource.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/core/DragSource.as
@@ -1,241 +1,241 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  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.core
-{
-
-/**
- *  The DragSource class contains the data being dragged. The data can be in
- *  multiple formats, depending on the type of control that initiated the drag.
- *
- *  <p>Each format of data is identified with a string. The 
- *  <code>hasFormat()</code> method is used to determine if the object has
- *  data in that format. The <code>dataForFormat()</code> method is used
- *  to retrieve the data in the specified format.</p>
- *
- *  <p>Data can be added directly using the <code>addData()</code> method,
- *  or indirectly using the <code>addHandler()</code> method. The 
- *  <code>addHandler()</code> method registers a callback that will be called
- *  if the data is requested. This is useful for adding data in a non-native 
- *  format that may require large computations or conversions. For example, 
- *  if you have raw sound data you can add an MP3 format handler. The MP3 
- *  conversion will only be done if the MP3 data is requested.</p>
- *  
- *  
- *  @langversion 3.0
- *  @playerversion Flash 9
- *  @playerversion AIR 1.1
- *  @productversion Royale 0.9.3
- *  @royalesuppresspublicvarwarning
- */
-public class DragSource
-{
-	/* include "../core/Version.as"; */
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Constructor
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  Constructor.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Royale 0.9.3
-	 */
-	public function DragSource()
-	{
-		super();
-	}
-
-	//--------------------------------------------------------------------------
-	//
-	//  Variables
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  @private
-	 */
-	private var dataHolder:Object = {};	
-
-	/**
-	 *  @private
-	 */
-	private var formatHandlers:Object = {};
-
-	//--------------------------------------------------------------------------
-	//
-	//  Properties
-	//
-	//--------------------------------------------------------------------------
-
-	//----------------------------------
-	//  formats
-	//----------------------------------
-	
-	/**
-	 *  @private
-	 *  Storage for the formats property.
-	 */
-	private var _formats:Array /* of String */ = [];
-
-	/**
-	 *  Contains the formats of the drag data, as an Array of Strings.
-	 *  Set this property using the <code>addData()</code>
-	 *  or <code>addHandler()</code> methods.
-	 *  The default value depends on data added to the DragSource object.
-	 *
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Royale 0.9.3
-	 */
-	public function get formats():Array /* of String */
-	{
-		return _formats;
-	}
-	
-	//--------------------------------------------------------------------------
-	//
-	//  Methods
-	//
-	//--------------------------------------------------------------------------
-
-	/**
-	 *  Adds data and a corresponding format String to the drag source.
-	 *  This method does not return a value.
-	 * 
-	 *  @param data Object that specifies the drag data.
-	 *  This can be any object, such as a String, a DataProvider, and so on.
-	 *
-	 *  @param format String that specifies a label that describes
-	 *  the format for this data.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Royale 0.9.3
-	 */
-	public function addData(data:Object, format:String):void
-	{
-		_formats.push(format);
-		
-		dataHolder[format] = data;
-	}
-	
-	/**
-	 *  Adds a handler that is called when data
-	 *  for the specified format is requested. 
-	 *  This is useful when dragging large amounts of data.
-	 *  The handler is only called if the data is requested.
-	 *  This method does not return a value.
-	 *
-	 *  @param handler Function that specifies the handler
-	 *  called to request the data.
-	 *  This function must return the data in the specified format.
-	 *
-	 *  @param format String that specifies the format for this data.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Royale 0.9.3
-	 */
-	public function addHandler(handler:Function,
-							   format:String):void
-	{
-		_formats.push(format);
-
-		formatHandlers[format] = handler;
-	}
-	
-	/**
-	 *  Retrieves the data for the specified format.
-	 *  If the data was added with the <code>addData()</code> method,
-	 *  it is returned directly.
-	 *  If the data was added with the <code>addHandler()</code> method,
-	 *  the handler function is called to return the data.
-	 *
-	 *  @param format String that specifies a label that describes
-	 *  the format for the data to return. This string can be a custom value
-	 *  if you are creating a custom drop target with the <code>addData()</code> method. 
-	 *  <p>List-based controls have predefined values 
-	 *  for the <code>format</code> parameter. If the control that initiated the
-	 *  drag operation is a Tree, then the format is "treeItems" and the items
-	 *  implement the ITreeDataProvider interface. For all other List-based
-	 *  controls that have built-in drag and drop support, the format is "itemsByIndex" and the items
-	 *  implement the IDataProvider interface.</p>
-	 *
-	 *  @return An Object
-	 *  containing the data in the requested format.
-	 *  If you drag multiple items, the returned value is an Array. 
-	 *  For a List-based control, the returned value is always an Array, 
-	 *  even if it contains a single item.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Royale 0.9.3
-	 */
-	public function dataForFormat(format:String):Object
-	{
-		var data:Object = dataHolder[format];
-		if (data)
-			return data;
-		
-		if (formatHandlers[format])
-			return formatHandlers[format]();
-		
-		return null;
-	}
-	
-	/**
-	 *  Returns <code>true</code> if the data source contains
-	 *  the requested format; otherwise, it returns <code>false</code>.
-	 *
-	 *  @param format String that specifies a label that describes the format 
-	 *  for the data. 
-	 *
-	 *  @return <code>true</code> if the data source contains
-	 *  the requested format.
-	 *  
-	 *  @langversion 3.0
-	 *  @playerversion Flash 9
-	 *  @playerversion AIR 1.1
-	 *  @productversion Royale 0.9.3
-	 */
-	public function hasFormat(format:String):Boolean
-	{
-		var n:int = _formats.length;
-		for (var i:int = 0; i < n; i++)
-		{
-			if (_formats[i] == format)
-				return true;
-		}
-		
-		return false;
-	}
-}
-
-}
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+
+/**
+ *  The DragSource class contains the data being dragged. The data can be in
+ *  multiple formats, depending on the type of control that initiated the drag.
+ *
+ *  <p>Each format of data is identified with a string. The 
+ *  <code>hasFormat()</code> method is used to determine if the object has
+ *  data in that format. The <code>dataForFormat()</code> method is used
+ *  to retrieve the data in the specified format.</p>
+ *
+ *  <p>Data can be added directly using the <code>addData()</code> method,
+ *  or indirectly using the <code>addHandler()</code> method. The 
+ *  <code>addHandler()</code> method registers a callback that will be called
+ *  if the data is requested. This is useful for adding data in a non-native 
+ *  format that may require large computations or conversions. For example, 
+ *  if you have raw sound data you can add an MP3 format handler. The MP3 
+ *  conversion will only be done if the MP3 data is requested.</p>
+ *  
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Royale 0.9.3
+ *  @royalesuppresspublicvarwarning
+ */
+public class DragSource
+{
+	/* include "../core/Version.as"; */
+	
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Royale 0.9.3
+	 */
+	public function DragSource()
+	{
+		super();
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Variables
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private var dataHolder:Object = {};	
+
+	/**
+	 *  @private
+	 */
+	private var formatHandlers:Object = {};
+
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  formats
+	//----------------------------------
+	
+	/**
+	 *  @private
+	 *  Storage for the formats property.
+	 */
+	private var _formats:Array /* of String */ = [];
+
+	/**
+	 *  Contains the formats of the drag data, as an Array of Strings.
+	 *  Set this property using the <code>addData()</code>
+	 *  or <code>addHandler()</code> methods.
+	 *  The default value depends on data added to the DragSource object.
+	 *
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Royale 0.9.3
+	 */
+	public function get formats():Array /* of String */
+	{
+		return _formats;
+	}
+	
+	//--------------------------------------------------------------------------
+	//
+	//  Methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Adds data and a corresponding format String to the drag source.
+	 *  This method does not return a value.
+	 * 
+	 *  @param data Object that specifies the drag data.
+	 *  This can be any object, such as a String, a DataProvider, and so on.
+	 *
+	 *  @param format String that specifies a label that describes
+	 *  the format for this data.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Royale 0.9.3
+	 */
+	public function addData(data:Object, format:String):void
+	{
+		_formats.push(format);
+		
+		dataHolder[format] = data;
+	}
+	
+	/**
+	 *  Adds a handler that is called when data
+	 *  for the specified format is requested. 
+	 *  This is useful when dragging large amounts of data.
+	 *  The handler is only called if the data is requested.
+	 *  This method does not return a value.
+	 *
+	 *  @param handler Function that specifies the handler
+	 *  called to request the data.
+	 *  This function must return the data in the specified format.
+	 *
+	 *  @param format String that specifies the format for this data.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Royale 0.9.3
+	 */
+	public function addHandler(handler:Function,
+							   format:String):void
+	{
+		_formats.push(format);
+
+		formatHandlers[format] = handler;
+	}
+	
+	/**
+	 *  Retrieves the data for the specified format.
+	 *  If the data was added with the <code>addData()</code> method,
+	 *  it is returned directly.
+	 *  If the data was added with the <code>addHandler()</code> method,
+	 *  the handler function is called to return the data.
+	 *
+	 *  @param format String that specifies a label that describes
+	 *  the format for the data to return. This string can be a custom value
+	 *  if you are creating a custom drop target with the <code>addData()</code> method. 
+	 *  <p>List-based controls have predefined values 
+	 *  for the <code>format</code> parameter. If the control that initiated the
+	 *  drag operation is a Tree, then the format is "treeItems" and the items
+	 *  implement the ITreeDataProvider interface. For all other List-based
+	 *  controls that have built-in drag and drop support, the format is "itemsByIndex" and the items
+	 *  implement the IDataProvider interface.</p>
+	 *
+	 *  @return An Object
+	 *  containing the data in the requested format.
+	 *  If you drag multiple items, the returned value is an Array. 
+	 *  For a List-based control, the returned value is always an Array, 
+	 *  even if it contains a single item.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Royale 0.9.3
+	 */
+	public function dataForFormat(format:String):Object
+	{
+		var data:Object = dataHolder[format];
+		if (data)
+			return data;
+		
+		if (formatHandlers[format])
+			return formatHandlers[format]();
+		
+		return null;
+	}
+	
+	/**
+	 *  Returns <code>true</code> if the data source contains
+	 *  the requested format; otherwise, it returns <code>false</code>.
+	 *
+	 *  @param format String that specifies a label that describes the format 
+	 *  for the data. 
+	 *
+	 *  @return <code>true</code> if the data source contains
+	 *  the requested format.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Royale 0.9.3
+	 */
+	public function hasFormat(format:String):Boolean
+	{
+		var n:int = _formats.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			if (_formats[i] == format)
+				return true;
+		}
+		
+		return false;
+	}
+}
+
+}
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
index 7a4986c426..a6379e706f 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
@@ -30,19 +30,24 @@ import mx.core.IFlexDisplayObject;
 import mx.core.IFlexModule;
 import mx.core.IFlexModuleFactory;
 import mx.core.IUIComponent;
-import mx.core.LayoutDirection;
-import mx.core.UIComponentGlobals;
-import mx.core.mx_internal;
+import org.apache.royale.events.MouseEvent;
+
+// import mx.core.LayoutDirection;
+// import mx.core.UIComponentGlobals;
+// import mx.core.mx_internal;
 // import mx.events.DragEvent;
-import mx.styles.CSSStyleDeclaration;
-import mx.styles.IStyleManager2;
-import mx.styles.StyleManager;
+// import mx.styles.CSSStyleDeclaration;
+// import mx.styles.IStyleManager2;
+// import mx.styles.StyleManager;
 import org.apache.royale.core.IBead;
 import org.apache.royale.html.beads.controllers.DragMouseController;
-import org.apache.royale.html.beads.DragDropListView;
+// import org.apache.royale.html.beads.DragDropListView;
 import org.apache.royale.events.DragEvent;
 import org.apache.royale.html.beads.controllers.DropMouseController;
-import org.apache.royale.html.accessories.RestrictTextInputBead;
+import org.apache.royale.core.UIBase;
+import org.apache.royale.core.IUIBase;
+import org.apache.royale.core.Lookalike;
+// im`port org.apache.royale.html.accessories.RestrictTextInputBead;
 
 // use namespace mx_internal;
 
@@ -156,7 +161,7 @@ public class DragManagerImpl extends EventDispatcher implements IDragManager, IB
 	 *  @private
 	 *  Object being dragged around.
 	 */
-	public var dragProxy:DragProxy;
+	// public var dragProxy:DragProxy;
 
 	/**
 	 *  @private
@@ -380,6 +385,31 @@ public class DragManagerImpl extends EventDispatcher implements IDragManager, IB
 		}
 		(dragInitiator as IStrand).addBead(dragController);
 		dragController.addEventListener("dragMove", dragMoveHandler)
+		dragController.addEventListener("dragStart", dragStartHandler)
+		_dragSource = dragSource;
+		_lookAlike = createDragImage(dragInitiator);
+	}
+
+	private var _lookAlike:UIBase;
+	protected function createDragImage(dragInitiator:IUIBase):UIBase
+	{
+		var dragImage:UIBase = new Lookalike(dragInitiator);
+		dragImage.className = "DragImage";
+		dragImage.width = dragInitiator.width;
+		dragImage.height = dragInitiator.height;
+		COMPILE::JS 
+		{
+			dragImage.element.style.position = 'absolute';
+			dragImage.element.style.cursor = 'pointer';
+		}
+		return dragImage;
+	}
+
+	private var _dragSource:DragSource;
+	private function dragStartHandler(event:DragEvent):void
+	{
+		DragEvent.dragSource = _dragSource;
+		DragMouseController.dragImage = _lookAlike;
 	}
 
 	private function dragMoveHandler(event:DragEvent):void
@@ -417,13 +447,13 @@ public class DragManagerImpl extends EventDispatcher implements IDragManager, IB
 	 */
 	public function acceptDragDrop(target:IUIComponent):void
 	{
-		// trace("-->acceptDragDrop for DragManagerImpl", sm, target);
+	// 	// trace("-->acceptDragDrop for DragManagerImpl", sm, target);
 
-		if (dragProxy)
-			dragProxy.target = target as DisplayObject;
+	// 	if (dragProxy)
+	// 		dragProxy.target = target as DisplayObject;
 
-        if (hasEventListener("acceptDragDrop"))
-    		dispatchEvent(new Request("acceptDragDrop", false, false, target));
+        // if (hasEventListener("acceptDragDrop"))
+    	// 	dispatchEvent(new Request("acceptDragDrop", false, false, target));
 
 	}
 	
@@ -441,17 +471,17 @@ public class DragManagerImpl extends EventDispatcher implements IDragManager, IB
 	 */
 	public function showFeedback(feedback:String):void
 	{
-		// trace("-->showFeedback for DragManagerImpl", sm, feedback);
-		if (dragProxy)
-		{
-			if (feedback == DragManager.MOVE && !dragProxy.allowMove)
-				feedback = DragManager.COPY;
+	// 	// trace("-->showFeedback for DragManagerImpl", sm, feedback);
+	// 	if (dragProxy)
+	// 	{
+	// 		if (feedback == DragManager.MOVE && !dragProxy.allowMove)
+	// 			feedback = DragManager.COPY;
 
-			dragProxy.action = feedback;
-		}
+	// 		dragProxy.action = feedback;
+	// 	}
 
-        if (hasEventListener("showFeedback"))
-    		dispatchEvent(new Request("showFeedback", false, false, feedback));
+        // if (hasEventListener("showFeedback"))
+    	// 	dispatchEvent(new Request("showFeedback", false, false, feedback));
 
 	}
 	
@@ -469,17 +499,18 @@ public class DragManagerImpl extends EventDispatcher implements IDragManager, IB
 	 */
 	public function getFeedback():String
 	{
-        if (hasEventListener("getFeedback"))
-        {
-		    var request:Request = new Request("getFeedback", false, true);
-		    if (!dispatchEvent(request))
-		    {
-			    return request.value as String;
-		    }
-        }
-
-		// trace("<--getFeedback for DragManagerImpl", sm);
-		return dragProxy ? dragProxy.action : DragManager.NONE;
+        // if (hasEventListener("getFeedback"))
+        // {
+	// 	    var request:Request = new Request("getFeedback", false, true);
+	// 	    if (!dispatchEvent(request))
+	// 	    {
+	// 		    return request.value as String;
+	// 	    }
+        // }
+
+	// 	// trace("<--getFeedback for DragManagerImpl", sm);
+	// 	return dragProxy ? dragProxy.action : DragManager.NONE;
+	return null;
 	}
 	
 	/**
@@ -487,43 +518,43 @@ public class DragManagerImpl extends EventDispatcher implements IDragManager, IB
 	 */
 	public function endDrag():void
 	{
-        var e:Event;
-        if (hasEventListener("endDrag"))
-        {
-            e = new Event("endDrag", false, true);
-        }
+        // var e:Event;
+        // if (hasEventListener("endDrag"))
+        // {
+        //     e = new Event("endDrag", false, true);
+        // }
         
-		if (!e || dispatchEvent(e))
-		{
-			if (dragProxy)
-			{
-				sm.popUpChildren.removeChild(dragProxy);	
+	// 	if (!e || dispatchEvent(e))
+	// 	{
+	// 		if (dragProxy)
+	// 		{
+	// 			sm.popUpChildren.removeChild(dragProxy);	
 				
-                if (dragProxy.numChildren > 0)
-				    dragProxy.removeChildAt(0);	// The drag image is the only child
-				dragProxy = null;
-			}
-		}
+        //         if (dragProxy.numChildren > 0)
+	// 			    dragProxy.removeChildAt(0);	// The drag image is the only child
+	// 			dragProxy = null;
+	// 		}
+	// 	}
 
-		dragInitiator = null;
-		bDoingDrag = false;
+	// 	dragInitiator = null;
+	// 	bDoingDrag = false;
 
 	}
 
-    /**
-     *  @private
-     */
-    static private function getStyleManager(dragInitiator:IUIComponent):IStyleManager2
-    {
-        // If the dragInitiator has a styleManager, use that one.
-        // In a situation where a main application that loads a module with drag initiator,
-        // the main application may not link in the DragManager and appropriate styles.
-        // We want to use the styles of the module of the dragInitiator. See SDK-24324.
-        if (dragInitiator is IFlexModule)
-            return StyleManager.getStyleManager(IFlexModule(dragInitiator).moduleFactory);
+//     /**
+//      *  @private
+//      */
+//     static private function getStyleManager(dragInitiator:IUIComponent):IStyleManager2
+//     {
+//         // If the dragInitiator has a styleManager, use that one.
+//         // In a situation where a main application that loads a module with drag initiator,
+//         // the main application may not link in the DragManager and appropriate styles.
+//         // We want to use the styles of the module of the dragInitiator. See SDK-24324.
+//         if (dragInitiator is IFlexModule)
+//             return StyleManager.getStyleManager(IFlexModule(dragInitiator).moduleFactory);
         
-        return StyleManager.getStyleManager(sm as IFlexModuleFactory);
-    }
+//         return StyleManager.getStyleManager(sm as IFlexModuleFactory);
+//     }
 
 	//--------------------------------------------------------------------------
 	//
@@ -534,18 +565,18 @@ public class DragManagerImpl extends EventDispatcher implements IDragManager, IB
 	/**
 	 *  @private
 	 */
-	private function sm_mouseDownHandler(event:MouseEvent):void
-	{
-		mouseIsDown = true;
-	}
+	// private function sm_mouseDownHandler(event:MouseEvent):void
+	// {
+	// 	mouseIsDown = true;
+	// }
 	
 	/**
 	 *  @private
 	 */
-	private function sm_mouseUpHandler(event:MouseEvent):void
-	{
-		mouseIsDown = false;
-	}
+	// private function sm_mouseUpHandler(event:MouseEvent):void
+	// {
+	// 	mouseIsDown = false;
+	// }
 
 	private var _strand:IStrand;
 	public function set strand(value:IStrand):void
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as
index 0408ad1016..1b5d6a6189 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as
@@ -21,7 +21,7 @@
 package mx.managers
 {
 
-import flash.events.MouseEvent;
+import org.apache.royale.events.MouseEvent;
 
 import mx.core.DragSource;
 import mx.core.IFlexDisplayObject;