FLEX-35328 - Add "select" and "option" to HTML module
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/486a243f Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/486a243f Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/486a243f Branch: refs/heads/tlf Commit: 486a243fe547d3fb22bc7298e5e93820606b23eb Parents: fa45b0e Author: piotrz <pio...@apache.org> Authored: Fri Jun 23 08:51:23 2017 +0200 Committer: piotrz <pio...@apache.org> Committed: Fri Jun 23 08:51:23 2017 +0200 ---------------------------------------------------------------------- .../main/flex/org/apache/flex/html/Option.as | 110 +++++++++++++++++++ .../main/flex/org/apache/flex/html/Select.as | 69 ++++++++++++ .../HTML/src/main/resources/basic-manifest.xml | 4 +- 3 files changed, 182 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/486a243f/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Option.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Option.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Option.as new file mode 100644 index 0000000..a360f1b --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Option.as @@ -0,0 +1,110 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 Option class represents an HTML <option> element + * + * + * @toplevel + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.9 + */ + public class Option extends UIBase + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.9 + */ + public function Option() + { + super(); + } + + private var _text:String = ""; + + /** + * The text of the heading + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.9 + */ + 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; + } + } + + COMPILE::JS + protected var textNode:Text; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + var option:HTMLOptionElement = document.createElement('option') as HTMLOptionElement; + + textNode = document.createTextNode('') as Text; + option.appendChild(textNode); + + element = option as WrappedHTMLElement; + + positioner = element; + element.flexjs_wrapper = this; + + return element; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/486a243f/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Select.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Select.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Select.as new file mode 100644 index 0000000..99c024a --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Select.as @@ -0,0 +1,69 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 Select class represents an HTML <select> element + * + * + * @toplevel + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.9 + */ + public class Select extends UIBase + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.9 + */ + public function Select() + { + super(); + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLSelectElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + var select:HTMLSelectElement = document.createElement('select') as HTMLSelectElement; + element = select as WrappedHTMLElement; + + positioner = element; + element.flexjs_wrapper = this; + + return element; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/486a243f/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 4a47ba4..67b248f 100644 --- a/frameworks/projects/HTML/src/main/resources/basic-manifest.xml +++ b/frameworks/projects/HTML/src/main/resources/basic-manifest.xml @@ -34,7 +34,9 @@ <component id="I" class="org.apache.flex.html.I" /> <component id="Ul" class="org.apache.flex.html.Ul" /> <component id="Li" class="org.apache.flex.html.Li" /> - + <component id="Select" class="org.apache.flex.html.Select"/> + <component id="Option" class="org.apache.flex.html.Option"/> + <component id="Td" class="org.apache.flex.html.Td" /> <component id="Th" class="org.apache.flex.html.Th" />