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 b9f115dbba Trigger drop events etc. with DragManager
b9f115dbba is described below
commit b9f115dbbad7ee675c253097539195283925c980
Author: Yishay Weiss <[email protected]>
AuthorDate: Tue Aug 23 20:59:00 2022 +0300
Trigger drop events etc. with DragManager
---
.../MXRoyale/src/main/royale/MXRoyaleClasses.as | 2 -
.../src/main/royale/MXRoyaleBaseClasses.as | 2 +
.../src/main/royale/mx/events/DragEvent.as | 806 ++++++++++-----------
.../src/main/royale/mx/events/MouseEvent.as | 342 ++++-----
.../src/main/royale/mx/managers/DragManagerImpl.as | 10 +-
.../mx/managers/beads/DragManagerImplDropBead.as | 398 ++++++++++
6 files changed, 980 insertions(+), 580 deletions(-)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index 87a302643b..049c9f4d76 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -180,7 +180,6 @@ internal class MXRoyaleClasses
/*import mx.events.IndexChangedEvent; IndexChangedEvent;*/
import mx.events.ItemClickEvent; ItemClickEvent;
import mx.events.ModuleEvent; ModuleEvent;
- import mx.events.MouseEvent; MouseEvent;
import mx.managers.SystemManager; SystemManager;
import mx.filters.BitmapFilter; BitmapFilter;
import mx.filters.ColorMatrixFilter; ColorMatrixFilter;
@@ -230,7 +229,6 @@ internal class MXRoyaleClasses
/*import mx.net.SharedObject; SharedObject;
import mx.net.SharedObjectJSON; SharedObjectJSON;*/
import mx.modules.ModuleManager; ModuleManager;
- import mx.events.DragEvent; DragEvent;
/*import mx.formatters.DateBase; DateBase;*/
/*import mx.core.Keyboard; Keyboard;*/
import mx.core.UIComponentGlobals; UIComponentGlobals;
diff --git
a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
index 73d4b42c63..0a82b005b1 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
@@ -289,6 +289,8 @@ internal class MXRoyaleBaseClasses
import mx.validators.ValidationResult;ValidationResult;
import mx.validators.Validator;Validator;
import mx.core.DragSource; DragSource;
+ import mx.events.DragEvent; DragEvent;
+ import mx.events.MouseEvent; MouseEvent;
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/events/DragEvent.as
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/events/DragEvent.as
similarity index 97%
rename from frameworks/projects/MXRoyale/src/main/royale/mx/events/DragEvent.as
rename to
frameworks/projects/MXRoyaleBase/src/main/royale/mx/events/DragEvent.as
index 5aac5d0690..4b045d15a6 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/events/DragEvent.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/events/DragEvent.as
@@ -1,403 +1,403 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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.events
-{
-
-/* import flash.events.Event;
-import flash.events.MouseEvent; */
-import mx.events.MouseEvent;
-import mx.core.DragSource;
-import mx.core.IUIComponent;
-
-/**
- * The DragEvent class represents event objects that are dispatched as part
of a drag-and-drop
- * operation.
- *
- * @see mx.managers.DragManager
- * @see mx.core.DragSource
- * @see mx.core.UIComponent
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- *
- * @royalesuppresspublicvarwarning
- */
-public class DragEvent extends MouseEvent
-{
- //include "../core/Version.as";
-
-
//--------------------------------------------------------------------------
- //
- // Class constants
- //
-
//--------------------------------------------------------------------------
-
- /**
- * The <code>DragEvent.DRAG_COMPLETE</code> constant defines the value
of the
- * <code>type</code> property of the event object for a
<code>dragComplete</code> event.
- *
- * <p>The properties of the event object have the following values:</p>
- * <table class="innertable">
- * <tr><th>Property</th><th>Value</th></tr>
- * <tr><td><code>action</code></td><td>The action that caused the
event:
- * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
- * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
- * <tr><td><code>bubbles</code></td><td>false</td></tr>
- * <tr><td><code>cancelable</code></td><td>false</td></tr>
- * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
- * event listener that handles the event. For example, if you use
- * <code>myButton.addEventListener()</code> to register an event
listener,
- * myButton is the value of the <code>currentTarget</code>.
</td></tr>
- * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
- * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
- * data being dragged.</td></tr>
- * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
- * it is not always the Object listening for the event.
- * Use the <code>currentTarget</code> property to always access the
- * Object listening for the event.</td></tr>
- * </table>
- *
- * @eventType dragComplete
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public static const DRAG_COMPLETE:String = "dragComplete";
-
- /**
- * The <code>DragEvent.DRAG_DROP</code> constant defines the value of
the
- * <code>type</code> property of the event object for a
<code>dragDrop</code> event.
- *
- * <p>The properties of the event object have the following values:</p>
- * <table class="innertable">
- * <tr><th>Property</th><th>Value</th></tr>
- * <tr><td><code>action</code></td><td>The action that caused the
event:
- * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
- * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
- * <tr><td><code>bubbles</code></td><td>false</td></tr>
- * <tr><td><code>cancelable</code></td><td>false</td></tr>
- * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
- * event listener that handles the event. For example, if you use
- * <code>myButton.addEventListener()</code> to register an event
listener,
- * myButton is the value of the <code>currentTarget</code>.
</td></tr>
- * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
- * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
- * data being dragged.</td></tr>
- * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
- * it is not always the Object listening for the event.
- * Use the <code>currentTarget</code> property to always access the
- * Object listening for the event.</td></tr>
- * </table>
- *
- * @eventType dragDrop
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public static const DRAG_DROP:String = "dragDrop";
-
- /**
- * The <code>DragEvent.DRAG_ENTER</code> constant defines the value of
the
- * <code>type</code> property of the event object for a
<code>dragEnter</code> event.
- *
- * <p>The properties of the event object have the following values:</p>
- * <table class="innertable">
- * <tr><th>Property</th><th>Value</th></tr>
- * <tr><td><code>action</code></td><td>The action that caused the
event, which is always
- * <code>DragManager.MOVE</code>.</td></tr>
- * <tr><td><code>bubbles</code></td><td>false</td></tr>
- * <tr><td><code>cancelable</code></td><td>false</td></tr>
- * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
- * event listener that handles the event. For example, if you use
- * <code>myButton.addEventListener()</code> to register an event
listener,
- * myButton is the value of the <code>currentTarget</code>.
</td></tr>
- * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
- * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
- * data being dragged.</td></tr>
- * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
- * it is not always the Object listening for the event.
- * Use the <code>currentTarget</code> property to always access the
- * Object listening for the event.</td></tr>
- * </table>
- *
- * @eventType dragEnter
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public static const DRAG_ENTER:String = "dragEnter";
-
- /**
- * The <code>DragEvent.DRAG_EXIT</code> constant defines the value of
the
- * <code>type</code> property of the event object for a
<code>dragExit</code> event.
- *
- * <p>The properties of the event object have the following values:</p>
- * <table class="innertable">
- * <tr><th>Property</th><th>Value</th></tr>
- * <tr><td><code>action</code></td><td>The action that caused the
event:
- * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
- * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
- * <tr><td><code>bubbles</code></td><td>false</td></tr>
- * <tr><td><code>cancelable</code></td><td>false</td></tr>
- * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
- * event listener that handles the event. For example, if you use
- * <code>myButton.addEventListener()</code> to register an event
listener,
- * myButton is the value of the <code>currentTarget</code>.
</td></tr>
- * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
- * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
- * data being dragged.</td></tr>
- * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
- * it is not always the Object listening for the event.
- * Use the <code>currentTarget</code> property to always access the
- * Object listening for the event.</td></tr>
- * </table>
- *
- * @eventType dragExit
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public static const DRAG_EXIT:String = "dragExit";
-
- /**
- * The <code>DragEvent.DRAG_OVER</code> constant defines the value of
the
- * <code>type</code> property of the event object for a
<code>dragOver</code> event.
- *
- * <p>The properties of the event object have the following values:</p>
- * <table class="innertable">
- * <tr><th>Property</th><th>Value</th></tr>
- * <tr><td><code>action</code></td><td>The action that caused the
event:
- * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
- * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
- * <tr><td><code>bubbles</code></td><td>false</td></tr>
- * <tr><td><code>cancelable</code></td><td>false</td></tr>
- * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
- * event listener that handles the event. For example, if you use
- * <code>myButton.addEventListener()</code> to register an event
listener,
- * myButton is the value of the <code>currentTarget</code>.
</td></tr>
- * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
- * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
- * data being dragged.</td></tr>
- * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
- * it is not always the Object listening for the event.
- * Use the <code>currentTarget</code> property to always access the
- * Object listening for the event.</td></tr>
- * </table>
- *
- * @eventType dragOver
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public static const DRAG_OVER:String = "dragOver";
-
- /**
- * The DragEvent.DRAG_START constant defines the value of the
- * <code>type</code> property of the event object for a
<code>dragStart</code> event.
- *
- * <p>The properties of the event object have the following values:</p>
- * <table class="innertable">
- * <tr><th>Property</th><th>Value</th></tr>
- * <tr><td><code>action</code></td><td>The action that caused the
event:
- * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
- * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
- * <tr><td><code>bubbles</code></td><td>false</td></tr>
- * <tr><td><code>cancelable</code></td><td>false</td></tr>
- * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
- * event listener that handles the event. For example, if you use
- * <code>myButton.addEventListener()</code> to register an event
listener,
- * myButton is the value of the <code>currentTarget</code>.
</td></tr>
- * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
- * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
- * data being dragged.</td></tr>
- * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
- * it is not always the Object listening for the event.
- * Use the <code>currentTarget</code> property to always access the
- * Object listening for the event.</td></tr>
- * </table>
- *
- * @eventType dragStart
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public static const DRAG_START:String = "dragStart";
-
-
//--------------------------------------------------------------------------
- //
- // Constructor
- //
-
//--------------------------------------------------------------------------
-
- /**
- * Constructor.
- * Normally called by the Flex control and not used in application
code.
- *
- * @param type The event type; indicates the action that caused the
event.
- *
- * @param bubbles Specifies whether the event can bubble up the
display list hierarchy.
- *
- * @param cancelable Specifies whether the behavior associated with
the event can be prevented.
- *
- * @param dragInitiator IUIComponent that specifies the component
initiating
- * the drag.
- *
- * @param dragSource A DragSource object containing the data being
dragged.
- *
- * @param action The specified drop action, such as
<code>DragManager.MOVE</code>.
- *
- * @param ctrlKey Indicates whether the <code>Ctrl</code> key was
pressed.
- *
- * @param altKey Indicates whether the <code>Alt</code> key was
pressed.
- *
- * @param shiftKey Indicates whether the <code>Shift</code> key was
pressed.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function DragEvent(type:String, bubbles:Boolean = false,
- cancelable:Boolean =
true,
-
dragInitiator:IUIComponent = null,
- dragSource:DragSource
= null,
- action:String = null,
- ctrlKey:Boolean =
false,
- altKey:Boolean =
false,
- shiftKey:Boolean =
false)
- {
- super(type, bubbles, cancelable);
-
- this.dragInitiator = dragInitiator;
- this.dragSource = dragSource;
- this.action = action;
- // this.ctrlKey = ctrlKey;
- // this.altKey = altKey;
- // this.shiftKey = shiftKey;
- }
-
-
//--------------------------------------------------------------------------
- //
- // Properties
- //
-
//--------------------------------------------------------------------------
-
- //----------------------------------
- // action
- //----------------------------------
-
- /**
- * The requested action.
- * One of <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
- * <code>DragManager.MOVE</code>, or <code>DragManager.NONE</code>.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var action:String;
-
- //----------------------------------
- // draggedItem
- //----------------------------------
-
- /**
- * If the <code>dragInitiator</code> property contains
- * an IAutomationObject object,
- * this property contains the child IAutomationObject object near the
mouse cursor.
- * If the <code>dragInitiator</code> property does not contain
- * an IAutomationObject object, this proprty is <code>null</code>.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-// public var draggedItem:Object;
-
- //----------------------------------
- // dragInitiator
- //----------------------------------
-
- /**
- * The component that initiated the drag.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var dragInitiator:IUIComponent;
-
- //----------------------------------
- // dragSource
- //----------------------------------
-
- /**
- * The DragSource object containing the data being dragged.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var dragSource:DragSource;
-
-
//--------------------------------------------------------------------------
- //
- // Overridden methods: Event
- //
-
//--------------------------------------------------------------------------
-
- /**
- * @private
- */
- /* override public function clone():Event
- {
- var cloneEvent:DragEvent = new DragEvent(type, bubbles,
cancelable,
- dragInitiator, dragSource,
-
action, ctrlKey,
-
altKey, shiftKey);
-
- // Set relevant MouseEvent properties.
- cloneEvent.relatedObject = this.relatedObject;
- cloneEvent.localX = this.localX;
- cloneEvent.localY = this.localY;
-
- return cloneEvent;
- } */
-}
-
-}
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events
+{
+
+/* import flash.events.Event;
+import flash.events.MouseEvent; */
+import mx.events.MouseEvent;
+import mx.core.DragSource;
+import mx.core.IUIComponent;
+
+/**
+ * The DragEvent class represents event objects that are dispatched as part
of a drag-and-drop
+ * operation.
+ *
+ * @see mx.managers.DragManager
+ * @see mx.core.DragSource
+ * @see mx.core.UIComponent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ *
+ * @royalesuppresspublicvarwarning
+ */
+public class DragEvent extends MouseEvent
+{
+ //include "../core/Version.as";
+
+
//--------------------------------------------------------------------------
+ //
+ // Class constants
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * The <code>DragEvent.DRAG_COMPLETE</code> constant defines the value
of the
+ * <code>type</code> property of the event object for a
<code>dragComplete</code> event.
+ *
+ * <p>The properties of the event object have the following values:</p>
+ * <table class="innertable">
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td><code>action</code></td><td>The action that caused the
event:
+ * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
+ * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
+ * <tr><td><code>bubbles</code></td><td>false</td></tr>
+ * <tr><td><code>cancelable</code></td><td>false</td></tr>
+ * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
+ * event listener that handles the event. For example, if you use
+ * <code>myButton.addEventListener()</code> to register an event
listener,
+ * myButton is the value of the <code>currentTarget</code>.
</td></tr>
+ * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
+ * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
+ * data being dragged.</td></tr>
+ * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
+ * it is not always the Object listening for the event.
+ * Use the <code>currentTarget</code> property to always access the
+ * Object listening for the event.</td></tr>
+ * </table>
+ *
+ * @eventType dragComplete
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DRAG_COMPLETE:String = "dragComplete";
+
+ /**
+ * The <code>DragEvent.DRAG_DROP</code> constant defines the value of
the
+ * <code>type</code> property of the event object for a
<code>dragDrop</code> event.
+ *
+ * <p>The properties of the event object have the following values:</p>
+ * <table class="innertable">
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td><code>action</code></td><td>The action that caused the
event:
+ * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
+ * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
+ * <tr><td><code>bubbles</code></td><td>false</td></tr>
+ * <tr><td><code>cancelable</code></td><td>false</td></tr>
+ * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
+ * event listener that handles the event. For example, if you use
+ * <code>myButton.addEventListener()</code> to register an event
listener,
+ * myButton is the value of the <code>currentTarget</code>.
</td></tr>
+ * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
+ * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
+ * data being dragged.</td></tr>
+ * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
+ * it is not always the Object listening for the event.
+ * Use the <code>currentTarget</code> property to always access the
+ * Object listening for the event.</td></tr>
+ * </table>
+ *
+ * @eventType dragDrop
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DRAG_DROP:String = "dragDrop";
+
+ /**
+ * The <code>DragEvent.DRAG_ENTER</code> constant defines the value of
the
+ * <code>type</code> property of the event object for a
<code>dragEnter</code> event.
+ *
+ * <p>The properties of the event object have the following values:</p>
+ * <table class="innertable">
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td><code>action</code></td><td>The action that caused the
event, which is always
+ * <code>DragManager.MOVE</code>.</td></tr>
+ * <tr><td><code>bubbles</code></td><td>false</td></tr>
+ * <tr><td><code>cancelable</code></td><td>false</td></tr>
+ * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
+ * event listener that handles the event. For example, if you use
+ * <code>myButton.addEventListener()</code> to register an event
listener,
+ * myButton is the value of the <code>currentTarget</code>.
</td></tr>
+ * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
+ * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
+ * data being dragged.</td></tr>
+ * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
+ * it is not always the Object listening for the event.
+ * Use the <code>currentTarget</code> property to always access the
+ * Object listening for the event.</td></tr>
+ * </table>
+ *
+ * @eventType dragEnter
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DRAG_ENTER:String = "dragEnter";
+
+ /**
+ * The <code>DragEvent.DRAG_EXIT</code> constant defines the value of
the
+ * <code>type</code> property of the event object for a
<code>dragExit</code> event.
+ *
+ * <p>The properties of the event object have the following values:</p>
+ * <table class="innertable">
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td><code>action</code></td><td>The action that caused the
event:
+ * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
+ * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
+ * <tr><td><code>bubbles</code></td><td>false</td></tr>
+ * <tr><td><code>cancelable</code></td><td>false</td></tr>
+ * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
+ * event listener that handles the event. For example, if you use
+ * <code>myButton.addEventListener()</code> to register an event
listener,
+ * myButton is the value of the <code>currentTarget</code>.
</td></tr>
+ * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
+ * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
+ * data being dragged.</td></tr>
+ * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
+ * it is not always the Object listening for the event.
+ * Use the <code>currentTarget</code> property to always access the
+ * Object listening for the event.</td></tr>
+ * </table>
+ *
+ * @eventType dragExit
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DRAG_EXIT:String = "dragExit";
+
+ /**
+ * The <code>DragEvent.DRAG_OVER</code> constant defines the value of
the
+ * <code>type</code> property of the event object for a
<code>dragOver</code> event.
+ *
+ * <p>The properties of the event object have the following values:</p>
+ * <table class="innertable">
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td><code>action</code></td><td>The action that caused the
event:
+ * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
+ * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
+ * <tr><td><code>bubbles</code></td><td>false</td></tr>
+ * <tr><td><code>cancelable</code></td><td>false</td></tr>
+ * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
+ * event listener that handles the event. For example, if you use
+ * <code>myButton.addEventListener()</code> to register an event
listener,
+ * myButton is the value of the <code>currentTarget</code>.
</td></tr>
+ * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
+ * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
+ * data being dragged.</td></tr>
+ * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
+ * it is not always the Object listening for the event.
+ * Use the <code>currentTarget</code> property to always access the
+ * Object listening for the event.</td></tr>
+ * </table>
+ *
+ * @eventType dragOver
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DRAG_OVER:String = "dragOver";
+
+ /**
+ * The DragEvent.DRAG_START constant defines the value of the
+ * <code>type</code> property of the event object for a
<code>dragStart</code> event.
+ *
+ * <p>The properties of the event object have the following values:</p>
+ * <table class="innertable">
+ * <tr><th>Property</th><th>Value</th></tr>
+ * <tr><td><code>action</code></td><td>The action that caused the
event:
+ * <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
+ * <code>DragManager.MOVE</code>, or
<code>DragManager.NONE</code>.</td></tr>
+ * <tr><td><code>bubbles</code></td><td>false</td></tr>
+ * <tr><td><code>cancelable</code></td><td>false</td></tr>
+ * <tr><td><code>currentTarget</code></td><td>The Object that defines
the
+ * event listener that handles the event. For example, if you use
+ * <code>myButton.addEventListener()</code> to register an event
listener,
+ * myButton is the value of the <code>currentTarget</code>.
</td></tr>
+ * <tr><td><code>dragInitiator</code></td><td>The component that
initiated the drag.</td></tr>
+ * <tr><td><code>dragSource</code></td><td>The DragSource object
containing the
+ * data being dragged.</td></tr>
+ * <tr><td><code>target</code></td><td>The Object that dispatched the
event;
+ * it is not always the Object listening for the event.
+ * Use the <code>currentTarget</code> property to always access the
+ * Object listening for the event.</td></tr>
+ * </table>
+ *
+ * @eventType dragStart
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DRAG_START:String = "dragStart";
+
+
//--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ * Normally called by the Flex control and not used in application
code.
+ *
+ * @param type The event type; indicates the action that caused the
event.
+ *
+ * @param bubbles Specifies whether the event can bubble up the
display list hierarchy.
+ *
+ * @param cancelable Specifies whether the behavior associated with
the event can be prevented.
+ *
+ * @param dragInitiator IUIComponent that specifies the component
initiating
+ * the drag.
+ *
+ * @param dragSource A DragSource object containing the data being
dragged.
+ *
+ * @param action The specified drop action, such as
<code>DragManager.MOVE</code>.
+ *
+ * @param ctrlKey Indicates whether the <code>Ctrl</code> key was
pressed.
+ *
+ * @param altKey Indicates whether the <code>Alt</code> key was
pressed.
+ *
+ * @param shiftKey Indicates whether the <code>Shift</code> key was
pressed.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function DragEvent(type:String, bubbles:Boolean = false,
+ cancelable:Boolean =
true,
+
dragInitiator:IUIComponent = null,
+ dragSource:DragSource
= null,
+ action:String = null,
+ ctrlKey:Boolean =
false,
+ altKey:Boolean =
false,
+ shiftKey:Boolean =
false)
+ {
+ super(type, bubbles, cancelable);
+
+ this.dragInitiator = dragInitiator;
+ this.dragSource = dragSource;
+ this.action = action;
+ // this.ctrlKey = ctrlKey;
+ // this.altKey = altKey;
+ // this.shiftKey = shiftKey;
+ }
+
+
//--------------------------------------------------------------------------
+ //
+ // Properties
+ //
+
//--------------------------------------------------------------------------
+
+ //----------------------------------
+ // action
+ //----------------------------------
+
+ /**
+ * The requested action.
+ * One of <code>DragManager.COPY</code>, <code>DragManager.LINK</code>,
+ * <code>DragManager.MOVE</code>, or <code>DragManager.NONE</code>.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var action:String;
+
+ //----------------------------------
+ // draggedItem
+ //----------------------------------
+
+ /**
+ * If the <code>dragInitiator</code> property contains
+ * an IAutomationObject object,
+ * this property contains the child IAutomationObject object near the
mouse cursor.
+ * If the <code>dragInitiator</code> property does not contain
+ * an IAutomationObject object, this proprty is <code>null</code>.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+// public var draggedItem:Object;
+
+ //----------------------------------
+ // dragInitiator
+ //----------------------------------
+
+ /**
+ * The component that initiated the drag.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var dragInitiator:IUIComponent;
+
+ //----------------------------------
+ // dragSource
+ //----------------------------------
+
+ /**
+ * The DragSource object containing the data being dragged.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public var dragSource:DragSource;
+
+
//--------------------------------------------------------------------------
+ //
+ // Overridden methods: Event
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * @private
+ */
+ /* override public function clone():Event
+ {
+ var cloneEvent:DragEvent = new DragEvent(type, bubbles,
cancelable,
+ dragInitiator, dragSource,
+
action, ctrlKey,
+
altKey, shiftKey);
+
+ // Set relevant MouseEvent properties.
+ cloneEvent.relatedObject = this.relatedObject;
+ cloneEvent.localX = this.localX;
+ cloneEvent.localY = this.localY;
+
+ return cloneEvent;
+ } */
+}
+
+}
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/events/MouseEvent.as
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/events/MouseEvent.as
similarity index 97%
rename from frameworks/projects/MXRoyale/src/main/royale/mx/events/MouseEvent.as
rename to
frameworks/projects/MXRoyaleBase/src/main/royale/mx/events/MouseEvent.as
index a128ac3301..3a78997654 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/events/MouseEvent.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/events/MouseEvent.as
@@ -1,171 +1,171 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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.events
-{
-/* import mx.events.Event;*/
-import org.apache.royale.events.Event;
-import org.apache.royale.events.IEventDispatcher;
-import org.apache.royale.events.IRoyaleEvent;
-import org.apache.royale.events.MouseEvent;
-
-/**
- * Represents event objects that are dispatched when a Flex component moves.
- *
- * @see mx.core.UIComponent
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Royale 0.9.3
- * @royalesuppresspublicvarwarning
- */
-public class MouseEvent extends org.apache.royale.events.MouseEvent
-{
- /* include "../core/Version.as"; */
- public static const MOUSE_DOWN:String =
org.apache.royale.events.MouseEvent.MOUSE_DOWN;
- public static const MOUSE_MOVE:String =
org.apache.royale.events.MouseEvent.MOUSE_MOVE;
- public static const MOUSE_UP:String =
org.apache.royale.events.MouseEvent.MOUSE_UP;
- public static const MOUSE_OUT:String =
org.apache.royale.events.MouseEvent.MOUSE_OUT;
- public static const MOUSE_OVER:String =
org.apache.royale.events.MouseEvent.MOUSE_OVER;
- public static const ROLL_OVER:String =
org.apache.royale.events.MouseEvent.ROLL_OVER;
- public static const ROLL_OUT:String =
org.apache.royale.events.MouseEvent.ROLL_OUT;
- public static const CLICK:String =
org.apache.royale.events.MouseEvent.CLICK;
- public static const DOUBLE_CLICK:String =
org.apache.royale.events.MouseEvent.DOUBLE_CLICK;
- public static const CONTEXT_MENU:String =
org.apache.royale.events.MouseEvent.CONTEXT_MENU;
- public static const MOUSE_WHEEL:String =
org.apache.royale.events.MouseEvent.MOUSE_WHEEL;
-
-
//--------------------------------------------------------------------------
- //
- // Class constants
- //
-
//--------------------------------------------------------------------------
-
- COMPILE::SWF
- {
- override public function get stageX():Number
- {
- return super.stageX;
- }
-
- override public function get stageY():Number
- {
- return super.stageY;
- }
- override public function updateAfterEvent():void
- {
- super.updateAfterEvent();
- }
- }
-
- COMPILE::JS
- {
- public function get stageX():Number
- {
- return screenX;
- }
-
- public function get stageY():Number
- {
- return screenY;
- }
- public function updateAfterEvent():void
- {
- }
- }
-
-
-
-
//--------------------------------------------------------------------------
- //
- // Constructor
- //
-
//--------------------------------------------------------------------------
-
- /**
- * Constructor.
- *
- * @param type The event type; indicates the action that caused the
event.
- *
- * @param bubbles Specifies whether the event can bubble
- * up the display list hierarchy.
- *
- * @param cancelable Specifies whether the behavior
- * associated with the event can be prevented.
- *
- * @param localX The x coordinate of the mouse relative to the target,
in pixels.
- *
- * @param localY The y coordinate of the mouse relative to the target,
in pixels.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Royale 0.9.3
- */
- COMPILE::SWF
- public function MouseEvent(type:String, bubbles:Boolean = false,
- cancelable:Boolean =
false,
- localX:Number = NaN, localY:Number = NaN,
- relatedObject:Object = null,
- ctrlKey:Boolean = false, altKey:Boolean = false,
shiftKey:Boolean = false,
- buttonDown:Boolean = false, delta:int = 0,
- commandKey:Boolean = false, controlKey:Boolean =
false,
- clickCount:int = 0,
targetBeforeBubbling:IEventDispatcher = null)
- {
- super(type, bubbles, cancelable, localX, localY, relatedObject,
- ctrlKey, altKey, shiftKey, buttonDown, delta, commandKey,
controlKey,
- clickCount, targetBeforeBubbling);
- }
-
- /**
- * Constructor.
- *
- * @param type The event type; indicates the action that caused the event.
- *
- * @param bubbles Specifies whether the event can bubble
- * up the display list hierarchy.
- *
- * @param cancelable Specifies whether the behavior
- * associated with the event can be prevented.
- *
- * @param localX The x coordinate of the mouse relative to the target, in
pixels.
- *
- * @param localY The y coordinate of the mouse relative to the target, in
pixels.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Royale 0.9.3
- */
- COMPILE::JS
- public function MouseEvent(type:String, bubbles:Boolean = false,
- cancelable:Boolean = false,
- localX:Number = NaN, localY:Number = NaN)
- {
- super(type, bubbles, cancelable);
- this.localX = localX;
- this.localY = localY;
- }
-
-
-
-
-}
-
-}
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events
+{
+/* import mx.events.Event;*/
+import org.apache.royale.events.Event;
+import org.apache.royale.events.IEventDispatcher;
+import org.apache.royale.events.IRoyaleEvent;
+import org.apache.royale.events.MouseEvent;
+
+/**
+ * Represents event objects that are dispatched when a Flex component moves.
+ *
+ * @see mx.core.UIComponent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Royale 0.9.3
+ * @royalesuppresspublicvarwarning
+ */
+public class MouseEvent extends org.apache.royale.events.MouseEvent
+{
+ /* include "../core/Version.as"; */
+ public static const MOUSE_DOWN:String =
org.apache.royale.events.MouseEvent.MOUSE_DOWN;
+ public static const MOUSE_MOVE:String =
org.apache.royale.events.MouseEvent.MOUSE_MOVE;
+ public static const MOUSE_UP:String =
org.apache.royale.events.MouseEvent.MOUSE_UP;
+ public static const MOUSE_OUT:String =
org.apache.royale.events.MouseEvent.MOUSE_OUT;
+ public static const MOUSE_OVER:String =
org.apache.royale.events.MouseEvent.MOUSE_OVER;
+ public static const ROLL_OVER:String =
org.apache.royale.events.MouseEvent.ROLL_OVER;
+ public static const ROLL_OUT:String =
org.apache.royale.events.MouseEvent.ROLL_OUT;
+ public static const CLICK:String =
org.apache.royale.events.MouseEvent.CLICK;
+ public static const DOUBLE_CLICK:String =
org.apache.royale.events.MouseEvent.DOUBLE_CLICK;
+ public static const CONTEXT_MENU:String =
org.apache.royale.events.MouseEvent.CONTEXT_MENU;
+ public static const MOUSE_WHEEL:String =
org.apache.royale.events.MouseEvent.MOUSE_WHEEL;
+
+
//--------------------------------------------------------------------------
+ //
+ // Class constants
+ //
+
//--------------------------------------------------------------------------
+
+ COMPILE::SWF
+ {
+ override public function get stageX():Number
+ {
+ return super.stageX;
+ }
+
+ override public function get stageY():Number
+ {
+ return super.stageY;
+ }
+ override public function updateAfterEvent():void
+ {
+ super.updateAfterEvent();
+ }
+ }
+
+ COMPILE::JS
+ {
+ public function get stageX():Number
+ {
+ return screenX;
+ }
+
+ public function get stageY():Number
+ {
+ return screenY;
+ }
+ public function updateAfterEvent():void
+ {
+ }
+ }
+
+
+
+
//--------------------------------------------------------------------------
+ //
+ // Constructor
+ //
+
//--------------------------------------------------------------------------
+
+ /**
+ * Constructor.
+ *
+ * @param type The event type; indicates the action that caused the
event.
+ *
+ * @param bubbles Specifies whether the event can bubble
+ * up the display list hierarchy.
+ *
+ * @param cancelable Specifies whether the behavior
+ * associated with the event can be prevented.
+ *
+ * @param localX The x coordinate of the mouse relative to the target,
in pixels.
+ *
+ * @param localY The y coordinate of the mouse relative to the target,
in pixels.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Royale 0.9.3
+ */
+ COMPILE::SWF
+ public function MouseEvent(type:String, bubbles:Boolean = false,
+ cancelable:Boolean =
false,
+ localX:Number = NaN, localY:Number = NaN,
+ relatedObject:Object = null,
+ ctrlKey:Boolean = false, altKey:Boolean = false,
shiftKey:Boolean = false,
+ buttonDown:Boolean = false, delta:int = 0,
+ commandKey:Boolean = false, controlKey:Boolean =
false,
+ clickCount:int = 0,
targetBeforeBubbling:IEventDispatcher = null)
+ {
+ super(type, bubbles, cancelable, localX, localY, relatedObject,
+ ctrlKey, altKey, shiftKey, buttonDown, delta, commandKey,
controlKey,
+ clickCount, targetBeforeBubbling);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param type The event type; indicates the action that caused the event.
+ *
+ * @param bubbles Specifies whether the event can bubble
+ * up the display list hierarchy.
+ *
+ * @param cancelable Specifies whether the behavior
+ * associated with the event can be prevented.
+ *
+ * @param localX The x coordinate of the mouse relative to the target, in
pixels.
+ *
+ * @param localY The y coordinate of the mouse relative to the target, in
pixels.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Royale 0.9.3
+ */
+ COMPILE::JS
+ public function MouseEvent(type:String, bubbles:Boolean = false,
+ cancelable:Boolean = false,
+ localX:Number = NaN, localY:Number = NaN)
+ {
+ super(type, bubbles, cancelable);
+ this.localX = localX;
+ this.localY = localY;
+ }
+
+
+
+
+}
+
+}
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 a6379e706f..34298aa864 100644
---
a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
+++
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
@@ -47,6 +47,7 @@ import
org.apache.royale.html.beads.controllers.DropMouseController;
import org.apache.royale.core.UIBase;
import org.apache.royale.core.IUIBase;
import org.apache.royale.core.Lookalike;
+import mx.managers.beads.DragManagerImplDropBead;
// im`port org.apache.royale.html.accessories.RestrictTextInputBead;
// use namespace mx_internal;
@@ -384,6 +385,7 @@ public class DragManagerImpl extends EventDispatcher
implements IDragManager, IB
dragController = new DragMouseController();
}
(dragInitiator as IStrand).addBead(dragController);
+ this.dragInitiator = dragInitiator;
dragController.addEventListener("dragMove", dragMoveHandler)
dragController.addEventListener("dragStart", dragStartHandler)
_dragSource = dragSource;
@@ -422,11 +424,11 @@ public class DragManagerImpl extends EventDispatcher
implements IDragManager, IB
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)
+ var dmDropBead:DragManagerImplDropBead =
relatedStrand.getBeadByType(DropMouseController) as DragManagerImplDropBead;
+ if (!dmDropBead)
{
- dropController = new DropMouseController();
- relatedStrand.addBead(dropController);
+ dmDropBead = new
DragManagerImplDropBead(dragInitiator);
+ relatedStrand.addBead(dmDropBead);
}
}
}
diff --git
a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/beads/DragManagerImplDropBead.as
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/beads/DragManagerImplDropBead.as
new file mode 100644
index 0000000000..f2f9dadfb0
--- /dev/null
+++
b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/beads/DragManagerImplDropBead.as
@@ -0,0 +1,398 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.beads
+{
+ // import org.apache.royale.collections.ArrayList;
+ // import org.apache.royale.core.DropType;
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.core.IItemRendererOwnerView;
+ // import org.apache.royale.core.IChild;
+ // import org.apache.royale.core.IDataProviderModel;
+ // import org.apache.royale.core.IItemRenderer;
+ // import org.apache.royale.core.ItemRendererOwnerViewBead;
+ // import org.apache.royale.core.IParent;
+ // import org.apache.royale.core.ILayoutHost;
+ // import org.apache.royale.core.ISelectionModel;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.core.IUIBase;
+ import org.apache.royale.core.UIBase;
+ import org.apache.royale.events.DragEvent;
+ // import org.apache.royale.events.Event;
+ // import org.apache.royale.events.EventDispatcher;
+ // import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.geom.Point;
+ // import org.apache.royale.geom.Rectangle;
+ import org.apache.royale.html.beads.controllers.DropMouseController;
+ import org.apache.royale.utils.PointUtils;
+ // import org.apache.royale.core.IIndexedItemRenderer;
+ import org.apache.royale.utils.sendStrandEvent;
+ // import org.apache.royale.utils.sendEvent;
+ // import org.apache.royale.html.util.getModelByType;
+ // import mx.managers.DragManagerImpl;
+ import mx.events.DragEvent;
+ import mx.core.IUIComponent;
+ import mx.core.DragSource;
+
+
+ /**
+ * Bead to set up DragManagerImpl target events
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.10
+ */
+
+ /**
+ * The SingleSelectionDropTargetBead enables items to be dropped onto
single-selection List
+ * components. This bead can be used with
SingleSelectionDragSourceBead to enable the re-arrangement
+ * of rows within the same list.
+ *
+ * @see org.apache.royale.html.beads.SingleSelectionDropIndicatorBead
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.8
+ */
+ public class DragManagerImplDropBead implements IBead
+ {
+
+ private var _dropController:DropMouseController;
+ private var _itemRendererOwnerView:IItemRendererOwnerView;
+ // private var
_dropIndicatorBead:SingleSelectionDropIndicatorBead;
+ private var _dropIndicator:UIBase;
+ private var lastItemVisited:Object;
+ private var indicatorVisible:Boolean = false;
+ private var _dragInitiator:IUIComponent;
+
+ private var _strand:IStrand;
+
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.8
+ */
+ public function
DragManagerImplDropBead(dragInitiator:IUIComponent)
+ {
+ super();
+ _dragInitiator = dragInitiator;
+ }
+ /**
+ * @private
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ _dropController = new DropMouseController();
+ _strand.addBead(_dropController);
+
+
_dropController.addEventListener(org.apache.royale.events.DragEvent.DRAG_ENTER,
handleDragEnter);
+
_dropController.addEventListener(org.apache.royale.events.DragEvent.DRAG_EXIT,
handleDragExit);
+
_dropController.addEventListener(org.apache.royale.events.DragEvent.DRAG_OVER,
handleDragOver);
+
_dropController.addEventListener(org.apache.royale.events.DragEvent.DRAG_DROP,
handleDragDrop);
+ }
+
+ private var _dropDirection: String = "horizontal";
+
+ /**
+ * The direction the drop indicator should display.
"horizontal" (default) or "vertical".
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9
+ */
+ public function get dropDirection():String
+ {
+ return _dropDirection;
+ }
+ public function set dropDirection(value:String):void
+ {
+ _dropDirection = value;
+ }
+
+ protected var _indicatorParent:UIBase;
+
+ /**
+ * @private
+ * @royaleignorecoercion
org.apache.royale.html.beads.IDrawingLayerBead
+ */
+ // protected function get indicatorParent():UIBase
+ // {
+ // if (_indicatorParent == null) {
+ // var layerBead:IDrawingLayerBead =
_strand.getBeadByType(IDrawingLayerBead) as IDrawingLayerBead;
+ // if (layerBead != null) {
+ // _indicatorParent = layerBead.layer;
+ // }
+ // }
+ // return _indicatorParent;
+ // }
+ /**
+ * @private
+ * @royaleignorecoercion
org.apache.royale.core.IItemRendererOwnerView
+ */
+ // private function get
itemRendererOwnerView():IItemRendererOwnerView
+ // {
+ // if (!_itemRendererOwnerView)
+ // _itemRendererOwnerView =
_strand.getBeadByType(IItemRendererOwnerView) as IItemRendererOwnerView;
+ // return _itemRendererOwnerView;
+ // }
+
+ /**
+ * @private
+ * @royaleignorecoercion
org.apache.royale.html.beads.SingleSelectionDropIndicatorBead
+ */
+ // protected function getDropIndicator(ir:Object, width:Number,
height:Number):UIBase
+ // {
+ // if (_dropIndicatorBead == null) {
+ // _dropIndicatorBead =
_strand.getBeadByType(SingleSelectionDropIndicatorBead) as
SingleSelectionDropIndicatorBead;
+ // if (_dropIndicatorBead == null) return null;
+ // }
+ // _dropIndicator =
_dropIndicatorBead.getDropIndicator(ir, width, height);
+ // return _dropIndicator;
+ // }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.core.IUIBase
+ * @royaleignorecoercion org.apache.royale.core.IItemRenderer
+ */
+ private function
handleDragEnter(event:org.apache.royale.events.DragEvent):void
+ {
+ // //trace("SingleSelectionDropTargetBead received
DragEnter via: "+event.relatedObject.toString());
+ // var newEvent:Event = new Event("enter", false, true);
+ // dispatchEvent(newEvent);
+ // if (newEvent.defaultPrevented) return;
+
+ // var pt0:Point;
+ // var pt1:Point;
+ // var pt2:Point;
+
+ // _dropController.acceptDragDrop(event.relatedObject
as IUIBase, DropType.COPY);
+
+ // var startHere:Object = event.relatedObject;
+ // while( !(startHere is IItemRenderer) && startHere !=
null) {
+ // startHere = startHere.parent;
+ // }
+
+ // if (startHere is IItemRenderer) {
+ // var ir:IItemRenderer = startHere as
IItemRenderer;
+ // lastItemVisited = ir;
+ // } else if (itemRendererOwnerView &&
itemRendererOwnerView.numItemRenderers > 0)
+ // {
+ // // as long as we're assuming the last item is
dropped into in case there's no item renderer under mouse
+ // // this is needed
+ // lastItemVisited =
itemRendererOwnerView.getItemRendererAt(itemRendererOwnerView.numItemRenderers
- 1);
+ // }
+
+ // if (lastItemVisited && !indicatorVisible &&
indicatorParent) {
+ // var di:UIBase =
getDropIndicator(lastItemVisited, (dropDirection == "horizontal") ?
indicatorParent.width : 4,
+ //
(dropDirection == "horizontal") ? 4 : indicatorParent.height);
+ // indicatorVisible = true;
+ // displayDropIndicator(lastItemVisited as
IUIBase);
+
+ // if (indicatorParent != null) {
+ // indicatorParent.addElement(di);
+ // }
+ // }
+ sendDragEvent(mx.events.DragEvent.DRAG_ENTER);
+ }
+
+ /**
+ * @private
+ */
+ private function
handleDragExit(event:org.apache.royale.events.DragEvent):void
+ {
+ // //trace("SingleSelectionDropTargetBead received
DragExit via: "+event.relatedObject.toString());
+ // var dragEvent:DragEvent = new DragEvent()
+ // sendStrandEvent(_strand, new Dra
+
+ // if (indicatorVisible) {
+ // if (indicatorParent != null) {
+ //
indicatorParent.removeElement(_dropIndicator);
+ // }
+ // indicatorVisible = false;
+ // }
+ sendDragEvent(mx.events.DragEvent.DRAG_EXIT);
+ }
+
+ /**
+ * @private
+ * @royaleignorecoercion org.apache.royale.core.IUIBase
+ */
+ private function
handleDragOver(event:org.apache.royale.events.DragEvent):void
+ {
+ //trace("SingleSelectionDropTargetBead received
DragOver via: "+event.relatedObject.toString());
+ // var newEvent:Event = new Event("over", false, true);
+ // dispatchEvent(newEvent);
+ // if (event.defaultPrevented) {
+ // return;
+ // }
+
+ // var startHere:Object = event.relatedObject;
+ // while( !(startHere is IItemRenderer) && startHere !=
null) {
+ // startHere = startHere.parent;
+ // }
+
+ // if ((startHere is IItemRenderer) && _dropIndicator
!= null && indicatorParent) {
+ // displayDropIndicator(startHere as IUIBase);
+ // lastItemVisited = startHere;
+
+ // }
+ // else if (lastItemVisited && _dropIndicator != null
&& indicatorParent) {
+ // displayDropIndicator(lastItemVisited as
IUIBase);
+ // }
+ sendDragEvent(mx.events.DragEvent.DRAG_OVER);
+ }
+
+ /**
+ * @private
+ */
+ private function
handleDragDrop(event:org.apache.royale.events.DragEvent):void
+ {
+ // //trace("SingleSelectionDropTargetBead received
DragDrop via: "+event.relatedObject.toString());
+
+ // handleDragExit(event);
+
+ // var newEvent:Event = new Event("drop", false, true);
+ // dispatchEvent(newEvent);
+ // if (newEvent.defaultPrevented) {
+ // return;
+ // }
+
+ // var targetIndex:int = -1; // indicates drop beyond
length of items
+ // // var contentViewAsParent:IParent;
+
+ // var startHere:Object = event.relatedObject;
+ // while( !(startHere is IIndexedItemRenderer) &&
startHere != null) {
+ // startHere = startHere.parent;
+ // }
+
+ // if (startHere) {
+ // var ir:IIndexedItemRenderer = startHere as
IIndexedItemRenderer;
+ // targetIndex = ir.index;
+ // }
+
+ // var downPoint:Point = new Point(event.clientX,
event.clientY);
+ // //trace("Dropping at this point: "+downPoint.x+",
"+downPoint.y);
+ // //trace("-- find the itemRenderer this object is
over");
+
+ // // Let the dragInitiator know that the drop was
accepted so it can do
+ // // whatever it needs to do to prepare the data or
structures.
+ // if (DragEvent.dragInitiator) {
+ // DragEvent.dragInitiator.acceptingDrop(_strand,
"object");
+ // }
+
+ // var dragSource:Object =
org.apache.royale.events.DragEvent.dragSource;
+ // var sourceIndex:int = 0;
+
+ // var dataProviderModel:IDataProviderModel =
getModelByType(_strand,IDataProviderModel) as IDataProviderModel;
+ // if (dataProviderModel.dataProvider is Array) {
+ // var dataArray:Array =
dataProviderModel.dataProvider as Array;
+
+ // // insert the item being dropped
+ // if (targetIndex == -1) {
+ // // append to the end
+ // dataArray.push(dragSource);
+ // } else {
+ // // insert before targetIndex
+ // dataArray.splice(targetIndex, 0,
dragSource);
+ // }
+
+ // var newArray:Array = dataArray.slice()
+ // dataProviderModel.dataProvider = newArray;
+ // }
+ // else if (dataProviderModel.dataProvider is
ArrayList) {
+ // var dataList:ArrayList =
dataProviderModel.dataProvider as ArrayList;
+
+ // // insert the item being dropped
+ // if (targetIndex == -1) {
+ // // sppend to the end
+ // dataList.addItem(dragSource);
+ // } else {
+ // // insert before target index
+ // dataList.addItemAt(dragSource,
targetIndex);
+ // }
+ // }
+
+ // // Let the dragInitiator know the drop has been
completed.
+ // if
(org.apache.royale.events.DragEvent.dragInitiator) {
+ //
org.apache.royale.events.DragEvent.dragInitiator.acceptedDrop(_strand,
"object");
+ // }
+
+ // if (dataProviderModel is ISelectionModel) {
+ // (dataProviderModel as
ISelectionModel).selectedIndex = targetIndex;
+ // }
+
+ // // is this event necessary? isn't "complete" enough?
+ // sendStrandEvent(_strand,"dragDropAccepted");
+ // sendEvent(this,"complete");
+ sendDragEvent(mx.events.DragEvent.DRAG_DROP);
+ }
+
+ private function sendDragEvent(type:String):void
+ {
+ var dragEvent:mx.events.DragEvent = new
mx.events.DragEvent(type, false, true, _dragInitiator,
org.apache.royale.events.DragEvent.dragSource as DragSource);
+ sendStrandEvent(_strand, dragEvent);
+ }
+
+
+ // COMPILE::SWF
+ // private function displayDropIndicator(item:IUIBase):void
+ // {
+ // var pt0:Point;
+ // var pt1:Point;
+ // var pt2:Point;
+
+ // if (dropDirection == "horizontal") {
+ // pt0 = new Point(0, item.y+item.height);
+ // pt1 = PointUtils.localToGlobal(pt0,
item.parent);
+ // pt2 = PointUtils.globalToLocal(pt1,
indicatorParent);
+ // _dropIndicator.x = 0;
+ // _dropIndicator.y = pt2.y - 1;
+ // }
+ // else {
+ // pt0 = new Point(item.x, 0);
+ // pt1 = PointUtils.localToGlobal(pt0,
item.parent);
+ // pt2 = PointUtils.globalToLocal(pt1,
indicatorParent);
+ // _dropIndicator.x = pt2.x - 1;
+ // _dropIndicator.y = 0;
+ // }
+ // }
+
+ // COMPILE::JS
+ // private function displayDropIndicator(item:IUIBase):void
+ // {
+ // var pt:Point = PointUtils.localToGlobal(new Point(0,0),
item);
+ // pt = PointUtils.globalToLocal(pt,indicatorParent);
+ // if (dropDirection == "horizontal") {
+ // _dropIndicator.x = 0;
+ // _dropIndicator.y = pt.y;
+ // } else {
+ // _dropIndicator.x = pt.x;
+ // _dropIndicator.y = 0;
+ // }
+ // }
+ }
+}