start fixing errors in the cross-compile
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/7bfeed8a Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/7bfeed8a Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/7bfeed8a Branch: refs/heads/spark Commit: 7bfeed8a0bb0743e02f6b6552935c443276eab32 Parents: 02064d1 Author: Alex Harui <[email protected]> Authored: Sat Feb 27 23:17:05 2016 -0800 Committer: Alex Harui <[email protected]> Committed: Sat Feb 27 23:17:05 2016 -0800 ---------------------------------------------------------------------- .../src/main/flex/flex/display/DisplayObject.as | 367 +------------------ .../flex/flex/display/DisplayObjectContainer.as | 2 +- .../MX/src/main/flex/flex/display/Graphics.as | 51 +++ .../MX/src/main/flex/flex/display/MovieClip.as | 27 ++ .../MX/src/main/flex/flex/display/Sprite.as | 14 +- .../main/flex/flex/display/TopOfDisplayList.as | 4 + .../main/flex/flex/events/ContextMenuEvent.as | 12 + .../MX/src/main/flex/flex/events/Event.as | 4 + .../src/main/flex/flex/events/IOErrorEvent.as | 12 + .../src/main/flex/flex/events/ProgressEvent.as | 12 + .../MX/src/main/flex/flex/events/TimerEvent.as | 12 + .../MX/src/main/flex/flex/text/TextField.as | 1 + .../MX/src/main/flex/flex/text/TextFieldType.as | 12 + .../projects/MX/src/main/flex/flex/ui/Mouse.as | 50 +++ .../src/main/flex/mx/binding/BindabilityInfo.as | 72 ++-- .../MX/src/main/flex/mx/binding/Binding.as | 106 ++++-- .../MX/src/main/flex/mx/core/IContainer.as | 3 +- .../src/main/flex/mx/core/ISpriteInterface.as | 1 - .../mx/events/ChildExistenceChangedEvent.as | 2 +- .../main/flex/mx/managers/CursorManagerImpl.as | 96 +++-- .../main/flex/mx/managers/IToolTipManager2.as | 9 +- .../src/main/flex/mx/managers/SystemManager.as | 82 +++-- .../main/flex/mx/managers/ToolTipManagerImpl.as | 168 +++++---- .../MX/src/main/flex/mx/states/AddItems.as | 13 +- .../MX/src/main/flex/mx/states/State.as | 2 +- .../flex/mx/utils/DescribeTypeCacheRecord.as | 40 +- .../MX/src/main/flex/mx/utils/ObjectProxy.as | 126 ++++++- .../MX/src/main/flex/mx/utils/OrderedObject.as | 15 +- 28 files changed, 749 insertions(+), 566 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as b/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as index 0cf041b..2568582 100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/DisplayObject.as @@ -18,370 +18,17 @@ //////////////////////////////////////////////////////////////////////////////// package flex.display { +import flex.display.TopOfDisplayList; + import org.apache.flex.core.IUIBase; +import org.apache.flex.events.IEventDispatcher; import org.apache.flex.geom.Point; import org.apache.flex.geom.Rectangle; -public interface DisplayObject +public interface DisplayObject extends IEventDispatcher { -/* - * The methods here would normally just be in IDisplayObject, - * but for backward compatibility, they have to be included - * directly into IFlexDisplayObject, so they are kept in - * this separate include file. - */ - - /** - * @copy flash.display.DisplayObject#root - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get root():DisplayObject; - - - /** - * @copy flash.display.DisplayObject#stage - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - COMPILE::LATER - function get stage():Stage; - - - /** - * @copy flash.display.DisplayObject#name - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get name():String; - function set name(value:String):void; - - - /** - * @copy flash.display.DisplayObject#parent - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get parent():IUIBase; - - - /** - * @copy flash.display.DisplayObject#mask - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get mask():DisplayObject; - function set mask(value:DisplayObject):void; - - - /** - * @copy flash.display.DisplayObject#visible - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get visible():Boolean; - function set visible(value:Boolean):void; - - - /** - * @copy flash.display.DisplayObject#x - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get x():Number; - function set x(value:Number):void; - - - /** - * @copy flash.display.DisplayObject#y - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get y():Number; - function set y(value:Number):void; - - - /** - * @copy flash.display.DisplayObject#scaleX - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get scaleX():Number; - function set scaleX(value:Number):void; - - - /** - * @copy flash.display.DisplayObject#scaleY - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get scaleY():Number; - function set scaleY(value:Number):void; - - - /** - * @copy flash.display.DisplayObject#mouseX - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get mouseX():Number; // note: no setter - - - /** - * @copy flash.display.DisplayObject#mouseY - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get mouseY():Number; // note: no setter - - - /** - * @copy flash.display.DisplayObject#rotation - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get rotation():Number; - function set rotation(value:Number):void; - - - /** - * @copy flash.display.DisplayObject#alpha - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get alpha():Number; - function set alpha(value:Number):void; - - - /** - * @copy flash.display.DisplayObject#width - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get width():Number; - function set width(value:Number):void; - - /** - * @copy flash.display.DisplayObject#height - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get height():Number; - function set height(value:Number):void; - - - /** - * @copy flash.display.DisplayObject#cacheAsBitmap - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get cacheAsBitmap():Boolean; - function set cacheAsBitmap(value:Boolean):void; - - /** - * @copy flash.display.DisplayObject#opaqueBackground - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get opaqueBackground():Object; - function set opaqueBackground(value:Object):void; - - - /** - * @copy flash.display.DisplayObject#scrollRect - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get scrollRect():Rectangle; - function set scrollRect(value:Rectangle):void; - - - /** - * @copy flash.display.DisplayObject#filters - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get filters():Array; - function set filters(value:Array):void; - - /** - * @copy flash.display.DisplayObject#blendMode - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get blendMode():String; - function set blendMode(value:String):void; - - /** - * @copy flash.display.DisplayObject#transform - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - COMPILE::LATER - function get transform():Transform; - COMPILE::LATER - function set transform(value:Transform):void; - - /** - * @copy flash.display.DisplayObject#scale9Grid - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get scale9Grid():Rectangle; - function set scale9Grid(innerRectangle:Rectangle):void; - - /** - * @copy flash.display.DisplayObject#globalToLocal() - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function globalToLocal(point:Point):Point; - - /** - * @copy flash.display.DisplayObject#localToGlobal() - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function localToGlobal(point:Point):Point; - - /** - * @copy flash.display.DisplayObject#getBounds() - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function getBounds(targetCoordinateSpace:DisplayObject):Rectangle; - - /** - * @copy flash.display.DisplayObject#getRect() - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function getRect(targetCoordinateSpace:DisplayObject):Rectangle; - - /** - * @copy flash.display.DisplayObject#loaderInfo - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - COMPILE::LATER - function get loaderInfo() : LoaderInfo; - - /** - * @copy flash.display.DisplayObject#hitTestObject() - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function hitTestObject(obj:DisplayObject):Boolean; - - /** - * @copy flash.display.DisplayObject#hitTestPoint() - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function hitTestPoint(x:Number, y:Number, shapeFlag:Boolean=false):Boolean; - - /** - * @copy flash.display.DisplayObject#accessibilityProperties - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - COMPILE::LATER - function get accessibilityProperties() : AccessibilityProperties; - COMPILE::LATER - function set accessibilityProperties( value : AccessibilityProperties ) : void; - + include "../../mx/core/IDisplayObjectInterface.as" + + function get topOfDisplayList():TopOfDisplayList; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as b/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as index 939725a..926064a 100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/DisplayObjectContainer.as @@ -23,6 +23,6 @@ package flex.display public interface DisplayObjectContainer extends DisplayObject, IUIBase { - + include "../../mx/core/IDisplayObjectContainerInterface.as" } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/display/Graphics.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/display/Graphics.as b/frameworks/projects/MX/src/main/flex/flex/display/Graphics.as new file mode 100644 index 0000000..e439e1e --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/display/Graphics.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 flex.display +{ + import org.apache.flex.core.graphics.GraphicsContainer; + import org.apache.flex.core.graphics.SolidColor; + + public class Graphics + { + private var host:GraphicsContainer; + + public function Graphics(host:GraphicsContainer) + { + this.host = host; + } + + public function beginFill(color:uint, alpha:Number = 1.0):void + { + var sc:SolidColor = new SolidColor(); + sc.color = color; + host.fill = sc; + } + + public function drawRect(x:Number, y:Number, width:Number, height:Number):void + { + host.drawRect(x, y, width, height); + } + + public function endFill():void + { + // really, we should queue up the drawing commands and execute them here. + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as b/frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as new file mode 100644 index 0000000..53e5eb1 --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/display/MovieClip.as @@ -0,0 +1,27 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.display +{ + import org.apache.flex.core.UIBase; + + public class MovieClip extends Sprite + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as b/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as index ff3e16e..e0ce060 100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/Sprite.as @@ -19,7 +19,19 @@ package flex.display { - public interface Sprite extends InteractiveObject + import org.apache.flex.core.graphics.GraphicsContainer; + + public class Sprite extends GraphicsContainer implements InteractiveObject { + private var _name:String; + public function get name():String + { + return _name; + } + public function set name(value:String):void + { + _name = value; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as b/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as index 41ef735..459331e 100644 --- a/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as +++ b/frameworks/projects/MX/src/main/flex/flex/display/TopOfDisplayList.as @@ -23,6 +23,10 @@ COMPILE::AS3 { import flash.display.Stage; } +COMPILE::JS +{ + import org.apache.flex.core.UIBase; +} COMPILE::AS3 public class TopOfDisplayList extends Stage http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as b/frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as new file mode 100644 index 0000000..caad1be --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/events/ContextMenuEvent.as @@ -0,0 +1,12 @@ +package flex.events +{ + public class ContextMenuEvent extends Event + { + public function ContextMenuEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + public static const MENU_SELECT:String = "menuSelect"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/events/Event.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/events/Event.as b/frameworks/projects/MX/src/main/flex/flex/events/Event.as index 558afa5..7260f83 100644 --- a/frameworks/projects/MX/src/main/flex/flex/events/Event.as +++ b/frameworks/projects/MX/src/main/flex/flex/events/Event.as @@ -9,8 +9,12 @@ package flex.events super(type, bubbles, cancelable); } + protected var bubbles:Boolean; + protected var cancelable:Boolean; + public static const ADDED:String = "added"; public static const CHANGE:String = "change"; + public static const COMPLETE:String = "change"; public static const ENTER_FRAME:String = "enterFrame"; public static const REMOVED:String = "removed"; public static const REMOVED_FROM_STAGE:String = "removedFromStage"; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as b/frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as new file mode 100644 index 0000000..bfda542 --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/events/IOErrorEvent.as @@ -0,0 +1,12 @@ +package flex.events +{ + public class IOErrorEvent extends Event + { + public function IOErrorEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + public static const IO_ERROR:String = "ioError"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as b/frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as new file mode 100644 index 0000000..30e2289 --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/events/ProgressEvent.as @@ -0,0 +1,12 @@ +package flex.events +{ + public class ProgressEvent extends Event + { + public function ProgressEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + public static const PROGRESS:String = "progress"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as b/frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as new file mode 100644 index 0000000..9864b85 --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/events/TimerEvent.as @@ -0,0 +1,12 @@ +package flex.events +{ + public class TimerEvent extends Event + { + public function TimerEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + public static const TIMER:String = "timer"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/text/TextField.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/text/TextField.as b/frameworks/projects/MX/src/main/flex/flex/text/TextField.as index a60bac1..4de38f3 100644 --- a/frameworks/projects/MX/src/main/flex/flex/text/TextField.as +++ b/frameworks/projects/MX/src/main/flex/flex/text/TextField.as @@ -6,6 +6,7 @@ COMPILE::AS3 } COMPILE::JS { + import mx.core.IUITextField; import org.apache.flex.html.Label; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/text/TextFieldType.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/text/TextFieldType.as b/frameworks/projects/MX/src/main/flex/flex/text/TextFieldType.as new file mode 100644 index 0000000..39df8a0 --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/text/TextFieldType.as @@ -0,0 +1,12 @@ +package flex.text +{ + public class TextFieldType + { + public function TextFieldType() + { + } + + public static const INPUT:String = "input"; + public static const DYNAMIC:String = "dynamic"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/flex/ui/Mouse.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/flex/ui/Mouse.as b/frameworks/projects/MX/src/main/flex/flex/ui/Mouse.as new file mode 100644 index 0000000..68e39f6 --- /dev/null +++ b/frameworks/projects/MX/src/main/flex/flex/ui/Mouse.as @@ -0,0 +1,50 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flex.ui +{ + public class Mouse + { + public function Mouse() + { + } + + COMPILE::JS + private static var styleElement:HTMLStyleElement; + + COMPILE::JS + public static function hide():void + { + if (!styleElement) + styleElement = document.createElement("STYLE"); + var css:CSSStyleSheet = styleElement.sheet as CSSStyleSheet; + css.insertRule("* { cursor: none; }", 0); + } + + COMPILE::JS + public static function show():void + { + if (!styleElement) + return; + var css:CSSStyleSheet = styleElement.sheet as CSSStyleSheet; + css.deleteRule(0); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/binding/BindabilityInfo.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/binding/BindabilityInfo.as b/frameworks/projects/MX/src/main/flex/mx/binding/BindabilityInfo.as index 5cbf6ef..dec8f6a 100644 --- a/frameworks/projects/MX/src/main/flex/mx/binding/BindabilityInfo.as +++ b/frameworks/projects/MX/src/main/flex/mx/binding/BindabilityInfo.as @@ -19,9 +19,13 @@ package mx.binding { - import mx.events.PropertyChangeEvent; +import org.apache.flex.reflection.MetaDataArgDefinition; +import org.apache.flex.reflection.MetaDataDefinition; +import org.apache.flex.reflection.MethodDefinition; +import org.apache.flex.reflection.TypeDefinition; + [ExcludeClass] /** @@ -114,7 +118,7 @@ public class BindabilityInfo * @playerversion AIR 1.1 * @productversion Flex 3 */ - public function BindabilityInfo(typeDescription:XML) + public function BindabilityInfo(typeDescription:TypeDefinition) { super(); @@ -130,7 +134,7 @@ public class BindabilityInfo /** * @private */ - private var typeDescription:XML; + private var typeDescription:TypeDefinition; /** * @private @@ -169,16 +173,33 @@ public class BindabilityInfo changeEvents = copyProps(getClassChangeEvents(), {}); // Get child-specific events. - var childDesc:XMLList = - typeDescription.accessor.(@name == childName) + - typeDescription.method.(@name == childName); + var childDesc:Array = []; + for each (var p:MethodDefinition in typeDescription.accessors) + { + if (p.name == childName) + { + childDesc.push(p); + break; + } + } + if (childName == null) + { + for each (var p:MethodDefinition in typeDescription.methods) + { + if (p.name == childName) + { + childDesc.push(p); + break; + } + } + } var numChildren:int = childDesc.length(); if (numChildren == 0) { // we've been asked for events on an unknown property - if (!typeDescription.@dynamic) + if (!typeDescription.dynamic) { trace("warning: no describeType entry for '" + childName + "' on non-dynamic type '" + @@ -194,7 +215,8 @@ public class BindabilityInfo "':\n" + childDesc); } - addBindabilityEvents(childDesc.metadata, changeEvents); + var prop:MethodDefinition = childDesc[0]; + addBindabilityEvents(prop.metadata, changeEvents); } childChangeEvents[childName] = changeEvents; @@ -229,13 +251,18 @@ public class BindabilityInfo /** * @private */ - private function addBindabilityEvents(metadata:XMLList, + private function addBindabilityEvents(metadata:Array, eventListObj:Object):void { - addChangeEvents(metadata.(@name == BINDABLE), eventListObj, true); - addChangeEvents(metadata.(@name == CHANGE_EVENT), eventListObj, true); - addChangeEvents(metadata.(@name == NON_COMMITTING_CHANGE_EVENT), - eventListObj, false); + for each (var p:MetaDataDefinition in metadata) + { + if (p.name == BINDABLE) + addChangeEvents(p.args, eventListObj, true); + else if (p.name == CHANGE_EVENT) + addChangeEvents(p.args, eventListObj, true); + else if (p.name == NON_COMMITTING_CHANGE_EVENT) + addChangeEvents(p.args, eventListObj, false); + } } /** @@ -244,22 +271,21 @@ public class BindabilityInfo * to an event list object. * Note: metadata's first arg value is assumed to be change event name. */ - private function addChangeEvents(metadata:XMLList, eventListObj:Object, isCommit:Boolean):void + private function addChangeEvents(metadata:Array, eventListObj:Object, isCommit:Boolean):void { - for each (var md:XML in metadata) + var atLeastOne:Boolean = false; + for each (var md:MetaDataArgDefinition in metadata) { - var arg:XMLList = md.arg; - if (arg.length() > 0) + if (md.value) { - var eventName:String = arg[0].@value; + var eventName:String = md.@value; eventListObj[eventName] = isCommit; - } - else - { - trace("warning: unconverted Bindable metadata in class '" + - typeDescription.@name + "'"); + atLeastOne = true; } } + if (!atLeastOne) + trace("warning: unconverted Bindable metadata in class '" + + typeDescription.name + "'"); } /** http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/binding/Binding.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/binding/Binding.as b/frameworks/projects/MX/src/main/flex/mx/binding/Binding.as index a8c569a..2cdca49 100644 --- a/frameworks/projects/MX/src/main/flex/mx/binding/Binding.as +++ b/frameworks/projects/MX/src/main/flex/mx/binding/Binding.as @@ -160,7 +160,7 @@ public class Binding * We will resynch with our binding if isEnabled is set to true * and one or more of our watchers fired while we were disabled. */ - mx_internal var disabledRequests:Dictionary; + mx_internal var disabledRequests:Array; /** * @private @@ -357,8 +357,16 @@ public class Binding } catch(error:Error) { - if (allowedErrors[error.errorID] == null) - throw error; + COMPILE::AS3 + { + if (allowedErrors[error.errorID] == null) + throw error; + } + COMPILE::JS + { + if (allowedErrors[error.name] == null) + throw error; + } } finally { @@ -375,9 +383,9 @@ public class Binding if (o != null) { disabledRequests = (disabledRequests != null) ? disabledRequests : - new Dictionary(true); + []; - disabledRequests[o] = true; + disabledRequests.push(o); } } @@ -389,7 +397,7 @@ public class Binding { if (disabledRequests != null) { - for (var key:Object in disabledRequests) + for each (var key:Object in disabledRequests) { execute(key); } @@ -445,21 +453,42 @@ public class Binding // Error #1055: - has no properties. // Error #1069: Property - not found on - and there is no default value // We allow any other errors to be thrown. - if ((error.errorID != 1006) && - (error.errorID != 1009) && - (error.errorID != 1010) && - (error.errorID != 1055) && - (error.errorID != 1069)) - { - throw error; - } - else - { - if (BindingManager.debugDestinationStrings[destString]) - { - trace("Binding: destString = " + destString + ", error = " + error); - } - } + COMPILE::AS3 + { + if ((error.errorID != 1006) && + (error.errorID != 1009) && + (error.errorID != 1010) && + (error.errorID != 1055) && + (error.errorID != 1069)) + { + throw error; + } + else + { + if (BindingManager.debugDestinationStrings[destString]) + { + trace("Binding: destString = " + destString + ", error = " + error); + } + } + } + COMPILE::JS + { + if ((error.name != 1006) && + (error.name != 1009) && + (error.name != 1010) && + (error.name != 1055) && + (error.name != 1069)) + { + throw error; + } + else + { + if (BindingManager.debugDestinationStrings[destString]) + { + trace("Binding: destString = " + destString + ", error = " + error); + } + } + } } } @@ -470,6 +499,7 @@ public class Binding * @private * true if XMLLists x and y contain the same node sequence. */ + COMPILE::LATER private static function nodeSeqEqual(x:XMLList, y:XMLList):Boolean { var n:uint = x.length(); @@ -504,18 +534,28 @@ public class Binding // Suppress binding assignments on non-simple XML: identical single nodes, or // lists over identical node sequences. // Note: outer tests are inline for efficiency - if (!(lastValue is XML && lastValue.hasComplexContent() && lastValue === value) && - !(lastValue is XMLList && lastValue.hasComplexContent() && value is XMLList && - nodeSeqEqual(lastValue as XMLList, value as XMLList))) - { - destFunc.call(document, value); - - if(destFuncFailed == false) { - // Note: state is not updated if destFunc throws - lastValue = value; - hasHadValue = true; - } - } + COMPILE::LATER + { + if (!(lastValue is XML && lastValue.hasComplexContent() && lastValue === value) && + !(lastValue is XMLList && lastValue.hasComplexContent() && value is XMLList && + nodeSeqEqual(lastValue as XMLList, value as XMLList))) + { + destFunc.call(document, value); + + if(destFuncFailed == false) { + // Note: state is not updated if destFunc throws + lastValue = value; + hasHadValue = true; + } + } + } + destFunc.call(document, value); + + if(destFuncFailed == false) { + // Note: state is not updated if destFunc throws + lastValue = value; + hasHadValue = true; + } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/core/IContainer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/core/IContainer.as b/frameworks/projects/MX/src/main/flex/mx/core/IContainer.as index a482148..7dfa535 100644 --- a/frameworks/projects/MX/src/main/flex/mx/core/IContainer.as +++ b/frameworks/projects/MX/src/main/flex/mx/core/IContainer.as @@ -41,16 +41,17 @@ COMPILE::AS3 import flash.display.DisplayObject; import flash.display.Sprite; import flash.geom.Rectangle; + import flash.display.Graphics; } COMPILE::JS { import flex.display.DisplayObject; import flex.display.Sprite; import org.apache.flex.geom.Rectangle; + import flex.display.Graphics; } COMPILE::LATER { - import flash.display.Graphics; import flash.media.SoundTransform; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/core/ISpriteInterface.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/core/ISpriteInterface.as b/frameworks/projects/MX/src/main/flex/mx/core/ISpriteInterface.as index d7d9757..4639a33 100644 --- a/frameworks/projects/MX/src/main/flex/mx/core/ISpriteInterface.as +++ b/frameworks/projects/MX/src/main/flex/mx/core/ISpriteInterface.as @@ -30,7 +30,6 @@ * @playerversion AIR 1.1 * @productversion Flex 3 */ - COMPILE::LATER function get graphics():Graphics; /** http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/events/ChildExistenceChangedEvent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/events/ChildExistenceChangedEvent.as b/frameworks/projects/MX/src/main/flex/mx/events/ChildExistenceChangedEvent.as index 488cab4..27f7ab3 100644 --- a/frameworks/projects/MX/src/main/flex/mx/events/ChildExistenceChangedEvent.as +++ b/frameworks/projects/MX/src/main/flex/mx/events/ChildExistenceChangedEvent.as @@ -28,7 +28,7 @@ COMPILE::JS { import flex.display.DisplayObject; } -import org.apache.flex.events.Event; +import flex.events.Event; /** * Represents events that are dispatched when a the child of a control http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/managers/CursorManagerImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/managers/CursorManagerImpl.as b/frameworks/projects/MX/src/main/flex/mx/managers/CursorManagerImpl.as index a66b83e..788b56e 100644 --- a/frameworks/projects/MX/src/main/flex/mx/managers/CursorManagerImpl.as +++ b/frameworks/projects/MX/src/main/flex/mx/managers/CursorManagerImpl.as @@ -20,26 +20,46 @@ package mx.managers { -import flash.display.DisplayObject; -import flash.display.DisplayObjectContainer; -import flash.display.InteractiveObject; -import flash.display.Sprite; -import flash.events.ContextMenuEvent; -import flash.events.Event; -import flash.events.EventDispatcher; -import flash.events.IEventDispatcher; -import flash.events.IOErrorEvent; -import flash.events.MouseEvent; -import flash.events.ProgressEvent; -import flash.geom.Point; -import flash.text.TextField; -import flash.text.TextFieldType; -import flash.ui.Mouse; +COMPILE::AS3 +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + import flash.display.InteractiveObject; + import flash.display.Sprite; + import flash.events.IOErrorEvent; + import flash.events.Event; + import flash.events.ProgressEvent; + import flash.events.ContextMenuEvent; + import flash.text.TextField; + import flash.text.TextFieldType; + import flash.ui.Mouse; +} +COMPILE::JS +{ + import flex.display.DisplayObject; + import flex.display.DisplayObjectContainer; + import flex.display.InteractiveObject; + import flex.display.Sprite; + import flex.events.ContextMenuEvent; + import flex.events.Event; + import flex.events.IOErrorEvent; + import flex.events.ProgressEvent; + import flex.text.TextField; + import flex.text.TextFieldType; + import flex.ui.Mouse; +} +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 mx.core.FlexGlobals; -import org.apache.flex.core.UIBase; +import org.apache.flex.utils.PointUtils; import mx.core.mx_internal; import mx.core.ISystemCursorClient; -import mx.core.IUIComponent; +COMPILE::JS + { + import mx.core.UIComponent; + } import mx.events.Request; import mx.styles.CSSStyleDeclaration; import mx.styles.StyleManager; @@ -576,6 +596,7 @@ public class CursorManagerImpl extends EventDispatcher implements ICursorManager /** * @private * Decides what cursor to display. + * @flexjsignorecoercion flex.display.Sprite */ private function showCurrentCursor():void { @@ -595,10 +616,13 @@ public class CursorManagerImpl extends EventDispatcher implements ICursorManager { // The first time a cursor is requested of the CursorManager, // create a Sprite to hold the cursor symbol - cursorHolder = new UIBase(); + cursorHolder = new UIComponent() as Sprite; cursorHolder.name = "cursorHolder"; + COMPILE::AS3 + { cursorHolder.mouseEnabled = false; cursorHolder.mouseChildren = false; + } systemManager.cursorChildren.addChild(cursorHolder); } } @@ -620,10 +644,13 @@ public class CursorManagerImpl extends EventDispatcher implements ICursorManager if (currentCursor) { - if (currentCursor is InteractiveObject) - InteractiveObject(currentCursor).mouseEnabled = false; - if (currentCursor is DisplayObjectContainer) - DisplayObjectContainer(currentCursor).mouseChildren = false; + COMPILE::AS3 + { + if (currentCursor is InteractiveObject) + InteractiveObject(currentCursor).mouseEnabled = false; + if (currentCursor is DisplayObjectContainer) + DisplayObjectContainer(currentCursor).mouseChildren = false; + } cursorHolder.addChild(currentCursor); addContextMenuHandlers(); @@ -633,8 +660,8 @@ public class CursorManagerImpl extends EventDispatcher implements ICursorManager if (systemManager is SystemManager) { pt = new Point(SystemManager(systemManager).mouseX + item.x, SystemManager(systemManager).mouseY + item.y); - pt = SystemManager(systemManager).localToGlobal(pt); - pt = cursorHolder.parent.globalToLocal(pt); + pt = PointUtils.localToGlobal(pt, systemManager); + pt = PointUtils.globalToLocal(pt, cursorHolder.parent); cursorHolder.x = pt.x; cursorHolder.y = pt.y; } @@ -642,8 +669,8 @@ public class CursorManagerImpl extends EventDispatcher implements ICursorManager else if (systemManager is DisplayObject) { pt = new Point(DisplayObject(systemManager).mouseX + item.x, DisplayObject(systemManager).mouseY + item.y); - pt = DisplayObject(systemManager).localToGlobal(pt); - pt = cursorHolder.parent.globalToLocal(pt); + pt = PointUtils.localToGlobal(pt, systemManager); + pt = PointUtils.globalToLocal(pt, cursorHolder.parent); cursorHolder.x = DisplayObject(systemManager).mouseX + item.x; cursorHolder.y = DisplayObject(systemManager).mouseY + item.y; } @@ -756,11 +783,14 @@ public class CursorManagerImpl extends EventDispatcher implements ICursorManager const app:InteractiveObject = systemManager.document as InteractiveObject; const sm:InteractiveObject = systemManager as InteractiveObject; - if (app && app.contextMenu) - app.contextMenu.removeEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelectHandler, true); - - if (sm && sm.contextMenu) - sm.contextMenu.removeEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelectHandler, true); + COMPILE::AS3 + { + if (app && app.contextMenu) + app.contextMenu.removeEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelectHandler, true); + + if (sm && sm.contextMenu) + sm.contextMenu.removeEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelectHandler, true); + } listenForContextMenu = false; } @@ -875,8 +905,8 @@ public class CursorManagerImpl extends EventDispatcher implements ICursorManager mx_internal function mouseMoveHandler(event:MouseEvent):void { - var pt:Point = new Point(event.stageX, event.stageY); - pt = cursorHolder.parent.globalToLocal(pt); + var pt:Point = new Point(event.screenX, event.screenY); + pt = PointUtils.globalToLocal(pt, cursorHolder.parent); pt.x += currentCursorXOffset; pt.y += currentCursorYOffset; cursorHolder.x = pt.x; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/managers/IToolTipManager2.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/managers/IToolTipManager2.as b/frameworks/projects/MX/src/main/flex/mx/managers/IToolTipManager2.as index 05b0c24..db5af2d 100644 --- a/frameworks/projects/MX/src/main/flex/mx/managers/IToolTipManager2.as +++ b/frameworks/projects/MX/src/main/flex/mx/managers/IToolTipManager2.as @@ -20,7 +20,14 @@ package mx.managers { -import flash.display.DisplayObject; +COMPILE::AS3 +{ + import flash.display.DisplayObject; +} +COMPILE::JS +{ + import flex.display.DisplayObject; +} import mx.core.IToolTip; import mx.core.IUIComponent; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as b/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as index 1a6d60a..649a9b5 100644 --- a/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as +++ b/frameworks/projects/MX/src/main/flex/mx/managers/SystemManager.as @@ -20,13 +20,25 @@ package mx.managers { -import flash.display.DisplayObject; -import flash.display.DisplayObjectContainer; -import flash.display.Graphics; +COMPILE::AS3 +{ + import flash.display.DisplayObject; + import flash.display.DisplayObjectContainer; + import flash.display.Graphics; + import flash.display.MovieClip; + import flash.display.Sprite; + import flash.display.LoaderInfo; + +} +COMPILE::JS +{ + import flex.display.DisplayObject; + import flex.display.DisplayObjectContainer; + import flex.display.Graphics; + import flex.display.MovieClip; + import flex.display.Sprite; +} import flash.display.Loader; -import flash.display.LoaderInfo; -import flash.display.MovieClip; -import flash.display.Sprite; import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageQuality; @@ -43,8 +55,8 @@ import flash.text.Font; import flash.text.TextFormat; import flash.ui.Keyboard; import flash.utils.Dictionary; -import flash.utils.Timer; -import flash.utils.getQualifiedClassName; +import org.apache.flex.utils.Timer; +import org.apache.flex.reflection.getQualifiedClassName; import mx.core.IChildList; import mx.core.IFlexDisplayObject; @@ -240,14 +252,17 @@ public class SystemManager extends MovieClip super(); - // Loaded SWFs don't get a stage right away - // and shouldn't override the main SWF's setting anyway. - if (stage) - { - stage.scaleMode = StageScaleMode.NO_SCALE; - stage.align = StageAlign.TOP_LEFT; - stage.quality = StageQuality.HIGH; - } + COMPILE::AS3 + { + // Loaded SWFs don't get a stage right away + // and shouldn't override the main SWF's setting anyway. + if (stage) + { + stage.scaleMode = StageScaleMode.NO_SCALE; + stage.align = StageAlign.TOP_LEFT; + stage.quality = StageQuality.HIGH; + } + } // If we don't have a stage then we are not top-level, // unless there are no other top-level managers, in which @@ -261,14 +276,24 @@ public class SystemManager extends MovieClip if (topLevel) SystemManagerGlobals.topLevelSystemManagers.push(this); - // Make sure to stop the playhead on the current frame. - stop(); + COMPILE::AS3 + { + // Make sure to stop the playhead on the current frame. + stop(); + } // Listen for the last frame (param is 0-indexed) to be executed. //addFrameScript(totalFrames - 1, frameEndHandler); - if (root && root.loaderInfo) - root.loaderInfo.addEventListener(Event.INIT, initHandler); + COMPILE::AS3 + { + if (root && root.loaderInfo) + root.loaderInfo.addEventListener(Event.INIT, initHandler); + } + COMPILE::JS + { + initHandler(null); + } } @@ -2024,13 +2049,16 @@ public class SystemManager extends MovieClip { var mainClassName:String = info()["mainClassName"]; - if (mainClassName == null) - { - var url:String = loaderInfo.loaderURL; - var dot:int = url.lastIndexOf("."); - var slash:int = url.lastIndexOf("/"); - mainClassName = url.substring(slash + 1, dot); - } + COMPILE::AS3 + { + if (mainClassName == null) + { + var url:String = loaderInfo.loaderURL; + var dot:int = url.lastIndexOf("."); + var slash:int = url.lastIndexOf("/"); + mainClassName = url.substring(slash + 1, dot); + } + } var mainClass:Class = Class(getDefinitionByName(mainClassName)); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/managers/ToolTipManagerImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/managers/ToolTipManagerImpl.as b/frameworks/projects/MX/src/main/flex/mx/managers/ToolTipManagerImpl.as index 8a341fe..a882de4 100644 --- a/frameworks/projects/MX/src/main/flex/mx/managers/ToolTipManagerImpl.as +++ b/frameworks/projects/MX/src/main/flex/mx/managers/ToolTipManagerImpl.as @@ -19,37 +19,47 @@ package mx.managers { - - import flash.display.DisplayObject; - import flash.events.Event; - import flash.events.EventDispatcher; - import flash.events.MouseEvent; - import flash.events.TimerEvent; - import flash.geom.Point; - import flash.geom.Rectangle; - import flash.utils.Timer; - - import mx.controls.ToolTip; - import mx.core.FlexGlobals; - import mx.core.FlexVersion; - import mx.core.IFlexDisplayObject; - import mx.core.IFlexModule; - import mx.core.IInvalidating; - import mx.core.ILayoutDirectionElement; - import mx.core.IToolTip; - import mx.core.IUIComponent; - import mx.core.IVisualElement; - import mx.core.LayoutDirection; - import mx.core.mx_internal; - import mx.effects.EffectManager; - import mx.effects.IAbstractEffect; - import mx.events.DynamicEvent; - import mx.events.EffectEvent; - import mx.events.ToolTipEvent; - import mx.styles.IStyleClient; - import mx.validators.IValidatorListener; - - use namespace mx_internal; +COMPILE::AS3 +{ + import flash.display.DisplayObject; + import flash.events.TimerEvent; +} +COMPILE::JS +{ + import mx.managers.SystemManagerGlobals; + + import flex.display.DisplayObject; + import flex.events.TimerEvent; +} +import org.apache.flex.events.Event; +import org.apache.flex.events.EventDispatcher; +import org.apache.flex.events.MouseEvent; +import org.apache.flex.geom.Point; +import org.apache.flex.geom.Rectangle; +import org.apache.flex.utils.PointUtils; +import org.apache.flex.utils.Timer; + +import mx.controls.ToolTip; +import mx.core.FlexGlobals; +import mx.core.FlexVersion; +import mx.core.IFlexDisplayObject; +import mx.core.IFlexModule; +import mx.core.IInvalidating; +import mx.core.ILayoutDirectionElement; +import mx.core.IToolTip; +import mx.core.IUIComponent; +import mx.core.IVisualElement; +import mx.core.LayoutDirection; +import mx.core.mx_internal; +import mx.effects.EffectManager; +import mx.effects.IAbstractEffect; +import mx.events.DynamicEvent; +import mx.events.EffectEvent; +import mx.events.ToolTipEvent; +import mx.styles.IStyleClient; +import mx.validators.IValidatorListener; + +use namespace mx_internal; [ExcludeClass] @@ -129,6 +139,10 @@ public class ToolTipManagerImpl extends EventDispatcher if (hasEventListener("initialize")) dispatchEvent(new Event("initialize")); + COMPILE::JS + { + SystemManagerGlobals.topLevelSystemManagers[0].addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, true); + } } //-------------------------------------------------------------------------- @@ -686,34 +700,46 @@ public class ToolTipManagerImpl extends EventDispatcher * @private * Returns true if the mouse is over the specified target. */ - private static function mouseIsOver(target:DisplayObject):Boolean + private function mouseIsOver(target:DisplayObject):Boolean { - if (!target || !target.stage) - return false; - - //SDK:13465 - If we pass through the above if block, then - //we have a target component and its been added to the - //display list. If the mouse coordinates are (0,0), there - //is a chance the component has not been positioned yet - //and we'll end up mistakenly showing tooltips since the - //target hitTest will return true. - if ((target.stage.mouseX == 0) && (target.stage.mouseY == 0)) - return false; - - if (target is ILayoutManagerClient && !ILayoutManagerClient(target).initialized) - return false; - - if (target is IVisualElement && !IVisualElement(target).visible) - return false; - - if (target is IFlexDisplayObject && !IFlexDisplayObject(target).visible) - return false; - - if (!isVisibleParentsIncluded(target)) - return false; - - return target.hitTestPoint(target.stage.mouseX, - target.stage.mouseY, true); + COMPILE::AS3 + { + if (!target || !target.stage) + return false; + + //SDK:13465 - If we pass through the above if block, then + //we have a target component and its been added to the + //display list. If the mouse coordinates are (0,0), there + //is a chance the component has not been positioned yet + //and we'll end up mistakenly showing tooltips since the + //target hitTest will return true. + if ((target.stage.mouseX == 0) && (target.stage.mouseY == 0)) + return false; + + if (target is ILayoutManagerClient && !ILayoutManagerClient(target).initialized) + return false; + + if (target is IVisualElement && !IVisualElement(target).visible) + return false; + + if (target is IFlexDisplayObject && !IFlexDisplayObject(target).visible) + return false; + + if (!isVisibleParentsIncluded(target)) + return false; + + return target.hitTestPoint(target.stage.mouseX, + target.stage.mouseY, true); + } + COMPILE::JS + { + var screenPos:Point = new Point(target.x, target.y); + screenPos = PointUtils.localToGlobal(screenPos, target); + var screenX:Number = lastMouseEvent.screenX; + var screenY:Number = lastMouseEvent.screenY; + return ((screenPos.x <= screenX && screenX <= screenPos.x + target.width) && + (screenPos.y <= screenY && screenY <= screenPos.y + target.height)); + } } /** @@ -968,9 +994,12 @@ public class ToolTipManagerImpl extends EventDispatcher currentTarget is IFlexModule) IFlexModule(currentToolTip).moduleFactory = IFlexModule(currentTarget).moduleFactory; + COMPILE::LATER + { if (hasEventListener("createTip")) if (!dispatchEvent(new Event("createTip", false, true))) return; + } var sm:ISystemManager = getSystemManager(currentTarget) as ISystemManager; sm.topLevelSystemManager.toolTipChildren.addChild(currentToolTip as DisplayObject); @@ -1221,8 +1250,8 @@ public class ToolTipManagerImpl extends EventDispatcher y = screenHeight - toolTipHeight; var pos:Point = new Point(x, y); - pos = DisplayObject(sm).localToGlobal(pos); - pos = DisplayObject(sm.getSandboxRoot()).globalToLocal(pos); + pos = PointUtils.localToGlobal(pos, sm); + pos = PointUtils.globalToLocal(pos, sm.getSandboxRoot()); x = pos.x; y = pos.y; } @@ -1592,14 +1621,14 @@ public class ToolTipManagerImpl extends EventDispatcher { var upperLeft:Point = new Point(0, 0); - upperLeft = obj.localToGlobal(upperLeft); + upperLeft = PointUtils.localToGlobal(upperLeft, obj); // If the layout has been mirrored, then the 0,0 is the uppper // right corner; compensate here. if (mirror) upperLeft.x -= obj.width; - upperLeft = parent.globalToLocal(upperLeft); + upperLeft = PointUtils.globalToLocal(upperLeft, obj); return new Rectangle(upperLeft.x, upperLeft.y, obj.width, obj.height); } @@ -1624,10 +1653,11 @@ public class ToolTipManagerImpl extends EventDispatcher * @private * This handler is called when the mouse moves out of an object * with a toolTip. + * @flexjsignorecoercion flex.display.DisplayObject */ mx_internal function toolTipMouseOutHandler(event:MouseEvent):void { - checkIfTargetChanged(event.relatedObject); + checkIfTargetChanged(event.relatedObject as DisplayObject); } /** @@ -1644,10 +1674,11 @@ public class ToolTipManagerImpl extends EventDispatcher * @private * This handler is called when the mouse moves out of an object * with an errorString. + * @flexjsignorecoercion flex.display.DisplayObject */ mx_internal function errorTipMouseOutHandler(event:MouseEvent):void { - checkIfTargetChanged(event.relatedObject); + checkIfTargetChanged(event.relatedObject as DisplayObject); } /** @@ -1711,6 +1742,15 @@ public class ToolTipManagerImpl extends EventDispatcher { reset(); } + + COMPILE::JS + private var lastMouseEvent:MouseEvent; + + COMPILE::JS + private function mouseMoveHandler(event:MouseEvent):void + { + lastMouseEvent = event; + } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/states/AddItems.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/states/AddItems.as b/frameworks/projects/MX/src/main/flex/mx/states/AddItems.as index b840bca..68be25a 100644 --- a/frameworks/projects/MX/src/main/flex/mx/states/AddItems.as +++ b/frameworks/projects/MX/src/main/flex/mx/states/AddItems.as @@ -19,9 +19,16 @@ package mx.states { -import flash.display.DisplayObject; -import flash.events.Event; -import flash.events.IEventDispatcher; +COMPILE::AS3 +{ + import flash.display.DisplayObject; +} +COMPILE::JS +{ + import flex.display.DisplayObject; +} +import org.apache.flex.events.Event; +import org.apache.flex.events.IEventDispatcher; import mx.binding.BindingManager; import mx.collections.IList; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/states/State.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/states/State.as b/frameworks/projects/MX/src/main/flex/mx/states/State.as index 4e24e62..79ffc83 100644 --- a/frameworks/projects/MX/src/main/flex/mx/states/State.as +++ b/frameworks/projects/MX/src/main/flex/mx/states/State.as @@ -20,7 +20,7 @@ package mx.states { -import flash.events.EventDispatcher; +import org.apache.flex.events.EventDispatcher; import mx.core.mx_internal; import mx.events.FlexEvent; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/utils/DescribeTypeCacheRecord.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/DescribeTypeCacheRecord.as b/frameworks/projects/MX/src/main/flex/mx/utils/DescribeTypeCacheRecord.as index ea17f6c..dc8f00f 100644 --- a/frameworks/projects/MX/src/main/flex/mx/utils/DescribeTypeCacheRecord.as +++ b/frameworks/projects/MX/src/main/flex/mx/utils/DescribeTypeCacheRecord.as @@ -20,10 +20,13 @@ package mx.utils { -import flash.utils.Proxy; +import org.apache.flex.utils.Proxy; +import org.apache.flex.reflection.TypeDefinition; +COMPILE::AS3 +{ import flash.utils.flash_proxy; - use namespace flash_proxy; +} [ExcludeClass] @@ -60,7 +63,7 @@ public dynamic class DescribeTypeCacheRecord extends Proxy /** * @private */ - public var typeDescription:XML; + public var typeDescription:TypeDefinition; //---------------------------------- // typeName @@ -94,6 +97,7 @@ public dynamic class DescribeTypeCacheRecord extends Proxy /** * @private */ + COMPILE::AS3 override flash_proxy function getProperty(name:*):* { var result:* = cache[name]; @@ -106,10 +110,25 @@ public dynamic class DescribeTypeCacheRecord extends Proxy return result; } + COMPILE::JS + override public function getProperty(name:String):* + { + var result:* = cache[name]; + + if (result === undefined) + { + result = DescribeTypeCache.extractValue(name, this); + cache[name] = result; + } + + return result; + } + /** * @private */ + COMPILE::AS3 override flash_proxy function hasProperty(name:*):Boolean { if (name in cache) @@ -124,6 +143,21 @@ public dynamic class DescribeTypeCacheRecord extends Proxy return true; } + COMPILE::JS + override public function hasProperty(name:String):Boolean + { + if (name in cache) + return true; + + var value:* = DescribeTypeCache.extractValue(name, this); + + if (value === undefined) + return false; + + cache[name] = value; + + return true; + } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/utils/ObjectProxy.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/ObjectProxy.as b/frameworks/projects/MX/src/main/flex/mx/utils/ObjectProxy.as index 03a8f51..b1f31f2 100644 --- a/frameworks/projects/MX/src/main/flex/mx/utils/ObjectProxy.as +++ b/frameworks/projects/MX/src/main/flex/mx/utils/ObjectProxy.as @@ -20,20 +20,30 @@ package mx.utils { +import org.apache.flex.events.EventDispatcher; +import org.apache.flex.reflection.getQualifiedClassName; +COMPILE::AS3 +{ import flash.events.Event; -import flash.events.EventDispatcher; -import flash.utils.getQualifiedClassName; import flash.utils.IDataInput; import flash.utils.IDataOutput; import flash.utils.IExternalizable; -import flash.utils.Proxy; import flash.utils.flash_proxy; +} +COMPILE::JS +{ + import org.apache.flex.events.Event; +} +import org.apache.flex.utils.Proxy; import mx.core.IPropertyChangeNotifier; import mx.events.PropertyChangeEvent; import mx.events.PropertyChangeEventKind; +COMPILE::AS3 +{ use namespace flash_proxy; use namespace object_proxy; +} [Bindable("propertyChange")] [RemoteClass(alias="flex.messaging.io.ObjectProxy")] @@ -256,6 +266,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::LATER object_proxy function get object():Object { return _item; @@ -269,6 +280,7 @@ public dynamic class ObjectProxy extends Proxy * @private * Storage for the qualified type name. */ + COMPILE::LATER private var _type:QName; /** @@ -279,6 +291,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::LATER object_proxy function get type():QName { return _type; @@ -287,6 +300,7 @@ public dynamic class ObjectProxy extends Proxy /** * @private */ + COMPILE::LATER object_proxy function set type(value:QName):void { _type = value; @@ -348,6 +362,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 override flash_proxy function getProperty(name:*):* { // if we have a data proxy for this then @@ -372,6 +387,31 @@ public dynamic class ObjectProxy extends Proxy return result; } + COMPILE::JS + override public function getProperty(name:String):* + { + // if we have a data proxy for this then + var result:*; + + if (notifiers[name.toString()]) + return notifiers[name]; + + result = _item[name]; + + if (result) + { + if (_proxyLevel == 0 || ObjectUtil.isSimple(result)) + { + return result; + } + else + { + result = object_proxy::getComplexProperty(name, result); + } // if we are proxying + } + + return result; + } /** * Returns the value of the proxied object's method with the specified name. @@ -388,6 +428,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 override flash_proxy function callProperty(name:*, ... rest):* { return _item[name].apply(_item, rest) @@ -408,6 +449,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 override flash_proxy function deleteProperty(name:*):Boolean { var notifier:IPropertyChangeNotifier = IPropertyChangeNotifier(notifiers[name]); @@ -433,18 +475,51 @@ public dynamic class ObjectProxy extends Proxy return deleted; } + COMPILE::JS + override public function deleteProperty(name:String):Boolean + { + var notifier:IPropertyChangeNotifier = IPropertyChangeNotifier(notifiers[name]); + if (notifier) + { + notifier.removeEventListener(PropertyChangeEvent.PROPERTY_CHANGE, + propertyChangeHandler); + delete notifiers[name]; + } + + var oldVal:* = _item[name]; + var deleted:Boolean = delete _item[name]; + + if (dispatcher.hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)) + { + var event:PropertyChangeEvent = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE); + event.kind = PropertyChangeEventKind.DELETE; + event.property = name; + event.oldValue = oldVal; + event.source = this; + dispatcher.dispatchEvent(event); + } + + return deleted; + } /** * @private */ + COMPILE::AS3 override flash_proxy function hasProperty(name:*):Boolean { return(name in _item); } + COMPILE::JS + override public function hasProperty(name:String):Boolean + { + return(name in _item); + } /** * @private */ + COMPILE::AS3 override flash_proxy function nextName(index:int):String { return propertyList[index -1]; @@ -453,6 +528,7 @@ public dynamic class ObjectProxy extends Proxy /** * @private */ + COMPILE::AS3 override flash_proxy function nextNameIndex(index:int):int { if (index == 0) @@ -473,6 +549,7 @@ public dynamic class ObjectProxy extends Proxy /** * @private */ + COMPILE::AS3 override flash_proxy function nextValue(index:int):* { return _item[propertyList[index -1]]; @@ -492,6 +569,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 override flash_proxy function setProperty(name:*, value:*):void { var oldVal:* = _item[name]; @@ -523,6 +601,41 @@ public dynamic class ObjectProxy extends Proxy } } } + COMPILE::JS + override public function setProperty(name:String, value:*):void + { + var oldVal:* = _item[name]; + if (oldVal !== value) + { + // Update item. + _item[name] = value; + + // Stop listening for events on old item if we currently are. + var notifier:IPropertyChangeNotifier = + IPropertyChangeNotifier(notifiers[name]); + if (notifier) + { + notifier.removeEventListener( + PropertyChangeEvent.PROPERTY_CHANGE, + propertyChangeHandler); + delete notifiers[name]; + } + + // Notify anyone interested. + if (dispatcher.hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE)) + { + COMPILE::LATER + { + if (name is QName) + name = QName(name).localName; + } + var event:PropertyChangeEvent = + PropertyChangeEvent.createUpdateEvent( + this, name.toString(), oldVal, value); + dispatcher.dispatchEvent(event); + } + } + } //-------------------------------------------------------------------------- // @@ -590,6 +703,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function readExternal(input:IDataInput):void { var value:Object = input.readObject(); @@ -610,6 +724,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function writeExternal(output:IDataOutput):void { output.writeObject(_item); @@ -655,6 +770,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, @@ -690,6 +806,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void { @@ -718,6 +835,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function dispatchEvent(event:Event):Boolean { return dispatcher.dispatchEvent(event); @@ -743,6 +861,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function hasEventListener(type:String):Boolean { return dispatcher.hasEventListener(type); @@ -768,6 +887,7 @@ public dynamic class ObjectProxy extends Proxy * @playerversion AIR 1.1 * @productversion Flex 3 */ + COMPILE::AS3 public function willTrigger(type:String):Boolean { return dispatcher.willTrigger(type); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7bfeed8a/frameworks/projects/MX/src/main/flex/mx/utils/OrderedObject.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/OrderedObject.as b/frameworks/projects/MX/src/main/flex/mx/utils/OrderedObject.as index f60067b..f1e05cb 100644 --- a/frameworks/projects/MX/src/main/flex/mx/utils/OrderedObject.as +++ b/frameworks/projects/MX/src/main/flex/mx/utils/OrderedObject.as @@ -203,7 +203,7 @@ public dynamic class OrderedObject extends Proxy * @productversion Flex 3 */ COMPILE::JS - override public function deleteProperty(name:*):Boolean + override public function deleteProperty(name:String):Boolean { var deleted:Boolean = delete valueMap[name]; @@ -246,7 +246,7 @@ public dynamic class OrderedObject extends Proxy return(name in valueMap); } COMPILE::JS - override protected function hasProperty(name:*):Boolean + override public function hasProperty(name:String):Boolean { return(name in valueMap); } @@ -272,9 +272,9 @@ public dynamic class OrderedObject extends Proxy return propertyList[index -1]; } COMPILE::JS - override public function nextName(index:int):String + override public function elementNames():Array { - return propertyList[index -1]; + return propertyList.slice(); } /** @@ -297,11 +297,6 @@ public dynamic class OrderedObject extends Proxy { return valueMap[propertyList[index -1]]; } - COMPILE::JS - override public function nextValue(index:int):* - { - return valueMap[propertyList[index -1]]; - } /** * Updates the specified property on the proxied object. @@ -336,7 +331,7 @@ public dynamic class OrderedObject extends Proxy } } COMPILE::JS - override public function setProperty(name:*, value:*):void + override public function setProperty(name:String, value:*):void { var oldVal:* = valueMap[name]; if (oldVal !== value)
