You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/11/11 01:29:56 UTC
[1/4] git commit: [flex-asjs] [refs/heads/core_js_to_as] - move asjs
to as
Repository: flex-asjs
Updated Branches:
refs/heads/core_js_to_as 110c96fbb -> 6bfbe8272
move asjs to as
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/0640cad8
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0640cad8
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0640cad8
Branch: refs/heads/core_js_to_as
Commit: 0640cad898f9781470050e45df29d6a0bc57147b
Parents: 559a1ad
Author: Alex Harui <ah...@apache.org>
Authored: Tue Nov 10 16:26:13 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 10 16:29:48 2015 -0800
----------------------------------------------------------------------
.../as/src/org/apache/flex/core/DropType.as | 64 +++++
.../beads/controllers/DragMouseController.as | 261 +++++++++++++++++++
.../beads/controllers/DropMouseController.as | 181 +++++++++++++
.../asjs/src/org/apache/flex/core/DropType.as | 64 -----
.../beads/controllers/DragMouseController.as | 261 -------------------
.../beads/controllers/DropMouseController.as | 181 -------------
6 files changed, 506 insertions(+), 506 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0640cad8/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
new file mode 100644
index 0000000..9df59cf
--- /dev/null
+++ b/frameworks/projects/DragDrop/as/src/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/0640cad8/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
new file mode 100644
index 0000000..01351b8
--- /dev/null
+++ b/frameworks/projects/DragDrop/as/src/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);
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0640cad8/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
new file mode 100644
index 0000000..03afba6
--- /dev/null
+++ b/frameworks/projects/DragDrop/as/src/org/apache/flex/html/beads/controllers/DropMouseController.as
@@ -0,0 +1,181 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+ */
+ private function dragMoveHandler(event:DragEvent):void
+ {
+ trace("dragMove");
+ var dragEvent:DragEvent;
+ if (!inside)
+ {
+ dragEvent = DragEvent.createDragEvent("dragEnter", event);
+ 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);
+ 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);
+ }
+
+ private function dragEndHandler(event:DragEvent):void
+ {
+ trace("dragEnd");
+ var dragEvent:DragEvent;
+
+ dragEvent = DragEvent.createDragEvent("dragDrop", event);
+ 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/0640cad8/frameworks/projects/DragDrop/asjs/src/org/apache/flex/core/DropType.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/asjs/src/org/apache/flex/core/DropType.as b/frameworks/projects/DragDrop/asjs/src/org/apache/flex/core/DropType.as
deleted file mode 100644
index 9df59cf..0000000
--- a/frameworks/projects/DragDrop/asjs/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/0640cad8/frameworks/projects/DragDrop/asjs/src/org/apache/flex/html/beads/controllers/DragMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/asjs/src/org/apache/flex/html/beads/controllers/DragMouseController.as b/frameworks/projects/DragDrop/asjs/src/org/apache/flex/html/beads/controllers/DragMouseController.as
deleted file mode 100644
index 01351b8..0000000
--- a/frameworks/projects/DragDrop/asjs/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/0640cad8/frameworks/projects/DragDrop/asjs/src/org/apache/flex/html/beads/controllers/DropMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/asjs/src/org/apache/flex/html/beads/controllers/DropMouseController.as b/frameworks/projects/DragDrop/asjs/src/org/apache/flex/html/beads/controllers/DropMouseController.as
deleted file mode 100644
index 03afba6..0000000
--- a/frameworks/projects/DragDrop/asjs/src/org/apache/flex/html/beads/controllers/DropMouseController.as
+++ /dev/null
@@ -1,181 +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
- */
- private function dragMoveHandler(event:DragEvent):void
- {
- trace("dragMove");
- var dragEvent:DragEvent;
- if (!inside)
- {
- dragEvent = DragEvent.createDragEvent("dragEnter", event);
- 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);
- 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);
- }
-
- private function dragEndHandler(event:DragEvent):void
- {
- trace("dragEnd");
- var dragEvent:DragEvent;
-
- dragEvent = DragEvent.createDragEvent("dragDrop", event);
- dispatchEvent(dragEvent);
-
- inside = false;
- IUIBase(_strand).topMostEventDispatcher.removeEventListener(DragEvent.DRAG_END, dragEndHandler);
- IUIBase(_strand).removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
- }
-
- }
-}
[4/4] git commit: [flex-asjs] [refs/heads/core_js_to_as] - new build
pattern for DragDrop
Posted by ah...@apache.org.
new build pattern 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/6bfbe827
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/6bfbe827
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/6bfbe827
Branch: refs/heads/core_js_to_as
Commit: 6bfbe8272e1219d99ea02dff3bd0ff6c0c84d214
Parents: 0e16bd1
Author: Alex Harui <ah...@apache.org>
Authored: Tue Nov 10 16:29:40 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 10 16:29:49 2015 -0800
----------------------------------------------------------------------
frameworks/build.xml | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/6bfbe827/frameworks/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/build.xml b/frameworks/build.xml
index 023eca3..a244107 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -96,7 +96,6 @@
<target name="compile-asjs" description="Cross-compiles all SWCs">
<ant dir="${basedir}/projects/CreateJS" target="compile-asjs"/>
- <ant dir="${basedir}/projects/DragDrop" target="compile-asjs"/>
<ant dir="${basedir}/projects/Effects" target="compile-asjs"/>
<ant dir="${basedir}/projects/Formatters" target="compile-asjs"/>
<ant dir="${basedir}/projects/GoogleMaps" target="compile-asjs"/>
@@ -108,7 +107,6 @@
<target name="lint-js" description="Cross-compiles all SWCs">
<ant dir="${basedir}/projects/CreateJS" target="lint-js"/>
- <ant dir="${basedir}/projects/DragDrop" target="lint-js"/>
<ant dir="${basedir}/projects/Effects" target="lint-js"/>
<ant dir="${basedir}/projects/Flat" target="lint-js"/>
<ant dir="${basedir}/projects/Formatters" target="lint-js"/>
@@ -123,7 +121,6 @@
<!-- order may matter due to dependencies -->
<ant dir="${basedir}/projects/Flat" target="compile"/>
<ant dir="${basedir}/projects/CreateJS" target="compile"/>
- <ant dir="${basedir}/projects/DragDrop" target="compile"/>
<ant dir="${basedir}/projects/Effects" target="compile"/>
<ant dir="${basedir}/projects/Formatters" target="compile"/>
<ant dir="${basedir}/projects/GoogleMaps" target="compile"/>
@@ -216,7 +213,7 @@
</target>
<target name="DragDrop" description="Clean build of DragDrop.swc">
- <ant dir="${basedir}/projects/DragDrop"/>
+ <ant dir="${basedir}/projects/DragDrop" target="all"/>
</target>
<target name="Effects" description="Clean build of Effects.swc">
[2/4] git commit: [flex-asjs] [refs/heads/core_js_to_as] - insert
DragEventBase so more of DragEvent cross-compiles without duplication
Posted by ah...@apache.org.
insert DragEventBase so more of DragEvent cross-compiles without duplication
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/559a1ad4
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/559a1ad4
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/559a1ad4
Branch: refs/heads/core_js_to_as
Commit: 559a1ad4e1b4b75469790e7eebaffc274ee676d0
Parents: 110c96f
Author: Alex Harui <ah...@apache.org>
Authored: Tue Nov 10 15:24:04 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 10 16:29:48 2015 -0800
----------------------------------------------------------------------
.../as/src/org/apache/flex/events/DragEvent.as | 58 +++++++++++++++-----
.../src/org/apache/flex/events/DragEventBase.as | 47 ++++++++++++++++
2 files changed, 91 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/559a1ad4/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
index 406ad9d..895fb7f 100644
--- a/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as
+++ b/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as
@@ -19,7 +19,10 @@
package org.apache.flex.events
{
import org.apache.flex.core.IDragInitiator;
- import org.apache.flex.events.MouseEvent;
+ COMPILE::JS
+ {
+ import window.MouseEvent;
+ }
/**
* Drag and Drop Events.
@@ -29,7 +32,7 @@ package org.apache.flex.events
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class DragEvent extends MouseEvent
+ public class DragEvent extends DragEventBase
{
/**
* The <code>DragEvent.DRAG_START</code> constant defines the value of the
@@ -268,7 +271,14 @@ package org.apache.flex.events
*/
public function DragEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
{
- super(type, bubbles, cancelable);
+ COMPILE::AS3
+ {
+ super(type, bubbles, cancelable);
+ }
+ COMPILE::JS
+ {
+ this.type = type;
+ }
}
/**
@@ -282,19 +292,32 @@ package org.apache.flex.events
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
+ * @flexjsignorecoercion org.apache.flex.events.DragEvent
*/
public static function createDragEvent(type:String, event:MouseEvent):DragEvent
{
- 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::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:MouseEvent = new MouseEvent(type);
+ out.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;
+ }
}
@@ -311,7 +334,14 @@ package org.apache.flex.events
*/
public static function dispatchDragEvent(event:DragEvent, target:IEventDispatcher):void
{
- target.dispatchEvent(event);
+ COMPILE::AS3
+ {
+ target.dispatchEvent(event);
+ }
+ COMPILE::JS
+ {
+ target.element.dispatchEvent(event);
+ }
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/559a1ad4/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
new file mode 100644
index 0000000..8f0aa44
--- /dev/null
+++ b/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEventBase.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+ {
+ }
+
+ COMPILE::JS
+ public class DragEventBase extends BrowserEvent
+ {
+ }
+}
\ No newline at end of file
[3/4] git commit: [flex-asjs] [refs/heads/core_js_to_as] - clean
compile of DragDrop
Posted by ah...@apache.org.
clean compile of 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/0e16bd14
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0e16bd14
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0e16bd14
Branch: refs/heads/core_js_to_as
Commit: 0e16bd14a96e3e787c01c3d01e29d9a8f081fa06
Parents: 0640cad
Author: Alex Harui <ah...@apache.org>
Authored: Tue Nov 10 16:26:32 2015 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Nov 10 16:29:49 2015 -0800
----------------------------------------------------------------------
.../projects/DragDrop/as/src/DragDropClasses.as | 1 +
.../as/src/org/apache/flex/events/DragEvent.as | 10 ++-
.../src/org/apache/flex/events/DragEventBase.as | 6 +-
frameworks/projects/DragDrop/build.xml | 79 ++++++++++++--------
.../projects/DragDrop/compile-asjs-config.xml | 12 ++-
frameworks/projects/DragDrop/compile-config.xml | 6 --
6 files changed, 65 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e16bd14/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
index 7c7152c..14d0b54 100644
--- a/frameworks/projects/DragDrop/as/src/DragDropClasses.as
+++ b/frameworks/projects/DragDrop/as/src/DragDropClasses.as
@@ -27,6 +27,7 @@ package
*/
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/0e16bd14/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
index 895fb7f..c7dec05 100644
--- a/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as
+++ b/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEvent.as
@@ -21,6 +21,8 @@ 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;
}
@@ -293,6 +295,7 @@ package org.apache.flex.events
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
* @flexjsignorecoercion org.apache.flex.events.DragEvent
+ * @flexjsignorecoercion window.Event
*/
public static function createDragEvent(type:String, event:MouseEvent):DragEvent
{
@@ -312,7 +315,8 @@ package org.apache.flex.events
COMPILE::JS
{
var out:MouseEvent = new MouseEvent(type);
- out.initMouseEvent(type, true, true,
+ 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);
@@ -331,6 +335,8 @@ package org.apache.flex.events
* @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
{
@@ -340,7 +346,7 @@ package org.apache.flex.events
}
COMPILE::JS
{
- target.element.dispatchEvent(event);
+ (target as IUIBase).element.dispatchEvent(event as window.Event);
}
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e16bd14/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
index 8f0aa44..aaa8ddf 100644
--- a/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEventBase.as
+++ b/frameworks/projects/DragDrop/as/src/org/apache/flex/events/DragEventBase.as
@@ -38,10 +38,14 @@ package org.apache.flex.events
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 BrowserEvent
+ public class DragEventBase extends goog.events.BrowserEvent
{
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e16bd14/frameworks/projects/DragDrop/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/build.xml b/frameworks/projects/DragDrop/build.xml
index 1db4bb7..1896794 100644
--- a/frameworks/projects/DragDrop/build.xml
+++ b/frameworks/projects/DragDrop/build.xml
@@ -37,7 +37,7 @@
<target name="main" depends="clean,compile,test" description="Clean build of DragDrop.swc">
</target>
- <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of DragDrop.swc">
+ <target name="all" depends="clean,compile-asjs,compile-extern-swc,compile" description="Full build of DragDrop.swc">
</target>
<target name="test" unless="is.jenkins">
@@ -98,11 +98,13 @@
<load-config filename="compile-config.xml" />
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-define=COMPILE::AS3,true" />
+ <arg value="-define=COMPILE::JS,false" />
</compc>
</target>
- <target name="compile-asjs" >
- <echo message="Cross-compiling DragDrop/asjs"/>
+ <target name="compile-asjs">
+ <echo message="Cross-compiling DragDrop"/>
<echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/>
<java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
<jvmarg value="-Xmx384m" />
@@ -117,45 +119,56 @@
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
<arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
</java>
</target>
- <target name="lint-js" depends="gjslint, jshint, copy-js" />
+ <target name="compile-extern-swc" description="Compiles .as files into .swc used for cross-compiling other projects">
+ <echo message="Compiling externs/DragDrop.swc"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+ <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+ <!-- make JS output folder now so include-file doesn't error -->
+ <mkdir dir="${FLEXJS_HOME}/frameworks/externs"/>
+
+ <!-- Load the <compc> task. We can't do this at the <project> level -->
+ <!-- because targets that run before flexTasks.jar gets built would fail. -->
+ <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+ <!--
+ Link in the classes (and their dependencies) for the MXML tags
+ listed in this project's manifest.xml.
+ Also link the additional classes (and their dependencies)
+ listed in DragDropClasses.as,
+ because these aren't referenced by the manifest classes.
+ Keep the standard metadata when compiling.
+ Include the appropriate CSS files and assets in the SWC.
+ Don't include any resources in the SWC.
+ Write a bundle list of referenced resource bundles
+ into the file bundles.properties in this directory.
+ -->
+ <compc fork="true"
+ output="${FLEXJS_HOME}/frameworks/externs/DragDrop.swc">
+ <jvmarg line="${compc.jvm.args}"/>
+ <load-config filename="compile-asjs-config.xml" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
+ </compc>
+ </target>
+
<target name="copy-js" >
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
- <fileset dir="${basedir}/js/src">
- <include name="**/**" />
- </fileset>
<fileset dir="${basedir}/js/out">
<include name="**/**" />
</fileset>
</copy>
</target>
- <target name="gjslint" unless="no.lint">
- <echo>running gjslint</echo>
- <exec executable="${gjslint}" dir="${basedir}" failonerror="true">
- <arg value="--strict" />
- <arg value="--disable" />
- <arg value="006,100,214,300" />
- <!-- 006: wrong indentation -->
- <!-- 100: cannot have non-primitive value -->
- <!-- 214: @fileoverview tag missing description -->
- <!-- 300: missing newline at end of file -->
- <arg value="--max_line_length" />
- <arg value="120" />
- <arg value="-r" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
-
- <target name="jshint" unless="no.lint">
- <echo>running jshint</echo>
- <exec executable="${jshint}" dir="${basedir}" failonerror="true">
- <arg value="--config" />
- <arg value="${FLEX_HOME}/frameworks/js/jshint.properties" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
-
</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e16bd14/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
index 3fcabd6..3152403 100644
--- a/frameworks/projects/DragDrop/compile-asjs-config.xml
+++ b/frameworks/projects/DragDrop/compile-asjs-config.xml
@@ -22,7 +22,6 @@
<accessible>false</accessible>
<external-library-path>
- <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
</external-library-path>
<mxml>
@@ -46,12 +45,11 @@
<!-- 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>../../libs/Core.swc</path-element>
- <path-element>../../libs/DragDrop.swc</path-element>
+ <path-element>../../externs/Core.swc</path-element>
</library-path>
<source-path>
- <path-element>asjs/src</path-element>
+ <path-element>as/src</path-element>
</source-path>
<warn-no-constructor>false</warn-no-constructor>
@@ -60,9 +58,9 @@
<include-file>
</include-file>
- <include-sources>
- <path-element>asjs/src</path-element>
- </include-sources>
+ <include-classes>
+ <class>DragDropClasses</class>
+ </include-classes>
<include-namespaces>
<uri>library://ns.apache.org/flexjs/basic</uri>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0e16bd14/frameworks/projects/DragDrop/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/compile-config.xml b/frameworks/projects/DragDrop/compile-config.xml
index 7506e1d..f8d1526 100644
--- a/frameworks/projects/DragDrop/compile-config.xml
+++ b/frameworks/projects/DragDrop/compile-config.xml
@@ -54,7 +54,6 @@
<source-path>
<path-element>as/src</path-element>
- <path-element>asjs/src</path-element>
</source-path>
<warn-no-constructor>false</warn-no-constructor>
@@ -64,14 +63,9 @@
<name>js/out/*</name>
<path>js/out/*</path>
</include-file>
- <include-file>
- <name>js/src/*</name>
- <path>js/src/*</path>
- </include-file>
<include-classes>
<class>DragDropClasses</class>
- <class>DragDropASJSClasses</class>
</include-classes>
<include-namespaces>