new folders for DragDrop
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/faf91d78 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/faf91d78 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/faf91d78 Branch: refs/heads/mavenfolders Commit: faf91d78a7f58239fb794dece928c4bd715f0f9c Parents: 038a40e Author: Alex Harui <[email protected]> Authored: Tue Feb 2 16:45:13 2016 -0800 Committer: Alex Harui <[email protected]> Committed: Tue Feb 2 16:45:13 2016 -0800 ---------------------------------------------------------------------- .../projects/DragDrop/as/src/DragDropClasses.as | 35 -- .../as/src/org/apache/flex/core/DropType.as | 64 ---- .../as/src/org/apache/flex/events/DragEvent.as | 373 ------------------- .../src/org/apache/flex/events/DragEventBase.as | 51 --- .../beads/controllers/DragMouseController.as | 261 ------------- .../beads/controllers/DropMouseController.as | 185 --------- frameworks/projects/DragDrop/basic-manifest.xml | 27 -- .../projects/DragDrop/compile-asjs-config.xml | 79 ---- frameworks/projects/DragDrop/compile-config.xml | 78 ---- .../DragDrop/src/main/flex/DragDropClasses.as | 35 ++ .../main/flex/org/apache/flex/core/DropType.as | 64 ++++ .../flex/org/apache/flex/events/DragEvent.as | 373 +++++++++++++++++++ .../org/apache/flex/events/DragEventBase.as | 51 +++ .../beads/controllers/DragMouseController.as | 261 +++++++++++++ .../beads/controllers/DropMouseController.as | 185 +++++++++ .../src/main/resources/basic-manifest.xml | 27 ++ .../src/main/resources/compile-asjs-config.xml | 79 ++++ .../src/main/resources/compile-config.xml | 78 ++++ 18 files changed, 1153 insertions(+), 1153 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/as/src/DragDropClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/as/src/DragDropClasses.as b/frameworks/projects/DragDrop/as/src/DragDropClasses.as deleted file mode 100644 index 14d0b54..0000000 --- a/frameworks/projects/DragDrop/as/src/DragDropClasses.as +++ /dev/null @@ -1,35 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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 -{ - -/** - * @private - * This class is used to link additional classes into rpc.swc - * beyond those that are found by dependecy analysis starting - * from the classes specified in manifest.xml. - */ -internal class DragDropClasses -{ - import org.apache.flex.core.DropType; DropType; - import org.apache.flex.events.DragEvent; DragEvent; -} - -} - http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/as/src/org/apache/flex/core/DropType.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/as/src/org/apache/flex/core/DropType.as b/frameworks/projects/DragDrop/as/src/org/apache/flex/core/DropType.as deleted file mode 100644 index 9df59cf..0000000 --- a/frameworks/projects/DragDrop/as/src/org/apache/flex/core/DropType.as +++ /dev/null @@ -1,64 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.core -{ - /** - * The DropType class provides a set of constant values of - * types of drops in a drag/drop operation - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DropType - { - - /** - * The data should be moved. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static const MOVE:String = "move"; - - /** - * The data should be copied. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static const COPY:String = "copy"; - - /** - * The drop should be cancelled. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static const CANCEL:String = "cancel"; - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as b/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as deleted file mode 100644 index 7d9fefb..0000000 --- a/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as +++ /dev/null @@ -1,373 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.events -{ - import org.apache.flex.core.IDragInitiator; - COMPILE::JS - { - import org.apache.flex.core.IUIBase; - import window.Event; - import window.MouseEvent; - } - - /** - * Drag and Drop Events. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DragEvent extends DragEventBase - { - /** - * The <code>DragEvent.DRAG_START</code> constant defines the value of the - * event object's <code>type</code> property 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>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>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"; - - /** - * The <code>DragEvent.DRAG_MOVE</code> constant defines the value of the - * event object's <code>type</code> property for a <code>dragMove</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>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>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 dragMove - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const DRAG_MOVE:String = "dragMove"; - - /** - * The <code>DragEvent.DRAG_END</code> constant defines the value of the - * event object's <code>type</code> property for a <code>dragEnd</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>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>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 dragEnd - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const DRAG_END:String = "dragEnd"; - - /** - * The <code>DragEvent.DRAG_ENTER</code> constant defines the value of the - * event object's <code>type</code> property 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>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>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_OVER</code> constant defines the value of the - * event object's <code>type</code> property 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>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>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 <code>DragEvent.DRAG_EXIT</code> constant defines the value of the - * event object's <code>type</code> property 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>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>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_DROP</code> constant defines the value of the - * event object's <code>type</code> property 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>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>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 object that wants to know if a drop is accepted - * - * @param type The name of the event. - * @param bubbles Whether the event bubbles. - * @param cancelable Whether the event can be canceled. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static var dragInitiator:IDragInitiator; - - /** - * The data being dragged. Or an instance - * of an object describing the data. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static var dragSource:Object; - - - /** - * Constructor. Do not call 'new DragEvent', use the - * createDragEvent method instead. - * - * @param type The name of the event. - * @param bubbles Whether the event bubbles. - * @param cancelable Whether the event can be canceled. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DragEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) - { - COMPILE::AS3 - { - super(type, bubbles, cancelable); - } - COMPILE::JS - { - this.type = type; - } - } - - /** - * Factory for DragEvents. - * - * @param type The name of the event. - * @param event The MouseEvent properties to copy into the DragEvent. - * @return The new DragEvent. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.events.DragEvent - * @flexjsignorecoercion window.Event - * @flexjsignorecoercion Event - */ - public static function createDragEvent(type:String, event:MouseEvent):DragEvent - { - COMPILE::AS3 - { - var de:DragEvent = new DragEvent(type, true, true); - de.localX = event.localX; - de.localY = event.localY; - de.altKey = event.altKey; - de.ctrlKey = event.ctrlKey; - de.shiftKey = event.shiftKey; - de.buttonDown = event.buttonDown; - de.delta = event.delta; - de.relatedObject = event.relatedObject; - return de; - } - COMPILE::JS - { - var out:window.MouseEvent = new window.MouseEvent(type); - var e:window.Event = event as window.Event; - (out as window.Event).initMouseEvent(type, true, true, - e.view, e.detail, e.screenX, e.screenY, - e.clientX, e.clientY, e.ctrlKey, e.altKey, - e.shiftKey, e.metaKey, e.button, e.relatedTarget); - return out as DragEvent; - } - } - - - /** - * Dispatch a DragEvent - * - * @param event The DragEvent to dispatch. - * @param target The target to dispatch the event from. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.IUIBase - * @flexjsignorecoercion window.Event - */ - public static function dispatchDragEvent(event:DragEvent, target:IEventDispatcher):void - { - COMPILE::AS3 - { - target.dispatchEvent(event); - } - COMPILE::JS - { - (target as IUIBase).element.dispatchEvent(event as window.Event); - } - } - - /** - */ - COMPILE::JS - private static function installDragEventMixin():Boolean - { - var o:Object = org.apache.flex.events.ElementEvents.elementEvents; - o['dragEnd'] = 1; - o['dragMove'] = 1; - return true; - } - - - /** - * Add some other events to listen from the element - */ - COMPILE::JS - private static var dragEventMixin:Boolean = installDragEventMixin(); - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEventBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEventBase.as b/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEventBase.as deleted file mode 100644 index aaa8ddf..0000000 --- a/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEventBase.as +++ /dev/null @@ -1,51 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.events -{ - COMPILE::AS3 - { - import org.apache.flex.events.MouseEvent; - } - COMPILE::JS - { - import goog.events.BrowserEvent; - } - - /** - * Drag and Drop Events. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - COMPILE::AS3 - public class DragEventBase extends MouseEvent - { - public function DragEventBase(type:String, bubbles:Boolean=false, cancelable:Boolean=false) - { - super(type, bubbles, cancelable); - } - } - - COMPILE::JS - public class DragEventBase extends goog.events.BrowserEvent - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DragMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DragMouseController.as b/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DragMouseController.as deleted file mode 100644 index 01351b8..0000000 --- a/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DragMouseController.as +++ /dev/null @@ -1,261 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - - import org.apache.flex.core.IBead; - import org.apache.flex.core.IDragInitiator; - import org.apache.flex.core.IPopUpHost; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IUIBase; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.DragEvent; - import org.apache.flex.events.EventDispatcher; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.events.MouseEvent; - import org.apache.flex.geom.Point; - import org.apache.flex.utils.PointUtils; - import org.apache.flex.utils.UIUtils; - - /** - * Indicates that a drag/drop operation is starting. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="dragStart", type="org.apache.flex.events.DragEvent")] - - /** - * Indicates that the mouse is moving during - * a drag/drop operation. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="dragMove", type="org.apache.flex.events.DragEvent")] - - /** - * Indicates that a drag/drop operation is ending. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="dragEnd", type="org.apache.flex.events.DragEvent")] - - /** - * The DragMouseController bead handles mouse events on the - * a component, looking for activity that constitutes the start - * of a drag drop operation. - * - * @flexjsignoreimport org.apache.flex.core.IDragInitiator - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DragMouseController extends EventDispatcher implements IBead - { - /** - * Whether there is a drag operation - * in progress. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static var dragging:Boolean = false; - - /** - * The drag image. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static var dragImage:IUIBase; - - /** - * The offset of the drag image. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static var dragImageOffsetX:Number = 0; - - /** - * The offset of the drag image. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static var dragImageOffsetY:Number = 0; - - /** - * The default movement in x and or y that - * means a drag should start - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public static var defaultThreshold:int = 4; - - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DragMouseController() - { - threshold = defaultThreshold; - } - - /** - * The movement in x and or y that - * means a drag should start - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public var threshold:int = 4; - - private var _strand:IStrand; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function set strand(value:IStrand):void - { - _strand = value; - - IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_DOWN, dragMouseDownHandler); - } - - public function get strand():IStrand - { - return _strand; - } - - private var mouseDownX:Number; - private var mouseDownY:Number; - - private var host:IPopUpHost; - - /** - * @private - */ - private function dragMouseDownHandler(event:MouseEvent):void - { - trace("dragMouseDown"); - IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, dragMouseMoveHandler); - IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, dragMouseUpHandler); - mouseDownX = event.screenX; - mouseDownY = event.screenY; - event.preventDefault(); - } - - private function dragMouseMoveHandler(event:MouseEvent):void - { - var pt:Point; - var dragEvent:DragEvent; - trace("dragMouseMove"); - - event.preventDefault(); - - if (!dragging) - { - trace("not dragging anything else"); - if (Math.abs(event.screenX - mouseDownX) > threshold || - Math.abs(event.screenY - mouseDownY) > threshold) - { - trace("sending dragStart"); - dragEvent = DragEvent.createDragEvent("dragStart", event); - DragEvent.dispatchDragEvent(dragEvent, IEventDispatcher(_strand)); - if (DragEvent.dragSource != null) - { - dragging = true; - host = UIUtils.findPopUpHost(_strand as IUIBase); - host.addElement(dragImage); - pt = PointUtils.globalToLocal(new Point(event.clientX, event.clientY), host); - dragImage.x = pt.x + dragImageOffsetX; - dragImage.y = pt.y + dragImageOffsetY; - } - } - } - else - { - trace("sending dragMove " + event.target.toString()); - dragEvent = DragEvent.createDragEvent("dragMove", event); - trace("client: " + event.clientX.toString() + " " + event.clientY.toString() + " " + event.target.toString()); - pt = PointUtils.globalToLocal(new Point(event.clientX, event.clientY), host); - trace("host: " + pt.x.toString() + " " + pt.y.toString()); - dragImage.x = pt.x + dragImageOffsetX; - dragImage.y = pt.y + dragImageOffsetY; - DragEvent.dispatchDragEvent(dragEvent, IEventDispatcher(event.target)); - } - } - - private function dragMouseUpHandler(event:MouseEvent):void - { - trace("dragMouseUp"); - var dragEvent:DragEvent; - - if (dragging) - { - trace("sending dragEnd"); - dragEvent = DragEvent.createDragEvent("dragEnd", event); - DragEvent.dispatchDragEvent(dragEvent, IEventDispatcher(event.target)); - event.preventDefault(); - } - dragging = false; - DragEvent.dragSource = null; - DragEvent.dragInitiator = null; - if (dragImage && host) - host.removeElement(dragImage); - dragImage = null; - IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, dragMouseMoveHandler); - IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, dragMouseUpHandler); - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DropMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DropMouseController.as b/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DropMouseController.as deleted file mode 100644 index 3165241..0000000 --- a/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DropMouseController.as +++ /dev/null @@ -1,185 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.html.beads.controllers -{ - import org.apache.flex.core.IBead; - import org.apache.flex.core.IDragInitiator; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IUIBase; - import org.apache.flex.core.UIBase; - import org.apache.flex.events.DragEvent; - import org.apache.flex.events.EventDispatcher; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.events.MouseEvent; - - /** - * Indicates that the mouse has entered the component during - * a drag operatino. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="dragEnter", type="org.apache.flex.events.DragEvent")] - - /** - * Indicates that the mouse is moving over a component during - * a drag/drop operation. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="dragOver", type="org.apache.flex.events.DragEvent")] - - /** - * Indicates that the mouse is moving out of a component during - * a drag/drop operation. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="dragExit", type="org.apache.flex.events.DragEvent")] - - /** - * Indicates that a drop operation should be executed. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="dragDrop", type="org.apache.flex.events.DragEvent")] - - /** - * The DropMouseController bead handles mouse events on the - * a component, looking for events from a drag/drop operation. - * - * @flexjsignoreimport org.apache.flex.core.IDragInitiator - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class DropMouseController extends EventDispatcher implements IBead - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function DropMouseController() - { - } - - private var _strand:IStrand; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function set strand(value:IStrand):void - { - _strand = value; - - IEventDispatcher(_strand).addEventListener(DragEvent.DRAG_MOVE, dragMoveHandler); - } - - public function get strand():IStrand - { - return _strand; - } - - private var inside:Boolean; - - private var dragSource:Object; - private var dragInitiator:IDragInitiator; - - public function acceptDragDrop(target:IUIBase, type:String):void - { - // TODO: aharui: switch icons - } - - /** - * @private - * @flexjsignorecoercion org.apache.flex.events.MouseEvent - */ - private function dragMoveHandler(event:DragEvent):void - { - trace("dragMove"); - var dragEvent:DragEvent; - if (!inside) - { - dragEvent = DragEvent.createDragEvent("dragEnter", event as MouseEvent); - dispatchEvent(dragEvent); - inside = true; - IUIBase(_strand).topMostEventDispatcher.addEventListener(DragEvent.DRAG_END, dragEndHandler); - IUIBase(_strand).addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); - } - else - { - dragEvent = DragEvent.createDragEvent("dragOver", event as MouseEvent); - dispatchEvent(dragEvent); - } - } - - private function rollOutHandler(event:MouseEvent):void - { - var dragEvent:DragEvent; - - if (inside) - { - dragEvent = DragEvent.createDragEvent("dragExit", event); - dispatchEvent(dragEvent); - inside = false; - } - IUIBase(_strand).topMostEventDispatcher.removeEventListener(DragEvent.DRAG_END, dragEndHandler); - IUIBase(_strand).removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler); - } - - /** - * @flexjsignorecoercion org.apache.flex.events.MouseEvent - */ - private function dragEndHandler(event:DragEvent):void - { - trace("dragEnd"); - var dragEvent:DragEvent; - - dragEvent = DragEvent.createDragEvent("dragDrop", event as MouseEvent); - dispatchEvent(dragEvent); - - inside = false; - IUIBase(_strand).topMostEventDispatcher.removeEventListener(DragEvent.DRAG_END, dragEndHandler); - IUIBase(_strand).removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler); - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/basic-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/basic-manifest.xml b/frameworks/projects/DragDrop/basic-manifest.xml deleted file mode 100644 index bf5911f..0000000 --- a/frameworks/projects/DragDrop/basic-manifest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0"?> -<!-- - - 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. - ---> - - -<componentPackage> - - <component id="DragMouseController" class="org.apache.flex.html.beads.controllers.DragMouseController" /> - <component id="DropMouseController" class="org.apache.flex.html.beads.controllers.DropMouseController" /> - -</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/compile-asjs-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/compile-asjs-config.xml b/frameworks/projects/DragDrop/compile-asjs-config.xml deleted file mode 100644 index 1ad65d7..0000000 --- a/frameworks/projects/DragDrop/compile-asjs-config.xml +++ /dev/null @@ -1,79 +0,0 @@ -<!-- - - 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. - ---> -<flex-config> - - <compiler> - <accessible>false</accessible> - - <external-library-path> - </external-library-path> - - <mxml> - <children-as-data>true</children-as-data> - </mxml> - <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> - <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> - <binding-value-change-event-type>valueChange</binding-value-change-event-type> - - <keep-as3-metadata> - <name>Bindable</name> - <name>Managed</name> - <name>ChangeEvent</name> - <name>NonCommittingChangeEvent</name> - <name>Transient</name> - </keep-as3-metadata> - - <locale/> - - <library-path> - <!-- asjscompc won't 'link' these classes in, but will list their requires - if these swcs are on the external-library-path then their requires - will not be listed --> - <path-element>../../externs/Core.swc</path-element> - </library-path> - - <namespaces> - <namespace> - <uri>library://ns.apache.org/flexjs/basic</uri> - <manifest>basic-manifest.xml</manifest> - </namespace> - </namespaces> - - <source-path> - <path-element>as/src</path-element> - </source-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <include-file> - </include-file> - - <include-classes> - <class>DragDropClasses</class> - </include-classes> - - <include-namespaces> - <uri>library://ns.apache.org/flexjs/basic</uri> - </include-namespaces> - - <target-player>${playerglobal.version}</target-player> - - -</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/compile-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/compile-config.xml b/frameworks/projects/DragDrop/compile-config.xml deleted file mode 100644 index f8d1526..0000000 --- a/frameworks/projects/DragDrop/compile-config.xml +++ /dev/null @@ -1,78 +0,0 @@ -<!-- - - 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. - ---> -<flex-config> - - <compiler> - <accessible>false</accessible> - - <external-library-path> - <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> - <path-element>../../libs/Core.swc</path-element> - </external-library-path> - - <mxml> - <children-as-data>true</children-as-data> - </mxml> - <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> - <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> - <binding-value-change-event-type>valueChange</binding-value-change-event-type> - - <keep-as3-metadata> - <name>Bindable</name> - <name>Managed</name> - <name>ChangeEvent</name> - <name>NonCommittingChangeEvent</name> - <name>Transient</name> - </keep-as3-metadata> - - <locale/> - - <library-path/> - - <namespaces> - <namespace> - <uri>library://ns.apache.org/flexjs/basic</uri> - <manifest>basic-manifest.xml</manifest> - </namespace> - </namespaces> - - <source-path> - <path-element>as/src</path-element> - </source-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <include-file> - <name>js/out/*</name> - <path>js/out/*</path> - </include-file> - - <include-classes> - <class>DragDropClasses</class> - </include-classes> - - <include-namespaces> - <uri>library://ns.apache.org/flexjs/basic</uri> - </include-namespaces> - - <target-player>${playerglobal.version}</target-player> - - -</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as b/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as new file mode 100644 index 0000000..14d0b54 --- /dev/null +++ b/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + +/** + * @private + * This class is used to link additional classes into rpc.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ +internal class DragDropClasses +{ + import org.apache.flex.core.DropType; DropType; + import org.apache.flex.events.DragEvent; DragEvent; +} + +} + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/core/DropType.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/core/DropType.as b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/core/DropType.as new file mode 100644 index 0000000..9df59cf --- /dev/null +++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/core/DropType.as @@ -0,0 +1,64 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.core +{ + /** + * The DropType class provides a set of constant values of + * types of drops in a drag/drop operation + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class DropType + { + + /** + * The data should be moved. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static const MOVE:String = "move"; + + /** + * The data should be copied. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static const COPY:String = "copy"; + + /** + * The drop should be cancelled. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static const CANCEL:String = "cancel"; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as new file mode 100644 index 0000000..7d9fefb --- /dev/null +++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as @@ -0,0 +1,373 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events +{ + import org.apache.flex.core.IDragInitiator; + COMPILE::JS + { + import org.apache.flex.core.IUIBase; + import window.Event; + import window.MouseEvent; + } + + /** + * Drag and Drop Events. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class DragEvent extends DragEventBase + { + /** + * The <code>DragEvent.DRAG_START</code> constant defines the value of the + * event object's <code>type</code> property 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>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>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"; + + /** + * The <code>DragEvent.DRAG_MOVE</code> constant defines the value of the + * event object's <code>type</code> property for a <code>dragMove</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>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>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 dragMove + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DRAG_MOVE:String = "dragMove"; + + /** + * The <code>DragEvent.DRAG_END</code> constant defines the value of the + * event object's <code>type</code> property for a <code>dragEnd</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>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>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 dragEnd + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public static const DRAG_END:String = "dragEnd"; + + /** + * The <code>DragEvent.DRAG_ENTER</code> constant defines the value of the + * event object's <code>type</code> property 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>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>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_OVER</code> constant defines the value of the + * event object's <code>type</code> property 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>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>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 <code>DragEvent.DRAG_EXIT</code> constant defines the value of the + * event object's <code>type</code> property 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>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>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_DROP</code> constant defines the value of the + * event object's <code>type</code> property 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>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>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 object that wants to know if a drop is accepted + * + * @param type The name of the event. + * @param bubbles Whether the event bubbles. + * @param cancelable Whether the event can be canceled. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static var dragInitiator:IDragInitiator; + + /** + * The data being dragged. Or an instance + * of an object describing the data. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static var dragSource:Object; + + + /** + * Constructor. Do not call 'new DragEvent', use the + * createDragEvent method instead. + * + * @param type The name of the event. + * @param bubbles Whether the event bubbles. + * @param cancelable Whether the event can be canceled. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function DragEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + COMPILE::AS3 + { + super(type, bubbles, cancelable); + } + COMPILE::JS + { + this.type = type; + } + } + + /** + * Factory for DragEvents. + * + * @param type The name of the event. + * @param event The MouseEvent properties to copy into the DragEvent. + * @return The new DragEvent. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.events.DragEvent + * @flexjsignorecoercion window.Event + * @flexjsignorecoercion Event + */ + public static function createDragEvent(type:String, event:MouseEvent):DragEvent + { + COMPILE::AS3 + { + var de:DragEvent = new DragEvent(type, true, true); + de.localX = event.localX; + de.localY = event.localY; + de.altKey = event.altKey; + de.ctrlKey = event.ctrlKey; + de.shiftKey = event.shiftKey; + de.buttonDown = event.buttonDown; + de.delta = event.delta; + de.relatedObject = event.relatedObject; + return de; + } + COMPILE::JS + { + var out:window.MouseEvent = new window.MouseEvent(type); + var e:window.Event = event as window.Event; + (out as window.Event).initMouseEvent(type, true, true, + e.view, e.detail, e.screenX, e.screenY, + e.clientX, e.clientY, e.ctrlKey, e.altKey, + e.shiftKey, e.metaKey, e.button, e.relatedTarget); + return out as DragEvent; + } + } + + + /** + * Dispatch a DragEvent + * + * @param event The DragEvent to dispatch. + * @param target The target to dispatch the event from. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IUIBase + * @flexjsignorecoercion window.Event + */ + public static function dispatchDragEvent(event:DragEvent, target:IEventDispatcher):void + { + COMPILE::AS3 + { + target.dispatchEvent(event); + } + COMPILE::JS + { + (target as IUIBase).element.dispatchEvent(event as window.Event); + } + } + + /** + */ + COMPILE::JS + private static function installDragEventMixin():Boolean + { + var o:Object = org.apache.flex.events.ElementEvents.elementEvents; + o['dragEnd'] = 1; + o['dragMove'] = 1; + return true; + } + + + /** + * Add some other events to listen from the element + */ + COMPILE::JS + private static var dragEventMixin:Boolean = installDragEventMixin(); + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as new file mode 100644 index 0000000..aaa8ddf --- /dev/null +++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.events +{ + COMPILE::AS3 + { + import org.apache.flex.events.MouseEvent; + } + COMPILE::JS + { + import goog.events.BrowserEvent; + } + + /** + * Drag and Drop Events. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::AS3 + public class DragEventBase extends MouseEvent + { + public function DragEventBase(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + } + + COMPILE::JS + public class DragEventBase extends goog.events.BrowserEvent + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/faf91d78/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as new file mode 100644 index 0000000..01351b8 --- /dev/null +++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as @@ -0,0 +1,261 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.flex.html.beads.controllers +{ + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IDragInitiator; + import org.apache.flex.core.IPopUpHost; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IUIBase; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.DragEvent; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.events.MouseEvent; + import org.apache.flex.geom.Point; + import org.apache.flex.utils.PointUtils; + import org.apache.flex.utils.UIUtils; + + /** + * Indicates that a drag/drop operation is starting. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="dragStart", type="org.apache.flex.events.DragEvent")] + + /** + * Indicates that the mouse is moving during + * a drag/drop operation. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="dragMove", type="org.apache.flex.events.DragEvent")] + + /** + * Indicates that a drag/drop operation is ending. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="dragEnd", type="org.apache.flex.events.DragEvent")] + + /** + * The DragMouseController bead handles mouse events on the + * a component, looking for activity that constitutes the start + * of a drag drop operation. + * + * @flexjsignoreimport org.apache.flex.core.IDragInitiator + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class DragMouseController extends EventDispatcher implements IBead + { + /** + * Whether there is a drag operation + * in progress. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static var dragging:Boolean = false; + + /** + * The drag image. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static var dragImage:IUIBase; + + /** + * The offset of the drag image. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static var dragImageOffsetX:Number = 0; + + /** + * The offset of the drag image. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static var dragImageOffsetY:Number = 0; + + /** + * The default movement in x and or y that + * means a drag should start + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public static var defaultThreshold:int = 4; + + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function DragMouseController() + { + threshold = defaultThreshold; + } + + /** + * The movement in x and or y that + * means a drag should start + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var threshold:int = 4; + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set strand(value:IStrand):void + { + _strand = value; + + IEventDispatcher(_strand).addEventListener(MouseEvent.MOUSE_DOWN, dragMouseDownHandler); + } + + public function get strand():IStrand + { + return _strand; + } + + private var mouseDownX:Number; + private var mouseDownY:Number; + + private var host:IPopUpHost; + + /** + * @private + */ + private function dragMouseDownHandler(event:MouseEvent):void + { + trace("dragMouseDown"); + IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, dragMouseMoveHandler); + IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, dragMouseUpHandler); + mouseDownX = event.screenX; + mouseDownY = event.screenY; + event.preventDefault(); + } + + private function dragMouseMoveHandler(event:MouseEvent):void + { + var pt:Point; + var dragEvent:DragEvent; + trace("dragMouseMove"); + + event.preventDefault(); + + if (!dragging) + { + trace("not dragging anything else"); + if (Math.abs(event.screenX - mouseDownX) > threshold || + Math.abs(event.screenY - mouseDownY) > threshold) + { + trace("sending dragStart"); + dragEvent = DragEvent.createDragEvent("dragStart", event); + DragEvent.dispatchDragEvent(dragEvent, IEventDispatcher(_strand)); + if (DragEvent.dragSource != null) + { + dragging = true; + host = UIUtils.findPopUpHost(_strand as IUIBase); + host.addElement(dragImage); + pt = PointUtils.globalToLocal(new Point(event.clientX, event.clientY), host); + dragImage.x = pt.x + dragImageOffsetX; + dragImage.y = pt.y + dragImageOffsetY; + } + } + } + else + { + trace("sending dragMove " + event.target.toString()); + dragEvent = DragEvent.createDragEvent("dragMove", event); + trace("client: " + event.clientX.toString() + " " + event.clientY.toString() + " " + event.target.toString()); + pt = PointUtils.globalToLocal(new Point(event.clientX, event.clientY), host); + trace("host: " + pt.x.toString() + " " + pt.y.toString()); + dragImage.x = pt.x + dragImageOffsetX; + dragImage.y = pt.y + dragImageOffsetY; + DragEvent.dispatchDragEvent(dragEvent, IEventDispatcher(event.target)); + } + } + + private function dragMouseUpHandler(event:MouseEvent):void + { + trace("dragMouseUp"); + var dragEvent:DragEvent; + + if (dragging) + { + trace("sending dragEnd"); + dragEvent = DragEvent.createDragEvent("dragEnd", event); + DragEvent.dispatchDragEvent(dragEvent, IEventDispatcher(event.target)); + event.preventDefault(); + } + dragging = false; + DragEvent.dragSource = null; + DragEvent.dragInitiator = null; + if (dragImage && host) + host.removeElement(dragImage); + dragImage = null; + IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, dragMouseMoveHandler); + IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, dragMouseUpHandler); + } + + } +}
