flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject git commit: [flex-asjs] [refs/heads/feature/mdl] - HTML Anchor class
Date Fri, 04 Nov 2016 14:39:28 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/feature/mdl 7e902b0f7 -> 9e60131cb


HTML Anchor class


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

Branch: refs/heads/feature/mdl
Commit: 9e60131cb3df63ee690cb1b2ecbbfe6727d8a485
Parents: 7e902b0
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Fri Nov 4 15:39:05 2016 +0100
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Fri Nov 4 15:39:05 2016 +0100

----------------------------------------------------------------------
 .../main/flex/org/apache/flex/html/Anchor.as    | 138 +++++++++++++++++++
 .../HTML/src/main/resources/basic-manifest.xml  |   2 +
 2 files changed, 140 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e60131c/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Anchor.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Anchor.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Anchor.as
new file mode 100644
index 0000000..a967aef
--- /dev/null
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Anchor.as
@@ -0,0 +1,138 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.html
+{
+	import org.apache.flex.core.UIBase;
+
+    COMPILE::JS
+    {
+        import org.apache.flex.core.WrappedHTMLElement;            
+    }
+
+	/**
+	 *  The Anchor class represents an HTML <a> element
+     *  
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class Anchor extends UIBase
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function Anchor()
+		{
+			super();
+		}
+		
+        private var _text:String = "";
+
+        /**
+         *  The text of the link
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function get text():String
+		{
+            COMPILE::SWF
+            {
+                return _text;
+            }
+            COMPILE::JS
+            {
+                return textNode.nodeValue;
+            }
+		}
+
+		public function set text(value:String):void
+		{
+            COMPILE::SWF
+            {
+                _text = value;
+            }
+            COMPILE::JS
+            {
+                textNode.nodeValue = value;
+            }
+		}
+        
+        private var _href:String = "#";
+
+        /**
+         *  the link url
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function get href():String
+		{
+            return _href;   
+		}
+
+		public function set href(value:String):void
+		{
+            _href = value;
+            
+            COMPILE::JS
+            {
+                (element as HTMLElement).setAttribute('href', value);
+            }
+		}
+		
+        COMPILE::JS
+        private var textNode:Text;
+		
+        /**
+         * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 * @flexjsignorecoercion HTMLElement
+         */
+        COMPILE::JS
+        override protected function createElement():WrappedHTMLElement
+        {
+			var a:HTMLElement = document.createElement('a') as HTMLElement;
+            a.setAttribute('href', href);
+            
+            textNode = document.createTextNode('') as Text;
+            a.appendChild(textNode); 
+
+			element = a as WrappedHTMLElement;
+            
+            positioner = element;
+            positioner.style.position = 'relative';
+			element.flexjs_wrapper = this;
+            
+            className = typeNames = 'Anchor';
+
+            return element;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e60131c/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
index 315cbbf..9e4d07a 100644
--- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml
@@ -129,4 +129,6 @@
     
     <component id="WebBrowser" class="org.apache.flex.html.WebBrowser" />
 
+    <component id="Anchor" class="org.apache.flex.html.Anchor" />
+
 </componentPackage>


Mime
View raw message