Repository: flex-asjs Updated Branches: refs/heads/core_js_to_as 0e9b17dc1 -> 9634f9af6
Flat backport Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/9634f9af Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/9634f9af Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/9634f9af Branch: refs/heads/core_js_to_as Commit: 9634f9af6b8888db1b9bcb6c212162f3c0857988 Parents: 4b7f2c0 Author: Alex Harui <[email protected]> Authored: Mon Dec 7 21:56:21 2015 -0800 Committer: Alex Harui <[email protected]> Committed: Mon Dec 7 21:56:35 2015 -0800 ---------------------------------------------------------------------- frameworks/projects/Flat/as/src/FlatClasses.as | 15 +- .../as/src/org/apache/flex/flat/CheckBox.as | 116 ++++++- .../as/src/org/apache/flex/flat/DropDownList.as | 324 ++++++++++++++++++- .../as/src/org/apache/flex/flat/RadioButton.as | 200 +++++++++++- frameworks/projects/Flat/build.xml | 84 ++--- .../projects/Flat/compile-asjs-config.xml | 80 +++++ frameworks/projects/Flat/compile-config.xml | 8 +- frameworks/projects/Flat/flat-as-manifest.xml | 26 ++ frameworks/projects/Flat/flat-manifest.xml | 6 - .../html/supportClasses/DataItemRenderer.as | 2 +- 10 files changed, 807 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/as/src/FlatClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/as/src/FlatClasses.as b/frameworks/projects/Flat/as/src/FlatClasses.as index 161c114..29173ef 100644 --- a/frameworks/projects/Flat/as/src/FlatClasses.as +++ b/frameworks/projects/Flat/as/src/FlatClasses.as @@ -27,10 +27,17 @@ package */ internal class FlatClasses { - - import org.apache.flex.flat.beads.CSSScrollBarView; CSSScrollBarView; - import org.apache.flex.flat.beads.CSSScrollBarButtonView; CSSScrollBarButtonView; - import org.apache.flex.flat.supportClasses.DropDownListStringItemRenderer; DropDownListStringItemRenderer; + COMPILE::AS3 + { + import org.apache.flex.flat.beads.CSSScrollBarView; CSSScrollBarView; + import org.apache.flex.flat.beads.CSSScrollBarButtonView; CSSScrollBarButtonView; + import org.apache.flex.flat.supportClasses.DropDownListStringItemRenderer; DropDownListStringItemRenderer; + import org.apache.flex.flat.supportClasses.DropDownListList; DropDownListList; + import org.apache.flex.flat.beads.DropDownListView; DropDownListView; + import org.apache.flex.flat.beads.CheckboxCSSContentAndTextToggleButtonView; CheckboxCSSContentAndTextToggleButtonView; + import org.apache.flex.flat.beads.RadioCSSContentAndTextToggleButtonView; RadioCSSContentAndTextToggleButtonView; + + } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/as/src/org/apache/flex/flat/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/as/src/org/apache/flex/flat/CheckBox.as b/frameworks/projects/Flat/as/src/org/apache/flex/flat/CheckBox.as index b91a2c9..466e9b2 100644 --- a/frameworks/projects/Flat/as/src/org/apache/flex/flat/CheckBox.as +++ b/frameworks/projects/Flat/as/src/org/apache/flex/flat/CheckBox.as @@ -18,7 +18,16 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.flat { - import org.apache.flex.html.CheckBox; + COMPILE::AS3 + { + import org.apache.flex.html.CheckBox; + } + COMPILE::JS + { + import org.apache.flex.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + import org.apache.flex.events.Event; + } /** * The CheckBox class provides a FlatUI-like appearance for @@ -29,6 +38,7 @@ package org.apache.flex.flat * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ + COMPILE::AS3 public class CheckBox extends org.apache.flex.html.CheckBox { /** @@ -44,4 +54,108 @@ package org.apache.flex.flat super(); } } + + COMPILE::JS + public class CheckBox extends UIBase + { + + private var input:HTMLInputElement; + private var checkbox:HTMLSpanElement; + private var label:HTMLLabelElement; + private var textNode:Text; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLLabelElement + * @flexjsignorecoercion HTMLInputElement + * @flexjsignorecoercion HTMLSpanElement + * @flexjsignorecoercion Text + */ + override protected function createElement():WrappedHTMLElement + { + label = document.createElement('label') as HTMLLabelElement; + element = label as WrappedHTMLElement; + + input = document.createElement('input') as HTMLInputElement; + input.type = 'checkbox'; + input.className = 'checkbox-input'; + input.addEventListener('change', selectionChangeHandler, false); + label.appendChild(input); + + checkbox = document.createElement('span') as HTMLSpanElement; + checkbox.className = 'checkbox-icon'; + checkbox.addEventListener('mouseover', mouseOverHandler, false); + checkbox.addEventListener('mouseout', mouseOutHandler, false); + label.appendChild(checkbox); + + textNode = document.createTextNode('') as Text; + label.appendChild(textNode); + label.className = 'CheckBox'; + typeNames = 'CheckBox'; + + positioner = element; + positioner.style.position = 'relative'; + (input as WrappedHTMLElement).flexjs_wrapper = this; + (checkbox as WrappedHTMLElement).flexjs_wrapper = this; + element.flexjs_wrapper = this; + + return element; + }; + + + /** + */ + private function mouseOverHandler(event:Event):void + { + checkbox.className = 'checkbox-icon-hover'; + } + + /** + */ + private function mouseOutHandler(event:Event):void + { + if (input.checked) + checkbox.className = 'checkbox-icon-checked'; + else + checkbox.className = 'checkbox-icon'; + } + + + /** + */ + private function selectionChangeHandler(event:Event):void + { + if (input.checked) + checkbox.className = 'checkbox-icon-checked'; + else + checkbox.className = 'checkbox-icon'; + } + + + public function get text():String + { + return textNode.nodeValue; + } + + public function set text(value:String):void + { + textNode.nodeValue = value; + } + + public function get selected():Boolean + { + return input.checked; + } + + public function set selected(value:Boolean):void + { + input.checked = value; + if (value) + checkbox.className = 'checkbox-icon-checked'; + else + checkbox.className = 'checkbox-icon'; + } + + } + } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/as/src/org/apache/flex/flat/DropDownList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/as/src/org/apache/flex/flat/DropDownList.as b/frameworks/projects/Flat/as/src/org/apache/flex/flat/DropDownList.as index 30a22a5..265f2c7 100644 --- a/frameworks/projects/Flat/as/src/org/apache/flex/flat/DropDownList.as +++ b/frameworks/projects/Flat/as/src/org/apache/flex/flat/DropDownList.as @@ -18,7 +18,23 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.flat { - import org.apache.flex.html.DropDownList; + import org.apache.flex.core.UIBase; + + COMPILE::AS3 + { + import org.apache.flex.html.DropDownList; + } + COMPILE::JS + { + import goog.events; + import org.apache.flex.core.ListBase; + import org.apache.flex.core.WrappedHTMLElement; + import org.apache.flex.core.ISelectionModel; + import org.apache.flex.events.Event; + import org.apache.flex.html.beads.models.ArraySelectionModel; + import org.apache.flex.utils.CSSUtils; + } + /** * The DropDownList class provides a FlatUI-like appearance for * a DropDownList. @@ -28,6 +44,7 @@ package org.apache.flex.flat * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ + COMPILE::AS3 public class DropDownList extends org.apache.flex.html.DropDownList { /** @@ -43,4 +60,309 @@ package org.apache.flex.flat super(); } } + + COMPILE::JS + public class DropDownList extends ListBase + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function DropDownList() + { + super(); + model = new ArraySelectionModel(); + } + + private var label:HTMLSpanElement; + private var button:HTMLButtonElement; + private var caret:HTMLSpanElement; + private var menu:HTMLUListElement; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLButtonElement + * @flexjsignorecoercion HTMLDivElement + * @flexjsignorecoercion HTMLSpanElement + */ + override protected function createElement():WrappedHTMLElement + { + var button:HTMLButtonElement; + var outer:HTMLDivElement; + var caret:HTMLSpanElement; + + this.element = document.createElement('div') as WrappedHTMLElement; + outer = this.element as HTMLDivElement; + + this.button = button = document.createElement('button') as HTMLButtonElement; + button.className = 'dropdown-toggle-open-btn'; + if (this.className) + button.className += ' ' + this.className; + goog.events.listen(button, 'click', buttonClicked); + outer.appendChild(button); + + this.label = document.createElement('span') as HTMLSpanElement; + this.label.className = 'dropdown-label'; + button.appendChild(this.label); + this.caret = caret = document.createElement('span') as HTMLSpanElement; + button.appendChild(caret); + caret.className = 'dropdown-caret'; + + this.positioner = this.element; + this.positioner.style.position = 'relative'; + + // add a click handler so that a click outside of the combo box can + // dismiss the pop-up should it be visible. + goog.events.listen(document, 'click', dismissPopup); + + (button as WrappedHTMLElement).flexjs_wrapper = this; + this.element.flexjs_wrapper = this; + (this.label as WrappedHTMLElement).flexjs_wrapper = this; + (caret as WrappedHTMLElement).flexjs_wrapper = this; + + return this.element; + } + + + /** + * @param event The event. + * @flexjsignorecoercion org.apache.flex.core.UIBase + */ + private function selectChanged(event:Event):void + { + var select:UIBase; + + select = event.target as UIBase; + + this.selectedIndex = parseInt(select.id, 10); + + this.menu.parentNode.removeChild(this.menu); + this.menu = null; + + this.dispatchEvent('change'); + } + + + /** + * @param event The event. + */ + private function dismissPopup(event:Event = null):void + { + // remove the popup if it already exists + if (this.menu) + { + this.menu.parentNode.removeChild(this.menu); + this.menu = null; + } + } + + + /** + * @param event The event. + * @flexjsignorecoercion Array + * @flexjsignorecoercion HTMLButtonElement + * @flexjsignorecoercion HTMLUListElement + * @flexjsignorecoercion HTMLLIElement + * @flexjsignorecoercion HTMLAnchorElement + */ + private function buttonClicked(event:Event):void + { + var dp:Array; + var i:int; + var button:HTMLButtonElement; + var left:Number; + var n:int; + var opt:HTMLLIElement; + var opts:Array; + var pn:HTMLDivElement; + var select:HTMLUListElement; + var top:Number; + var width:Number; + + event.stopPropagation(); + + if (this.menu) + { + this.dismissPopup(); + return; + } + + button = this.element.childNodes.item(0) as HTMLButtonElement; + + pn = this.element as HTMLDivElement; + top = pn.offsetTop + button.offsetHeight; + left = pn.offsetLeft; + width = pn.offsetWidth; + + this.menu = select = document.createElement('ul') as HTMLUListElement; + var el:Element = element as Element; + var cv:Object = getComputedStyle(el); + select.style.width = cv.width; + goog.events.listen(select, 'click', selectChanged); + select.className = 'dropdown-menu'; + + var lf:String = this.labelField; + dp = dataProvider as Array; + n = dp.length; + for (i = 0; i < n; i++) { + opt = document.createElement('li') as HTMLLIElement; + opt.style.backgroundColor = 'transparent'; + var ir:HTMLAnchorElement = document.createElement('a') as HTMLAnchorElement; + if (lf) + ir.innerHTML = dp[i][lf]; + else + ir.innerHTML = dp[i]; + ir.id = i.toString(); + if (i == this.selectedIndex) + ir.className = 'dropdown-menu-item-renderer-selected'; + else + ir.className = 'dropdown-menu-item-renderer'; + opt.appendChild(ir); + select.appendChild(opt); + } + + this.element.appendChild(select); + }; + + + /** + */ + override public function addedToParent():void + { + super.addedToParent(); + var el:Element = button as Element; + var cv:Object = getComputedStyle(el); + var s:String = cv.paddingLeft; + var pl:Number = CSSUtils.toNumber(s); + s = cv.paddingRight; + var pr:Number = CSSUtils.toNumber(s); + s = cv.borderLeftWidth; + var bl:Number = CSSUtils.toNumber(s); + s = cv.borderRightWidth; + var br:Number = CSSUtils.toNumber(s); + var caretWidth:Number = this.caret.offsetWidth; + // 10 seems to factor spacing between span and extra FF padding? + var fluff:Number = pl + pr + bl + br + caretWidth + 1 + 10; + var labelWidth:Number = this.width - fluff; + var strWidth:String = labelWidth.toString(); + strWidth += 'px'; + this.label.style.width = strWidth; + } + + override public function set className(value:String):void + { + super.className = value; + if (this.button) { + this.button.className = this.typeNames ? + value + ' ' + 'dropdown-toggle-open-btn' + ' ' + this.typeNames : + value + ' ' + 'dropdown-toggle-open-btn'; + } + } + + /** + * The data set to be displayed. Usually a simple + * array of strings. A more complex component + * would allow more complex data and data sets. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get dataProvider():Object + { + return ISelectionModel(model).dataProvider; + } + + /** + * @private + * @flexjsignorecoercion HTMLOptionElement + * @flexjsignorecoercion HTMLSelectElement + */ + public function set dataProvider(value:Object):void + { + ISelectionModel(model).dataProvider = value; + } + + /** + * The name of field within the data used for display. Each item of the + * data should have a property with this name. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get labelField():String + { + return ISelectionModel(model).labelField; + } + public function set labelField(value:String):void + { + ISelectionModel(model).labelField = value; + } + + [Bindable("change")] + /** + * @copy org.apache.flex.core.ISelectionModel#selectedIndex + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedIndex():int + { + return ISelectionModel(model).selectedIndex; + } + + /** + * @private + * @flexjsignorecoercion HTMLSelectElement + * @flexjsignorecoercion String + */ + public function set selectedIndex(value:int):void + { + ISelectionModel(model).selectedIndex = value; + var lf:String = this.labelField; + if (lf) + this.label.innerHTML = this.selectedItem[lf] as String; + else + this.label.innerHTML = this.selectedItem as String; + } + + + [Bindable("change")] + /** + * @copy org.apache.flex.core.ISelectionModel#selectedItem + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get selectedItem():Object + { + return ISelectionModel(model).selectedItem; + } + + /** + * @private + * @flexjsignorecoercion HTMLSelectElement + * @flexjsignorecoercion String + */ + public function set selectedItem(value:Object):void + { + ISelectionModel(model).selectedItem = value; + var lf:String = this.labelField; + if (lf) + this.label.innerHTML = this.selectedItem[lf] as String; + else + this.label.innerHTML = this.selectedItem as String; + } + } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/as/src/org/apache/flex/flat/RadioButton.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/as/src/org/apache/flex/flat/RadioButton.as b/frameworks/projects/Flat/as/src/org/apache/flex/flat/RadioButton.as index ca02613..1294a25 100644 --- a/frameworks/projects/Flat/as/src/org/apache/flex/flat/RadioButton.as +++ b/frameworks/projects/Flat/as/src/org/apache/flex/flat/RadioButton.as @@ -18,7 +18,15 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.flex.flat { - import org.apache.flex.html.RadioButton; + COMPILE::AS3 + { + import org.apache.flex.html.RadioButton; + } + COMPILE::JS + { + import org.apache.flex.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + } /** * The RadioButton class provides a FlatUI-like appearance for @@ -29,6 +37,7 @@ package org.apache.flex.flat * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ + COMPILE::AS3 public class RadioButton extends org.apache.flex.html.RadioButton { /** @@ -44,4 +53,193 @@ package org.apache.flex.flat super(); } } + + COMPILE::JS + public class RadioButton extends UIBase + { + /** + * Provides unique name + */ + public static var radioCounter:int = 0; + + private var input:HTMLInputElement; + private var radio:HTMLSpanElement; + private var textNode:Text; + private var labelFor:HTMLLabelElement; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLInputElement + * @flexjsignorecoercion HTMLSpanElement + * @flexjsignorecoercion HTMLLabelElement + */ + override protected function createElement():WrappedHTMLElement + { + // hide this eleement + input = document.createElement('input') as HTMLInputElement; + input.type = 'radio'; + input.className = 'radio-input'; + input.id = '_radio_' + radioCounter++; + input.addEventListener('change', selectionChangeHandler, false); + + radio = document.createElement('span') as HTMLSpanElement; + radio.className = 'radio-icon'; + radio.addEventListener('mouseover', mouseOverHandler, false); + radio.addEventListener('mouseout', mouseOutHandler, false); + + textNode = document.createTextNode('radio button') as Text; + + labelFor = document.createElement('label') as HTMLLabelElement; + labelFor.appendChild(input); + labelFor.appendChild(radio); + labelFor.appendChild(textNode); + labelFor.style.position = 'relative'; + + element = labelFor as WrappedHTMLElement; + element.className = 'RadioButton'; + typeNames = 'RadioButton'; + + positioner = element; + positioner.style.position = 'relative'; + (input as WrappedHTMLElement).flexjs_wrapper = this; + (radio as WrappedHTMLElement).flexjs_wrapper = this; + element.flexjs_wrapper = this; + (textNode as WrappedHTMLElement).flexjs_wrapper = this; + + return element; + } + + + /** + * @param e The event object. + */ + private function mouseOverHandler(e:Event):void + { + radio.className = 'radio-icon-hover'; + } + + + /** + * @param e The event object. + */ + private function mouseOutHandler(e:Event):void + { + if (input.checked) + radio.className = 'radio-icon-checked'; + else + radio.className = 'radio-icon'; + } + + + /** + * @param e The event object. + */ + private function selectionChangeHandler(e:Event):void + { + // this should reset the icons in the non-selected radio + selectedValue = value; + } + + + override public function set id(value:String):void + { + super.id = value; + labelFor.id = value; + input.id = value; + } + + /** + * @flexjsignorecoercion String + */ + public function get groupName():String + { + return input.name as String; + } + + public function set groupName(value:String):void + { + input.name = value; + } + + public function get text():String + { + return textNode.nodeValue; + } + + public function set text(value:String):void + { + textNode.nodeValue = value; + } + + public function get selected():Boolean + { + return input.checked; + } + + public function set selected(value:Boolean):void + { + input.checked = value; + if (input.checked) + radio.className = 'radio-icon-checked'; + else + radio.className = 'radio-icon'; + } + + public function get value():String + { + return input.value; + } + + public function set value(value:String):void + { + input.value = value; + } + + /** + * @flexjsignorecoercion Array + * @flexjsignorecoercion String + */ + public function get selectedValue():Object + { + var buttons:Array; + var groupName:String; + var i:int; + var n:int; + + groupName = input.name as String; + buttons = document.getElementsByName(groupName) as Array; + n = buttons.length; + + for (i = 0; i < n; i++) { + if (buttons[i].checked) { + return buttons[i].value; + } + } + return null; + } + + /** + * @flexjsignorecoercion Array + * @flexjsignorecoercion String + */ + public function set selectedValue(value:Object):void + { + var buttons:Array; + var groupName:String; + var i:int; + var n:int; + + groupName = input.name as String; + buttons = document.getElementsByName(groupName) as Array; + n = buttons.length; + for (i = 0; i < n; i++) { + if (buttons[i].value === value) { + buttons[i].checked = true; + buttons[i].flexjs_wrapper.selected = true; + } + else + buttons[i].flexjs_wrapper.selected = false; + } + } + } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/build.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/build.xml b/frameworks/projects/Flat/build.xml index 54ceacd..04ad536 100644 --- a/frameworks/projects/Flat/build.xml +++ b/frameworks/projects/Flat/build.xml @@ -37,7 +37,7 @@ <target name="main" depends="clean,compile,test" description="Clean build of Flat.swc"> </target> - <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of Flat.swc"> + <target name="all" depends="clean,compile-asjs,compile-extern-swc,compile,copy-js,test" description="Full build of Flat.swc"> </target> <target name="test" unless="is.jenkins"> @@ -98,11 +98,13 @@ <load-config filename="compile-config.xml" /> <arg value="+playerglobal.version=${playerglobal.version}" /> <arg value="+env.AIR_HOME=${env.AIR_HOME}" /> + <arg value="-define=COMPILE::AS3,true" /> + <arg value="-define=COMPILE::JS,false" /> </compc> </target> - - <target name="compile-asjs" > - <echo message="Cross-compiling Flat/asjs"/> + + <target name="compile-asjs"> + <echo message="Cross-compiling Flat"/> <echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/> <java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" > <jvmarg value="-Xmx384m" /> @@ -117,45 +119,55 @@ <arg value="+playerglobal.version=${playerglobal.version}" /> <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" /> <arg value="+env.AIR_HOME=${env.AIR_HOME}" /> + <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" /> + <!-- this is not on external-library path otherwise goog.requires are not generated --> + <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" /> + <arg value="-define=COMPILE::AS3,false" /> + <arg value="-define=COMPILE::JS,true" /> </java> </target> - - <target name="lint-js" depends="gjslint, jshint, copy-js" /> + + <target name="compile-extern-swc" description="Compiles .as files into .swc used for cross-compiling other projects"> + <echo message="Compiling externs/Flat.swc"/> + <echo message="FLEX_HOME: ${FLEX_HOME}"/> + <echo message="FALCON_HOME: ${FALCON_HOME}"/> + <!-- make JS output folder now so include-file doesn't error --> + <mkdir dir="${FLEXJS_HOME}/frameworks/externs"/> + + <!-- Load the <compc> task. We can't do this at the <project> level --> + <!-- because targets that run before flexTasks.jar gets built would fail. --> + <taskdef resource="flexTasks.tasks" classpathref="lib.path"/> + <!-- + Link in the classes (and their dependencies) for the MXML tags + listed in this project's manifest.xml. + Also link the additional classes (and their dependencies) + listed in FlatClasses.as, + because these aren't referenced by the manifest classes. + Keep the standard metadata when compiling. + Include the appropriate CSS files and assets in the SWC. + Don't include any resources in the SWC. + Write a bundle list of referenced resource bundles + into the file bundles.properties in this directory. + --> + <compc fork="true" + output="${FLEXJS_HOME}/frameworks/externs/Flat.swc"> + <jvmarg line="${compc.jvm.args}"/> + <load-config filename="compile-asjs-config.xml" /> + <arg value="+playerglobal.version=${playerglobal.version}" /> + <arg value="+env.AIR_HOME=${env.AIR_HOME}" /> + <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" /> + <!-- this is not on external-library path otherwise goog.requires are not generated --> + <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" /> + <arg value="-define=COMPILE::AS3,false" /> + <arg value="-define=COMPILE::JS,true" /> + </compc> + </target> + <target name="copy-js" > <copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs"> - <fileset dir="${basedir}/js/src"> - <include name="**/**" /> - </fileset> <fileset dir="${basedir}/js/out"> <include name="**/**" /> </fileset> </copy> </target> - - <target name="gjslint" unless="no.lint"> - <echo>running gjslint</echo> - <exec executable="${gjslint}" dir="${basedir}" failonerror="true"> - <arg value="--strict" /> - <arg value="--disable" /> - <arg value="006,100,214,300" /> - <!-- 006: wrong indentation --> - <!-- 100: cannot have non-primitive value --> - <!-- 214: @fileoverview tag missing description --> - <!-- 300: missing newline at end of file --> - <arg value="--max_line_length" /> - <arg value="120" /> - <arg value="-r" /> - <arg value="${basedir}/js/src" /> - </exec> - </target> - - <target name="jshint" unless="no.lint"> - <echo>running jshint</echo> - <exec executable="${jshint}" dir="${basedir}" failonerror="true"> - <arg value="--config" /> - <arg value="${FLEX_HOME}/frameworks/js/jshint.properties" /> - <arg value="${basedir}/js/src" /> - </exec> - </target> - </project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/compile-asjs-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/compile-asjs-config.xml b/frameworks/projects/Flat/compile-asjs-config.xml new file mode 100644 index 0000000..a755d5c --- /dev/null +++ b/frameworks/projects/Flat/compile-asjs-config.xml @@ -0,0 +1,80 @@ +<!-- + + 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. + +--> +<flex-config> + + <compiler> + <accessible>false</accessible> + + <external-library-path> + </external-library-path> + + <mxml> + <children-as-data>true</children-as-data> + </mxml> + <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> + <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> + <binding-value-change-event-type>valueChange</binding-value-change-event-type> + + <keep-as3-metadata> + <name>Bindable</name> + <name>Managed</name> + <name>ChangeEvent</name> + <name>NonCommittingChangeEvent</name> + <name>Transient</name> + </keep-as3-metadata> + + <locale/> + + <library-path> + <!-- asjscompc won't 'link' these classes in, but will list their requires + if these swcs are on the external-library-path then their requires + will not be listed --> + <path-element>../../externs/Core.swc</path-element> + <path-element>../../externs/HTML.swc</path-element> + </library-path> + + <namespaces> + <namespace> + <uri>library://ns.apache.org/flexjs/flat</uri> + <manifest>flat-manifest.xml</manifest> + </namespace> + </namespaces> + + <source-path> + <path-element>as/src</path-element> + </source-path> + + <warn-no-constructor>false</warn-no-constructor> + </compiler> + + <include-file> + </include-file> + + <include-classes> + <class>FlatClasses</class> + </include-classes> + + <include-namespaces> + <uri>library://ns.apache.org/flexjs/flat</uri> + </include-namespaces> + + <target-player>${playerglobal.version}</target-player> + + +</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/compile-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/compile-config.xml b/frameworks/projects/Flat/compile-config.xml index b8a2f60..44c7c9f 100644 --- a/frameworks/projects/Flat/compile-config.xml +++ b/frameworks/projects/Flat/compile-config.xml @@ -53,6 +53,10 @@ <uri>library://ns.apache.org/flexjs/flat</uri> <manifest>flat-manifest.xml</manifest> </namespace> + <namespace> + <uri>library://ns.apache.org/flexjs/flat</uri> + <manifest>flat-as-manifest.xml</manifest> + </namespace> </namespaces> <source-path> @@ -71,10 +75,6 @@ <name>js/out/*</name> <path>js/out/*</path> </include-file> - <include-file> - <name>js/src/*</name> - <path>js/src/*</path> - </include-file> <include-classes> <class>FlatClasses</class> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/flat-as-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/flat-as-manifest.xml b/frameworks/projects/Flat/flat-as-manifest.xml new file mode 100644 index 0000000..6f12083 --- /dev/null +++ b/frameworks/projects/Flat/flat-as-manifest.xml @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<!-- + + 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. + +--> + + +<componentPackage> + + <component id="DropDownListList" class="org.apache.flex.flat.supportClasses.DropDownListList" /> + +</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/Flat/flat-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/Flat/flat-manifest.xml b/frameworks/projects/Flat/flat-manifest.xml index ac05bf7..77f5ffc 100644 --- a/frameworks/projects/Flat/flat-manifest.xml +++ b/frameworks/projects/Flat/flat-manifest.xml @@ -25,7 +25,6 @@ <component id="ButtonBar" class="org.apache.flex.html.ButtonBar" lookupOnly="true" /> <component id="CloseButton" class="org.apache.flex.html.CloseButton" lookupOnly="true" /> <component id="DropDownList" class="org.apache.flex.flat.DropDownList" /> - <component id="DropDownListList" class="org.apache.flex.flat.supportClasses.DropDownListList" /> <component id="Image" class="org.apache.flex.html.Image" lookupOnly="true" /> <component id="Label" class="org.apache.flex.html.Label" lookupOnly="true" /> <component id="MultilineLabel" class="org.apache.flex.html.MultilineLabel" lookupOnly="true" /> @@ -64,20 +63,15 @@ <component id="NumericStepper" class="org.apache.flex.html.NumericStepper" lookupOnly="true" /> <component id="TextFieldItemRenderer" class="org.apache.flex.html.supportClasses.TextFieldItemRenderer" lookupOnly="true" /> <component id="StringItemRenderer" class="org.apache.flex.html.supportClasses.StringItemRenderer" lookupOnly="true" /> - <component id="DropDownListView" class="org.apache.flex.flat.beads.DropDownListView" /> - <component id="DropDownListStringItemRenderer" class="org.apache.flex.flat.supportClasses.DropDownListStringItemRenderer" /> <component id="DataItemRenderer" class="org.apache.flex.html.supportClasses.DataItemRenderer" lookupOnly="true" /> <component id="ButtonBarButtonItemRenderer" class="org.apache.flex.html.supportClasses.ButtonBarButtonItemRenderer" lookupOnly="true" /> <component id="VScrollBar" class="org.apache.flex.html.supportClasses.VScrollBar" lookupOnly="true" /> - <component id="CSSScrollBarView" class="org.apache.flex.flat.beads.CSSScrollBarView" /> <component id="NumericOnlyTextInputBead" class="org.apache.flex.html.accessories.NumericOnlyTextInputBead" lookupOnly="true" /> <component id="PasswordInputBead" class="org.apache.flex.html.accessories.PasswordInputBead" lookupOnly="true" /> <component id="TextPromptBead" class="org.apache.flex.html.accessories.TextPromptBead" lookupOnly="true" /> <component id="HRule" class="org.apache.flex.html.HRule" lookupOnly="true" /> <component id="Spacer" class="org.apache.flex.html.Spacer" lookupOnly="true" /> <component id="ImageAndTextButtonView" class="org.apache.flex.html.beads.ImageAndTextButtonView" lookupOnly="true" /> - <component id="CheckboxCSSContentAndTextToggleButtonView" class="org.apache.flex.flat.beads.CheckboxCSSContentAndTextToggleButtonView" /> - <component id="RadioCSSContentAndTextToggleButtonView" class="org.apache.flex.flat.beads.RadioCSSContentAndTextToggleButtonView" /> <component id="ScrollingViewport" class="org.apache.flex.html.supportClasses.ScrollingViewport" lookupOnly="true" /> <component id="DataGrid" class="org.apache.flex.html.DataGrid" lookupOnly="true" /> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9634f9af/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataItemRenderer.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataItemRenderer.as index ae2612c..ac15dcf 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataItemRenderer.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataItemRenderer.as @@ -138,7 +138,7 @@ package org.apache.flex.html.supportClasses super.updateRenderer(); background.graphics.clear(); - background.graphics.beginFill(backgroundColor, (down||selected||hovered)?1:0); + background.graphics.beginFill(useColor, (down||selected||hovered)?1:0); background.graphics.drawRect(0, 0, width, height); background.graphics.endFill(); }
