Updated Branches: refs/heads/develop 2ecfb7b39 -> 104d36f0c
Fixed issues with events and added HTML5 test app to FlexJS examples. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/104d36f0 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/104d36f0 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/104d36f0 Branch: refs/heads/develop Commit: 104d36f0ced6f3699208f6747ca287e9da5254d0 Parents: 2ecfb7b Author: Peter Ent <[email protected]> Authored: Thu Apr 4 08:57:48 2013 -0400 Committer: Peter Ent <[email protected]> Committed: Thu Apr 4 08:57:48 2013 -0400 ---------------------------------------------------------------------- .../FlexJSTest_HTML5/src/FlexJSTest_again.mxml | 51 ++++++ examples/FlexJSTest_HTML5/src/MyInitialView.mxml | 126 +++++++++++++++ .../src/StockDataJSONItemConverter.as | 36 ++++ .../src/controllers/MyController.as | 92 +++++++++++ examples/FlexJSTest_HTML5/src/models/MyModel.as | 59 +++++++ examples/FlexJSTest_again/src/MyInitialView.mxml | 97 +++++++---- .../src/controllers/MyController.as | 74 +++++---- examples/FlexJSTest_again/src/models/MyModel.as | 6 + .../apache/flex/html/staticControls/ComboBox.as | 9 + .../apache/flex/html/staticControls/ComboBox.js | 3 + .../apache/flex/html5/staticControls/ComboBox.js | 3 + 11 files changed, 490 insertions(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_HTML5/src/FlexJSTest_again.mxml ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_HTML5/src/FlexJSTest_again.mxml b/examples/FlexJSTest_HTML5/src/FlexJSTest_again.mxml new file mode 100644 index 0000000..b86b828 --- /dev/null +++ b/examples/FlexJSTest_HTML5/src/FlexJSTest_again.mxml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +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. + +--> +<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:local="*" + xmlns:basic="library://ns.apache.org/flexjs/basic" + xmlns:models="models.*" + xmlns:controllers="controllers.*" + initialize="MyModel(model).labelText='Hello HTML5'" + > + <basic:valuesImpl> + <basic:SimpleCSSValuesImpl /> + </basic:valuesImpl> + <basic:initialView> + <local:MyInitialView /> + </basic:initialView> + <basic:model> + <models:MyModel /> + </basic:model> + <basic:controller> + <controllers:MyController /> + </basic:controller> + <basic:beads> + <basic:HTTPService id="service"> + <basic:LazyCollection id="collection"> + <basic:inputParser> + <basic:JSONInputParser /> + </basic:inputParser> + <basic:itemConverter> + <local:StockDataJSONItemConverter /> + </basic:itemConverter> + </basic:LazyCollection> + </basic:HTTPService> + </basic:beads> +</basic:Application> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_HTML5/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_HTML5/src/MyInitialView.mxml b/examples/FlexJSTest_HTML5/src/MyInitialView.mxml new file mode 100644 index 0000000..ac0d891 --- /dev/null +++ b/examples/FlexJSTest_HTML5/src/MyInitialView.mxml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +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. + +--> +<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:basic="library://ns.apache.org/flexjs/basic" + xmlns:html5="library://ns.apache.org/flexjs/html5" + > + <fx:Script> + <![CDATA[ + import org.apache.flex.events.CustomEvent; + import org.apache.flex.events.Event; + import org.apache.flex.utils.Timer; + + private var timer:org.apache.flex.utils.Timer; + + public function get symbol():String + { + return list.selectedItem as String; + } + + public function get city():String + { + return cityList.selectedItem as String; + } + + public function get inputText():String + { + return input.text; + } + + public function get comboBoxValue():String + { + return String(comboBox.selectedItem); + } + + public function startTimer():void + { + timer = new org.apache.flex.utils.Timer(1000); + timer.addEventListener('timer', timerHandler); + timer.start() + } + + public function timerHandler(event:org.apache.flex.events.Event):void + { + timerLabel.text = timer.currentCount.toString(); + } + ]]> + </fx:Script> + <html5:Label id="lbl" x="100" y="25" > + <html5:beads> + <basic:SimpleBinding eventName="labelTextChanged" + sourceID="applicationModel" + sourcePropertyName="labelText" + destinationPropertyName="text" /> + </html5:beads> + </html5:Label> + <html5:TextButton text="Start Timer" x="100" y="75" click="startTimer()" /> + <html5:TextButton text="Stop Timer" x="100" y="100" click="timer.removeEventListener('timer', timerHandler);timer.stop()" /> + <html5:Label id="timerLabel" x="100" y="125" /> + + <html5:List id="cityList" x="200" y="75" width="100" height="75" change="dispatchEvent(new CustomEvent('cityListChanged'))"> + <html5:beads> + <basic:ConstantBinding + sourceID="applicationModel" + sourcePropertyName="cities" + destinationPropertyName="dataProvider" /> + </html5:beads> + </html5:List> + + <html5:TextArea x="320" y="25" width="150" height="75"> + <html5:beads> + <basic:SimpleBinding eventName="labelTextChanged" + sourceID="applicationModel" + sourcePropertyName="labelText" + destinationPropertyName="text" /> + </html5:beads> + </html5:TextArea> + <html5:TextInput id="input" x="320" y="110" /> + <html5:TextButton text="Transfer" x="320" y="138" click="dispatchEvent(new CustomEvent('transferClicked'))" /> + + <html5:CheckBox id="checkbox" x="320" y="170" text="Check Me" /> + + <html5:RadioButton groupName="group1" text="Apples" value="0" x="100" y="150" /> + <html5:RadioButton groupName="group1" text="Oranges" value="1" x="100" y="170" selected="true" /> + <html5:RadioButton groupName="group1" text="Grapes" value="2" x="100" y="190" /> + + <html5:RadioButton groupName="group2" text="Red" value="red" x="100" y="250" selected="true" /> + <html5:RadioButton groupName="group2" text="Green" value="green" x="100" y="270" /> + <html5:RadioButton groupName="group2" text="Blue" value="blue" x="100" y="290" /> + + <html5:DropDownList id="list" x="200" y="200" width="100" height="24" change="dispatchEvent(new CustomEvent('listChanged'))"> + <html5:beads> + <basic:ConstantBinding + sourceID="applicationModel" + sourcePropertyName="strings" + destinationPropertyName="dataProvider" /> + </html5:beads> + </html5:DropDownList> + <html5:TextButton text="OK" x="200" y="230" click="dispatchEvent(new CustomEvent('buttonClicked'))" /> + + <html5:ComboBox id="comboBox" x="320" y="200" width="100" change="dispatchEvent(new CustomEvent('comboBoxChanged'))"> + <html5:beads> + <basic:ConstantBinding + sourceID="applicationModel" + sourcePropertyName="cities" + destinationPropertyName="dataProvider" /> + </html5:beads> + </html5:ComboBox> + +</basic:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_HTML5/src/StockDataJSONItemConverter.as ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_HTML5/src/StockDataJSONItemConverter.as b/examples/FlexJSTest_HTML5/src/StockDataJSONItemConverter.as new file mode 100644 index 0000000..a030fe0 --- /dev/null +++ b/examples/FlexJSTest_HTML5/src/StockDataJSONItemConverter.as @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + import org.apache.flex.net.JSONItemConverter; + + public class StockDataJSONItemConverter extends JSONItemConverter + { + public function StockDataJSONItemConverter() + { + super(); + } + + override public function convertItem(data:String):Object + { + var obj:Object = super.convertItem(data); + return obj.query.results.quote.Ask; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_HTML5/src/controllers/MyController.as ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_HTML5/src/controllers/MyController.as b/examples/FlexJSTest_HTML5/src/controllers/MyController.as new file mode 100644 index 0000000..8120572 --- /dev/null +++ b/examples/FlexJSTest_HTML5/src/controllers/MyController.as @@ -0,0 +1,92 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 controllers +{ + import org.apache.flex.core.Application; + import org.apache.flex.core.IDocument; + import org.apache.flex.events.Event; + + + import models.MyModel; + + public class MyController implements IDocument + { + public function MyController(app:Application = null) + { + if (app) + { + this.app = app as FlexJSTest_again; + app.addEventListener("viewChanged", viewChangeHandler); + } + } + + private var queryBegin:String = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22"; + private var queryEnd:String = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json"; + private var app:FlexJSTest_again; + + private function viewChangeHandler(event:Event):void + { + app.initialView.addEventListener("buttonClicked", buttonClickHandler); + app.initialView.addEventListener("listChanged", listChangedHandler); + app.initialView.addEventListener("cityListChanged", cityListChangeHandler); + app.initialView.addEventListener("transferClicked", transferClickHandler); + app.initialView.addEventListener("comboBoxChanged", comboBoxChangeHandler); + } + + private function buttonClickHandler(event:Event):void + { + var sym:String = MyInitialView(app.initialView).symbol; + app.service.url = queryBegin + sym + queryEnd; + app.service.send(); + app.service.addEventListener("complete", completeHandler); + } + + private function completeHandler(event:Event):void + { + MyModel(app.model).labelText = app.collection.getItemAt(0) as String; + } + + private function listChangedHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).symbol; + } + + private function cityListChangeHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).city; + } + + private function transferClickHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).inputText; + } + + private function comboBoxChangeHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).comboBoxValue; + } + + public function setDocument(document:Object, id:String = null):void + { + this.app = document as FlexJSTest_again; + app.addEventListener("viewChanged", viewChangeHandler); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_HTML5/src/models/MyModel.as ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_HTML5/src/models/MyModel.as b/examples/FlexJSTest_HTML5/src/models/MyModel.as new file mode 100644 index 0000000..1dc23e6 --- /dev/null +++ b/examples/FlexJSTest_HTML5/src/models/MyModel.as @@ -0,0 +1,59 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 models +{ + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + public class MyModel extends EventDispatcher + { + public function MyModel() + { + } + + private var _labelText:String; + + public function get labelText():String + { + return _labelText; + } + + public function set labelText(value:String):void + { + if (value != _labelText) + { + _labelText = value; + dispatchEvent(new Event("labelTextChanged")); + } + } + + private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"]; + public function get strings():Array + { + return _strings; + } + + private var _cities:Array = ["London", "Miami", "Paris", "Sydney", "Tokyo"]; + public function get cities():Array + { + return _cities; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_again/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_again/src/MyInitialView.mxml b/examples/FlexJSTest_again/src/MyInitialView.mxml index 4c89662..69fdf71 100644 --- a/examples/FlexJSTest_again/src/MyInitialView.mxml +++ b/examples/FlexJSTest_again/src/MyInitialView.mxml @@ -28,15 +28,25 @@ limitations under the License. private var timer:org.apache.flex.utils.Timer; - public function get symbol():String - { - return list.selectedItem as String; - } - - public function get inputText():String - { - return input.text; - } + public function get symbol():String + { + return list.selectedItem as String; + } + + public function get city():String + { + return cityList.selectedItem as String; + } + + public function get inputText():String + { + return input.text; + } + + public function get comboBoxValue():String + { + return String(comboBox.selectedItem); + } public function startTimer():void { @@ -59,40 +69,57 @@ limitations under the License. destinationPropertyName="text" /> </basic:beads> </basic:Label> - <basic:TextButton text="OK" x="100" y="50" click="dispatchEvent(new CustomEvent('buttonClicked'))" /> - <basic:DropDownList id="list" x="200" y="25" width="100" height="24" change="dispatchEvent(new CustomEvent('listChanged'))"> - <basic:beads> - <basic:ConstantBinding - sourceID="applicationModel" - sourcePropertyName="strings" - destinationPropertyName="dataProvider" /> - </basic:beads> - </basic:DropDownList> <basic:TextButton text="Start Timer" x="100" y="75" click="startTimer()" /> <basic:TextButton text="Stop Timer" x="100" y="100" click="timer.removeEventListener('timer', timerHandler);timer.stop()" /> <basic:Label id="timerLabel" x="100" y="125" /> - - - <basic:TextArea x="320" y="25" width="150" height="75"> + + <basic:List id="cityList" x="200" y="75" width="100" height="75" change="dispatchEvent(new CustomEvent('cityListChanged'))"> + <basic:beads> + <basic:ConstantBinding + sourceID="applicationModel" + sourcePropertyName="cities" + destinationPropertyName="dataProvider" /> + </basic:beads> + </basic:List> + + <basic:TextArea x="320" y="25" width="150" height="75"> <basic:beads> <basic:SimpleBinding eventName="labelTextChanged" sourceID="applicationModel" sourcePropertyName="labelText" destinationPropertyName="text" /> </basic:beads> - </basic:TextArea> - <basic:TextInput id="input" x="320" y="110" /> - <basic:TextButton text="Transfer" x="320" y="138" click="dispatchEvent(new CustomEvent('transferClicked'))" /> - - <basic:CheckBox id="checkbox" x="320" y="170" text="Check Me" /> - - <basic:RadioButton groupName="group1" text="Apples" value="0" x="100" y="150" /> - <basic:RadioButton groupName="group1" text="Oranges" value="1" x="100" y="170" selected="true" /> - <basic:RadioButton groupName="group1" text="Grapes" value="2" x="100" y="190" /> - - <basic:RadioButton groupName="group2" text="Red" value="red" x="100" y="250" selected="true" /> - <basic:RadioButton groupName="group2" text="Green" value="green" x="100" y="270" /> - <basic:RadioButton groupName="group2" text="Blue" value="blue" x="100" y="290" /> - + </basic:TextArea> + <basic:TextInput id="input" x="320" y="110" /> + <basic:TextButton text="Transfer" x="320" y="138" click="dispatchEvent(new CustomEvent('transferClicked'))" /> + + <basic:CheckBox id="checkbox" x="320" y="170" text="Check Me" /> + + <basic:RadioButton groupName="group1" text="Apples" value="0" x="100" y="150" /> + <basic:RadioButton groupName="group1" text="Oranges" value="1" x="100" y="170" selected="true" /> + <basic:RadioButton groupName="group1" text="Grapes" value="2" x="100" y="190" /> + + <basic:RadioButton groupName="group2" text="Red" value="red" x="100" y="250" selected="true" /> + <basic:RadioButton groupName="group2" text="Green" value="green" x="100" y="270" /> + <basic:RadioButton groupName="group2" text="Blue" value="blue" x="100" y="290" /> + + <basic:DropDownList id="list" x="200" y="200" width="100" height="24" change="dispatchEvent(new CustomEvent('listChanged'))"> + <basic:beads> + <basic:ConstantBinding + sourceID="applicationModel" + sourcePropertyName="strings" + destinationPropertyName="dataProvider" /> + </basic:beads> + </basic:DropDownList> + <basic:TextButton text="OK" x="200" y="230" click="dispatchEvent(new CustomEvent('buttonClicked'))" /> + + <basic:ComboBox id="comboBox" x="320" y="200" width="100" change="dispatchEvent(new CustomEvent('comboBoxChanged'))"> + <basic:beads> + <basic:ConstantBinding + sourceID="applicationModel" + sourcePropertyName="cities" + destinationPropertyName="dataProvider" /> + </basic:beads> + </basic:ComboBox> </basic:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_again/src/controllers/MyController.as ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_again/src/controllers/MyController.as b/examples/FlexJSTest_again/src/controllers/MyController.as index 8303aa7..d7b0547 100644 --- a/examples/FlexJSTest_again/src/controllers/MyController.as +++ b/examples/FlexJSTest_again/src/controllers/MyController.as @@ -22,9 +22,9 @@ package controllers import org.apache.flex.core.IDocument; import org.apache.flex.events.Event; - - import models.MyModel; - + + import models.MyModel; + public class MyController implements IDocument { public function MyController(app:Application = null) @@ -36,45 +36,57 @@ package controllers } } - private var queryBegin:String = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22"; - private var queryEnd:String = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json"; + private var queryBegin:String = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22"; + private var queryEnd:String = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json"; private var app:FlexJSTest_again; private function viewChangeHandler(event:Event):void { app.initialView.addEventListener("buttonClicked", buttonClickHandler); - app.initialView.addEventListener("listChanged", listChangedHandler); - app.initialView.addEventListener("transferClicked", transferClickHandler); + app.initialView.addEventListener("listChanged", listChangedHandler); + app.initialView.addEventListener("cityListChanged", cityListChangeHandler); + app.initialView.addEventListener("transferClicked", transferClickHandler); + app.initialView.addEventListener("comboBoxChanged", comboBoxChangeHandler); + } + + private function buttonClickHandler(event:Event):void + { + var sym:String = MyInitialView(app.initialView).symbol; + app.service.url = queryBegin + sym + queryEnd; + app.service.send(); + app.service.addEventListener("complete", completeHandler); + } + + private function completeHandler(event:Event):void + { + MyModel(app.model).labelText = app.collection.getItemAt(0) as String; + } + + private function listChangedHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).symbol; + } + + private function cityListChangeHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).city; + } + + private function transferClickHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).inputText; + } + + private function comboBoxChangeHandler(event:Event):void + { + MyModel(app.model).labelText = MyInitialView(app.initialView).comboBoxValue; } - private function buttonClickHandler(event:Event):void - { - var sym:String = MyInitialView(app.initialView).symbol; - app.service.url = queryBegin + sym + queryEnd; - app.service.send(); - app.service.addEventListener("complete", completeHandler); - } - - private function completeHandler(event:Event):void - { - MyModel(app.model).labelText = app.collection.getItemAt(0) as String; - } - - private function listChangedHandler(event:Event):void - { - MyModel(app.model).labelText = MyInitialView(app.initialView).symbol; - } - - private function transferClickHandler(event:Event):void - { - MyModel(app.model).labelText = MyInitialView(app.initialView).inputText; - } - public function setDocument(document:Object, id:String = null):void { this.app = document as FlexJSTest_again; app.addEventListener("viewChanged", viewChangeHandler); } - + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/examples/FlexJSTest_again/src/models/MyModel.as ---------------------------------------------------------------------- diff --git a/examples/FlexJSTest_again/src/models/MyModel.as b/examples/FlexJSTest_again/src/models/MyModel.as index bc8a7d0..1dc23e6 100644 --- a/examples/FlexJSTest_again/src/models/MyModel.as +++ b/examples/FlexJSTest_again/src/models/MyModel.as @@ -48,6 +48,12 @@ package models { return _strings; } + + private var _cities:Array = ["London", "Miami", "Paris", "Sydney", "Tokyo"]; + public function get cities():Array + { + return _cities; + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/frameworks/as/src/org/apache/flex/html/staticControls/ComboBox.as ---------------------------------------------------------------------- diff --git a/frameworks/as/src/org/apache/flex/html/staticControls/ComboBox.as b/frameworks/as/src/org/apache/flex/html/staticControls/ComboBox.as index 40920a8..cad90e4 100644 --- a/frameworks/as/src/org/apache/flex/html/staticControls/ComboBox.as +++ b/frameworks/as/src/org/apache/flex/html/staticControls/ComboBox.as @@ -53,6 +53,15 @@ package org.apache.flex.html.staticControls IComboBoxModel(model).selectedIndex = value; } + public function get selectedItem():Object + { + return IComboBoxModel(model).selectedItem; + } + public function set selectedItem(value:Object):void + { + IComboBoxModel(model).selectedItem = value; + } + override public function initModel():void { if (getBeadByType(IComboBoxModel) == null) http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js index 880a0bc..6a5472c 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/ComboBox.js @@ -89,6 +89,9 @@ function(event) { this.popup.parentNode.removeChild(this.popup); this.popup = null; + + evt = this.createEvent('change'); + this.dispatchEvent(evt); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/104d36f0/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/ComboBox.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/ComboBox.js b/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/ComboBox.js index 889a9db..39daf06 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/ComboBox.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/html5/staticControls/ComboBox.js @@ -89,6 +89,9 @@ function(event) { this.popup.parentNode.removeChild(this.popup); this.popup = null; + + var evt = this.createEvent('change'); + this.dispatchEvent(evt); };
