Repository: flex-asjs Updated Branches: refs/heads/refactor-sprite 17eee003f -> ff3af7517
Added wrappers for DisplayObjects Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ff3af751 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ff3af751 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ff3af751 Branch: refs/heads/refactor-sprite Commit: ff3af7517acd02b4b25a2e8672b3d47d8281ecc3 Parents: 17eee00 Author: Harbs <[email protected]> Authored: Fri Jul 29 13:36:41 2016 +0300 Committer: Harbs <[email protected]> Committed: Fri Jul 29 13:36:41 2016 +0300 ---------------------------------------------------------------------- .../main/flex/org/apache/flex/core/CSSShape.as | 23 +++++++-- .../flex/org/apache/flex/core/CSSTextField.as | 23 ++++++--- .../org/apache/flex/core/HTMLElementWrapper.as | 19 ++++++-- .../flex/org/apache/flex/core/IFlexJSElement.as | 14 +++++- .../main/flex/org/apache/flex/core/UIBase.as | 14 ------ .../flex/org/apache/flex/core/UIButtonBase.as | 38 +++++++-------- .../flex/org/apache/flex/core/WrappedShape.as | 44 +++++++++++++++++ .../org/apache/flex/core/WrappedSimpleButton.as | 50 ++++++++++++++++++++ .../flex/org/apache/flex/core/WrappedSprite.as | 44 +++++++++++++++++ .../org/apache/flex/core/WrappedTextField.as | 44 +++++++++++++++++ .../supportClasses/TextFieldItemRenderer.as | 8 ---- 11 files changed, 263 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSShape.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSShape.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSShape.as index f822206..41e690b 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSShape.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSShape.as @@ -18,6 +18,7 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.core { + import flash.display.DisplayObject; import flash.display.Graphics; import flash.display.Shape; @@ -50,18 +51,32 @@ package org.apache.flex.core */ public function CSSShape() { - _shape = new Shape(); + _shape = new WrappedShape(); + _shape.flexjs_wrapper = this; } - private var _shape:Shape; + private var _shape:WrappedShape; + public function get $diplayObject():DisplayObject + { + return _shape; + } public function get $shape():Shape { return _shape; } - public function set $shape(val:Shape):void + + /** + * @copy org.apache.flex.core.HTMLElementWrapper#element + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get element():IFlexJSElement { - _shape = val; + return _shape; } private var _parent:IUIBase; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSTextField.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSTextField.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSTextField.as index 31d5436..6636d50 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSTextField.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/CSSTextField.as @@ -53,25 +53,36 @@ package org.apache.flex.core */ public function CSSTextField() { - _textField = new TextField(); + _textField = new WrappedTextField(); + _textField.flexjs_wrapper = this; + } - private var _textField:TextField; + private var _textField:WrappedTextField; public function get $textField():TextField { return _textField; } - public function set $textField(value:TextField):void - { - _textField = value; - } public function get $displayObject():DisplayObject { return _textField; } + + /** + * @copy org.apache.flex.core.HTMLElementWrapper#element + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get element():IFlexJSElement + { + return _textField; + } private var _parent:IUIBase; public function get parent():IUIBase http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as index acb8429..5a8dfd5 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/HTMLElementWrapper.as @@ -40,22 +40,31 @@ package org.apache.flex.core { public function HTMLElementWrapper() { - _sprite = new Sprite(); + _sprite = new WrappedSprite(); + _sprite.flexjs_wrapper = this; } - private var _sprite:Sprite; + private var _sprite:WrappedSprite; public function get $sprite():Sprite { return _sprite; } - public function set $sprite(value:Sprite):void + public function get $displayObject():DisplayObject { - _sprite = value; + return _sprite; } - public function get $displayObject():DisplayObject + /** + * Returns the IFlexJSElement which wraps the Display Object + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get element():IFlexJSElement { return _sprite; } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as index 765f2ad..1136297 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IFlexJSElement.as @@ -21,7 +21,19 @@ package org.apache.flex.core COMPILE::SWF public interface IFlexJSElement { - + //-------------------------------------- + // Property + //-------------------------------------- + + /** + * A pointer back to the instance that wrapped this element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.7 + */ + //function get flexjs_wrapper():Object; } COMPILE::JS http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as index 51f4ffd..3516b2b 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIBase.as @@ -982,20 +982,6 @@ package org.apache.flex.core } /** - * @copy org.apache.flex.core.IUIBase#element - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - COMPILE::SWF - public function get element():IFlexJSElement - { - return this; - } - - /** * @copy org.apache.flex.core.Application#beads * * @langversion 3.0 http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as index d1976f8..d2af3ef 100644 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/UIButtonBase.as @@ -59,7 +59,7 @@ package org.apache.flex.core * @productversion FlexJS 0.0 */ COMPILE::SWF - public class UIButtonBase extends EventDispatcher implements IStrandWithModel, IEventDispatcher, IUIBase, IStyleableObject, ILayoutChild, IFlexJSElement + public class UIButtonBase extends EventDispatcher implements IStrandWithModel, IEventDispatcher, IUIBase, IStyleableObject, ILayoutChild { /** * Constructor. @@ -71,25 +71,36 @@ package org.apache.flex.core */ public function UIButtonBase(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null) { - _button = new SimpleButton(upState, overState, downState, hitTestState); -// super(upState, overState, downState, hitTestState); + _button = new WrappedSimpleButton(upState, overState, downState, hitTestState); + _button.flexjs_wrapper = this; + + // mouseChildren = true; // mouseEnabled = true; MouseEventConverter.setupInstanceConverters(this); } - private var _button:SimpleButton; + private var _button:WrappedSimpleButton; public function get $button():SimpleButton { return _button; } - public function set $button(val:SimpleButton):void + + public function get $displayObject():DisplayObject { - _button = val; + return _button; } - public function get $displayObject():DisplayObject + /** + * @copy org.apache.flex.core.HTMLElementWrapper#element + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get element():IFlexJSElement { return _button; } @@ -742,19 +753,6 @@ package org.apache.flex.core } /** - * @copy org.apache.flex.core.UIBase#element - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get element():IFlexJSElement - { - return this; - } - - /** * @copy org.apache.flex.core.UIBase#beads * * @langversion 3.0 http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as new file mode 100644 index 0000000..80e3378 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedShape.as @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + COMPILE::SWF + { + import flash.display.Shape; + } + + COMPILE::SWF + public class WrappedShape extends Shape implements IFlexJSElement + { + + //-------------------------------------- + // Property + //-------------------------------------- + + /** + * A pointer back to the instance that wrapped this element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var flexjs_wrapper:Object; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.as new file mode 100644 index 0000000..56bb3d0 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSimpleButton.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 org.apache.flex.core +{ + COMPILE::SWF + { + import flash.display.DisplayObject; + import flash.display.SimpleButton; + } + + COMPILE::SWF + public class WrappedSimpleButton extends SimpleButton implements IFlexJSElement + { + public function WrappedSimpleButton(upState:DisplayObject = null, overState:DisplayObject = null, downState:DisplayObject = null, hitTestState:DisplayObject = null) + { + super(upState, overState, downState, hitTestState) + + } + + //-------------------------------------- + // Property + //-------------------------------------- + + /** + * A pointer back to the instance that wrapped this element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var flexjs_wrapper:Object; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as new file mode 100644 index 0000000..f2919b3 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedSprite.as @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + COMPILE::SWF + { + import flash.display.Sprite; + } + + COMPILE::SWF + public class WrappedSprite extends Sprite implements IFlexJSElement + { + + //-------------------------------------- + // Property + //-------------------------------------- + + /** + * A pointer back to the instance that wrapped this element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var flexjs_wrapper:Object; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as new file mode 100644 index 0000000..c998ca5 --- /dev/null +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/WrappedTextField.as @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + COMPILE::SWF + { + import flash.text.TextField; + } + + COMPILE::SWF + public class WrappedTextField extends TextField implements IFlexJSElement + { + + //-------------------------------------- + // Property + //-------------------------------------- + + /** + * A pointer back to the instance that wrapped this element. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var flexjs_wrapper:Object; + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff3af751/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as index 5908d73..fa7d668 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/supportClasses/TextFieldItemRenderer.as @@ -457,14 +457,6 @@ package org.apache.flex.html.supportClasses backgroundColor = selectedColor; } - /** - * @private - */ - public function get element():IFlexJSElement - { - return this; - } - // beads declared in MXML are added to the strand. // from AS, just call addBead() public var beads:Array;
