You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/11/05 15:22:50 UTC
[44/54] [abbrv] git commit: [flex-asjs]
[refs/heads/feature-autobuild/example-maven-dirs] - HTML Anchor class
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/010ec0b5
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/010ec0b5
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/010ec0b5
Branch: refs/heads/feature-autobuild/example-maven-dirs
Commit: 010ec0b54aa3c203c9df3cc19641287e940513a8
Parents: 019d1d2
Author: Carlos Rovira <ca...@apache.org>
Authored: Fri Nov 4 15:39:05 2016 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Fri Nov 4 15:41:02 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/010ec0b5/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/010ec0b5/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>