Added UIElement and Lookalike

Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ad9458ee
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ad9458ee
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ad9458ee

Branch: refs/heads/feature/flexjs_wrapper
Commit: ad9458ee7e671e574ee77993c65ba6a09748ff9d
Parents: 72303bc
Author: Harbs <[email protected]>
Authored: Wed Sep 27 13:21:15 2017 +0300
Committer: Harbs <[email protected]>
Committed: Wed Sep 27 13:21:15 2017 +0300

----------------------------------------------------------------------
 .../Basic/src/main/flex/BasicClasses.as         |  5 ++
 .../main/flex/org/apache/flex/core/Lookalike.as | 53 ++++++++++++++++++++
 .../main/flex/org/apache/flex/core/UIElement.as | 33 ++++++++++++
 3 files changed, 91 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad9458ee/frameworks/projects/Basic/src/main/flex/BasicClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/BasicClasses.as 
b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
index 9abaf14..4a86307 100644
--- a/frameworks/projects/Basic/src/main/flex/BasicClasses.as
+++ b/frameworks/projects/Basic/src/main/flex/BasicClasses.as
@@ -202,8 +202,13 @@ internal class BasicClasses
        import org.apache.flex.html.beads.models.WebBrowserModel; 
WebBrowserModel;
        
        import org.apache.flex.core.ListBase; ListBase;
+       import org.apache.flex.core.Lookalike; Lookalike;
        import org.apache.flex.core.FilledRectangle; FilledRectangle;
     import org.apache.flex.core.UIBase; UIBase;
+       COMPILE::JS
+       {
+               import org.apache.flex.core.UIElement; UIElement;
+       }
     import org.apache.flex.core.SimpleApplication; SimpleApplication;
        import org.apache.flex.svg.GraphicContainer; GraphicContainer;
        import org.apache.flex.svg.DOMWrapper; DOMWrapper;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad9458ee/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Lookalike.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Lookalike.as 
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Lookalike.as
new file mode 100644
index 0000000..3a54cd9
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/Lookalike.as
@@ -0,0 +1,53 @@
+package org.apache.flex.core
+{
+    COMPILE::SWF
+    {
+        import flash.display.BitmapData;
+        import flash.display.DisplayObject;
+        import flash.display.Bitmap;
+    }
+
+    /**
+     *  The UIElement class Takes an IRenderedObject and creates a new UIBase
+     *  which has the *appearance* of the original object.
+     *  It *does not* have any of the orginal object's functionality.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.9
+     */
+    
+    public class Lookalike extends UIBase
+    {
+        /**
+         *  Constructor.
+         *  
+         *  @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.9
+         */
+        public function Lookalike(original:IRenderedObject)
+        {
+            COMPILE::SWF
+            {
+                var dObj:DisplayObject = original.$displayObject;
+                       var bd:BitmapData = new 
BitmapData(dObj.width,dObj.height);
+                       bd.draw(dObj);
+                addChild(new Bitmap(bd));
+            }
+            COMPILE::JS
+            {
+                element = original.element.cloneNode(true) as 
WrappedHTMLElement;
+            }
+            super();
+        }
+        COMPILE::JS
+        override protected function createElement():WrappedHTMLElement
+        {
+            return element;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ad9458ee/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIElement.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIElement.as 
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIElement.as
new file mode 100644
index 0000000..1f42d2d
--- /dev/null
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/UIElement.as
@@ -0,0 +1,33 @@
+package org.apache.flex.core
+{
+    /**
+     *  The UIElement class is an HTML-only class which creates a UIBase 
wrapper around an HTML element.
+     *  The constructor accepts an HTMLElement and swallows the standard 
createElement call.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.9
+     */
+    COMPILE::JS
+    public class UIElement extends UIBase
+    {
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.9
+         */
+        public function UIElement(htmlElement:WrappedHTMLElement)
+        {
+            element = htmlElement;
+            super();
+        }
+        override protected function createElement():WrappedHTMLElement
+        {
+            return element;
+        }
+    }
+}
\ No newline at end of file

Reply via email to