Repository: flex-asjs Updated Branches: refs/heads/develop 4ba97a19f -> 002449f92
remove these examples. They are included in DataBindingTest Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b7fba067 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b7fba067 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b7fba067 Branch: refs/heads/develop Commit: b7fba067eb4beb0fdfe51fb9262be9788ab6b349 Parents: 4ba97a1 Author: Alex Harui <[email protected]> Authored: Fri Aug 21 09:27:59 2015 -0700 Committer: Alex Harui <[email protected]> Committed: Fri Aug 21 09:27:59 2015 -0700 ---------------------------------------------------------------------- examples/StatesTest/build.xml | 45 ----- examples/StatesTest/src/MyInitialView.mxml | 164 ------------------ examples/StatesTest/src/README.txt | 47 ------ examples/StatesTest/src/StatesTest.mxml | 52 ------ .../src/StockDataJSONItemConverter.as | 40 ----- .../StatesTest/src/controllers/MyController.as | 81 --------- examples/StatesTest/src/models/MyModel.as | 126 -------------- examples/StockQuote/build.xml | 44 ----- examples/StockQuote/src/MyInitialView.mxml | 169 ------------------- examples/StockQuote/src/README.txt | 49 ------ .../src/StockDataJSONItemConverter.as | 40 ----- examples/StockQuote/src/StockQuote.mxml | 52 ------ .../StockQuote/src/controllers/MyController.as | 81 --------- examples/StockQuote/src/models/MyModel.as | 126 -------------- 14 files changed, 1116 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/build.xml ---------------------------------------------------------------------- diff --git a/examples/StatesTest/build.xml b/examples/StatesTest/build.xml deleted file mode 100644 index 142af2b..0000000 --- a/examples/StatesTest/build.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?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. - ---> - - -<project name="statestest" default="main" basedir="."> - <property name="FLEXJS_HOME" location="../.."/> - <property name="example" value="StatesTest" /> - - <property file="${FLEXJS_HOME}/env.properties"/> - <property environment="env"/> - <property file="${FLEXJS_HOME}/build.properties"/> - <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> - <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> - <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/> - <property name="GOOG_HOME" value="${env.GOOG_HOME}"/> - - <include file="${basedir}/../build_example.xml" /> - - <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}"> - </target> - - <target name="clean"> - <delete dir="${basedir}/bin" failonerror="false" /> - <delete dir="${basedir}/bin-debug" failonerror="false" /> - <delete dir="${basedir}/bin-release" failonerror="false" /> - </target> - -</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/examples/StatesTest/src/MyInitialView.mxml b/examples/StatesTest/src/MyInitialView.mxml deleted file mode 100644 index 31e881d..0000000 --- a/examples/StatesTest/src/MyInitialView.mxml +++ /dev/null @@ -1,164 +0,0 @@ -<?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. - ---> -<js:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009" - xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:core="library://ns.apache.org/flexjs/core" - initComplete="initControls()"> - <fx:Script> - <![CDATA[ - import models.MyModel; - - import org.apache.flex.events.CustomEvent; - - private var _symbol:String; - - public function get symbol():String - { - return _symbol; - } - - public function get requestedField():String - { - return radio1.selectedValue as String; - } - - private function radioChanged(e:org.apache.flex.events.Event):void - { - dispatchEvent(new CustomEvent("radioClicked")); - field.text = RadioButton(e.target).text; - } - - private function initControls():void - { - list.selectedItem = MyModel(applicationModel).stockSymbol; - radio1.selectedValue = MyModel(applicationModel).requestedField; - if (radio1.selected) - field.text = radio1.text; - else if (radio2.selected) - field.text = radio2.text; - else if (radio3.selected) - field.text = radio3.text; - else if (radio4.selected) - field.text = radio4.text; - - } - - private function setState():void - { - currentState = showAllData.selected ? "showAll" : "hideAll"; - } - ]]> - </fx:Script> - <fx:Style> - @namespace basic "library://ns.apache.org/flexjs/basic"; - - .output { - font-size: 20px; - } - - .topContainer { - padding: 10px; - - } - .leftSide { - vertical-align: top; - margin-right: 10px; - } - - .rightSide { - vertical-align: top; - margin-left: 10px; - padding-left: 10px; - } - - .quoteButton { - margin-top: 10px; - margin-bottom: 10px; - } - </fx:Style> - <js:states> - <js:State name="hideAll" /> - <js:State name="showAll" /> - </js:states> - <js:Container x="0" y="0" className="topContainer" > - <js:beads> - <js:VerticalLayout /> - </js:beads> - <js:Label width="300" text="Enter Stock Symbol or choose from list:" /> - <js:Container> - <js:beads> - <js:HorizontalLayout /> - </js:beads> - <js:Container className="leftSide"> - <js:beads> - <js:VerticalLayout /> - </js:beads> - <js:TextInput id="symbolTI" > - <js:beads> - <js:SimpleBinding eventName="stockSymbolChanged" - sourceID="applicationModel" - sourcePropertyName="stockSymbol" - destinationPropertyName="text" /> - </js:beads> - </js:TextInput> - <js:TextButton text="Get Quote" className="quoteButton" - click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" /> - <js:Label id="field" /> - <js:Label className="output" height="24"> - <js:beads> - <js:SimpleBinding eventName="responseTextChanged" - sourceID="applicationModel" - sourcePropertyName="responseText" - destinationPropertyName="text" /> - </js:beads> - </js:Label> - </js:Container> - <js:Container className="rightSide"> - <js:beads> - <js:VerticalLayout /> - </js:beads> - <js:DropDownList id="list" width="100" height="17" - change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))"> - <js:beads> - <js:ConstantBinding - sourceID="applicationModel" - sourcePropertyName="strings" - destinationPropertyName="dataProvider" /> - </js:beads> - </js:DropDownList> - <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/> - <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/> - <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/> - <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/> - <js:CheckBox id="showAllData" text="Show All Data" change="setState()" /> - </js:Container> - </js:Container> - <js:Label width="300" text.showAll="110" includeIn="showAll" /> - <js:TextArea id="ta" width="300" height="100" height.showAll="110" - includeIn="showAll"> - <js:beads> - <js:SimpleBinding eventName="responseDataChanged" - sourceID="applicationModel" - sourcePropertyName="allData" - destinationPropertyName="text" /> - </js:beads> - </js:TextArea> - </js:Container> -</js:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/README.txt ---------------------------------------------------------------------- diff --git a/examples/StatesTest/src/README.txt b/examples/StatesTest/src/README.txt deleted file mode 100644 index 9ea5dc1..0000000 --- a/examples/StatesTest/src/README.txt +++ /dev/null @@ -1,47 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// - -DESCRIPTION - -The StatesTest sample demonstrates how to use Flex states to alter the visual -display. This application is based on the DataBindingTest. - -This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX) -into JavaScript and HTML and run without Flash. - -In this example, states are used to display some or all of the stock quote details. - -COMPONENTS and BEADS - -- Container -- DropDownList -- Label -- RadioButton -- TextArea -- TextButton -- TextInput - -- NonVirtualVerticalLayout -- NumericOnlyTextInputBead -- VerticalColumnLayout - -NOTES - -The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings -should be addressed in future releases of the Falcon JX compiler. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/StatesTest.mxml ---------------------------------------------------------------------- diff --git a/examples/StatesTest/src/StatesTest.mxml b/examples/StatesTest/src/StatesTest.mxml deleted file mode 100644 index cf5e9e6..0000000 --- a/examples/StatesTest/src/StatesTest.mxml +++ /dev/null @@ -1,52 +0,0 @@ -<?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. - ---> -<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009" - xmlns:local="*" - xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:models="models.*" - xmlns:controllers="controllers.*" - initialize="MyModel(model).stockSymbol='ADBE'" - > - <js:valuesImpl> - <js:SimpleCSSValuesImpl /> - </js:valuesImpl> - <js:initialView> - <local:MyInitialView /> - </js:initialView> - <js:model> - <models:MyModel /> - </js:model> - <js:controller> - <controllers:MyController /> - </js:controller> - <js:beads> - <js:HTTPService id="service"> - <js:LazyCollection id="collection"> - <js:inputParser> - <js:JSONInputParser /> - </js:inputParser> - <js:itemConverter> - <local:StockDataJSONItemConverter /> - </js:itemConverter> - </js:LazyCollection> - </js:HTTPService> - <js:ViewSourceContextMenuOption /> - </js:beads> -</js:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/StockDataJSONItemConverter.as ---------------------------------------------------------------------- diff --git a/examples/StatesTest/src/StockDataJSONItemConverter.as b/examples/StatesTest/src/StockDataJSONItemConverter.as deleted file mode 100644 index a39606b..0000000 --- a/examples/StatesTest/src/StockDataJSONItemConverter.as +++ /dev/null @@ -1,40 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// -package -{ - import org.apache.flex.collections.converters.JSONItemConverter; - - public class StockDataJSONItemConverter extends JSONItemConverter - { - public function StockDataJSONItemConverter() - { - super(); - } - - override public function convertItem(data:String):Object - { - var obj:Object = super.convertItem(data); - if (obj["query"]["count"] == 0) - return "No Data"; - - obj = obj["query"]["results"]["quote"]; - return obj; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/controllers/MyController.as ---------------------------------------------------------------------- diff --git a/examples/StatesTest/src/controllers/MyController.as b/examples/StatesTest/src/controllers/MyController.as deleted file mode 100644 index d6cae7d..0000000 --- a/examples/StatesTest/src/controllers/MyController.as +++ /dev/null @@ -1,81 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// -package controllers -{ - import org.apache.flex.events.Event; - - import org.apache.flex.core.Application; - import org.apache.flex.core.IDocument; - - import models.MyModel; - - public class MyController implements IDocument - { - public function MyController(app:Application = null) - { - if (app) - { - this.app = app as StatesTest; - 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:StatesTest; - - private function viewChangeHandler(event:Event):void - { - app.initialView.addEventListener("buttonClicked", buttonClickHandler); - app.initialView.addEventListener("radioClicked", radioClickHandler); - app.initialView.addEventListener("listChanged", listChangedHandler); - } - - 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 radioClickHandler(event:Event):void - { - var field:String = MyInitialView(app.initialView).requestedField; - MyModel(app.model).requestedField = field; - } - - private function completeHandler(event:Event):void - { - MyModel(app.model).responseData = app.collection.getItemAt(0); - } - - private function listChangedHandler(event:Event):void - { - MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol; - } - - public function setDocument(document:Object, id:String = null):void - { - this.app = document as StatesTest; - app.addEventListener("viewChanged", viewChangeHandler); - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StatesTest/src/models/MyModel.as ---------------------------------------------------------------------- diff --git a/examples/StatesTest/src/models/MyModel.as b/examples/StatesTest/src/models/MyModel.as deleted file mode 100644 index c724f4b..0000000 --- a/examples/StatesTest/src/models/MyModel.as +++ /dev/null @@ -1,126 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// -package models -{ - import org.apache.flex.events.Event; - import org.apache.flex.events.EventDispatcher; - - public class MyModel extends EventDispatcher - { - public function MyModel() - { - } - - private var _requestedField:String = "Ask"; - - [Bindable("requestedFieldChanged")] - public function get requestedField():String - { - return _requestedField; - } - - public function set requestedField(value:String):void - { - if (value != _requestedField) - { - _requestedField = value; - dispatchEvent(new Event("requestedFieldChanged")); - if (_responseData) - dispatchEvent(new Event("responseTextChanged")); - } - } - - private var _responseText:String; - - [Bindable("responseTextChanged")] - public function get responseText():String - { - if (_responseData == null) - return ""; - if (_responseData == "No Data") - return _responseData as String; - var s:String = _responseData[_requestedField]; - if (s == null) - { - if (_requestedField == "Ask") - s = _responseData["Bid"]; - } - return s; - } - - private var _responseData:Object; - - [Bindable("responseDataChanged")] - public function get responseData():Object - { - return _responseData; - } - - public function set responseData(value:Object):void - { - if (value != _responseData) - { - _responseData = value; - _allData = ""; - dispatchEvent(new Event("responseDataChanged")); - dispatchEvent(new Event("responseTextChanged")); - } - } - - private var _allData:String = ""; - - [Bindable("responseDataChanged")] - public function get allData():String - { - if (_allData == "" && _responseData != null) - { - for (var p:String in _responseData) - { - _allData += p + ": " + _responseData[p] + "\n"; - } - } - return _allData; - } - - - private var _stockSymbol:String; - - [Bindable("stockSymbolChanged")] - public function get stockSymbol():String - { - return _stockSymbol; - } - - public function set stockSymbol(value:String):void - { - if (value != _stockSymbol) - { - _stockSymbol = value; - dispatchEvent(new Event("stockSymbolChanged")); - } - } - - private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"]; - public function get strings():Array - { - return _strings; - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/build.xml ---------------------------------------------------------------------- diff --git a/examples/StockQuote/build.xml b/examples/StockQuote/build.xml deleted file mode 100644 index 42a8510..0000000 --- a/examples/StockQuote/build.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?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. - ---> - - -<project name="stockquote" default="main" basedir="."> - <property name="FLEXJS_HOME" location="../.."/> - <property name="example" value="StockQuote" /> - - <property environment="env"/> - <property file="${FLEXJS_HOME}/build.properties"/> - <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> - <property name="FALCON_HOME" value="${env.FALCON_HOME}"/> - <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/> - <property name="GOOG_HOME" value="${env.GOOG_HOME}"/> - - <include file="${basedir}/../build_example.xml" /> - - <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}"> - </target> - - <target name="clean"> - <delete dir="${basedir}/bin" failonerror="false" /> - <delete dir="${basedir}/bin-debug" failonerror="false" /> - <delete dir="${basedir}/bin-release" failonerror="false" /> - </target> - -</project> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/examples/StockQuote/src/MyInitialView.mxml b/examples/StockQuote/src/MyInitialView.mxml deleted file mode 100644 index 0d5697f..0000000 --- a/examples/StockQuote/src/MyInitialView.mxml +++ /dev/null @@ -1,169 +0,0 @@ -<?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. - ---> -<js:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009" - xmlns:js="library://ns.apache.org/flexjs/basic" - initComplete="initControls()"> - <fx:Script> - <![CDATA[ - import org.apache.flex.events.CustomEvent; - import models.MyModel; - - private var _symbol:String; - - public function get symbol():String - { - return _symbol; - } - - public function get requestedField():String - { - return radio1.selectedValue as String; - } - - private function radioChanged(e:org.apache.flex.events.Event):void - { - dispatchEvent(new CustomEvent("radioClicked")); - field.text = RadioButton(e.target).text; - } - - private function initControls():void - { - list.selectedItem = MyModel(applicationModel).stockSymbol; - radio1.selectedValue = MyModel(applicationModel).requestedField; - if (radio1.selected) - field.text = radio1.text; - else if (radio2.selected) - field.text = radio2.text; - else if (radio3.selected) - field.text = radio3.text; - else if (radio4.selected) - field.text = radio4.text; - - } - ]]> - </fx:Script> - <fx:Style> - @namespace basic "library://ns.apache.org/flexjs/basic"; - - .output { - font-size: 20px; - } - - .topContainer { - padding: 10px; - - } - .leftSide { - vertical-align: top; - margin-right: 10px; - border-style: solid; - } - - .rightSide { - vertical-align: top; - margin-left: 10px; - padding-left: 10px; - border-style: solid; - } - - .quoteButton { - margin-top: 10px; - margin-bottom: 10px; - } - - @media -flex-flash - { - - .leftSide { - iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead'); - } - - .rightSide { - iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead'); - } - } - </fx:Style> - <js:Container x="0" y="0" className="topContainer" > - <js:beads> - <js:VerticalLayout /> - </js:beads> - <js:Label width="300" text="Enter Stock Symbol or choose from list:" /> - <js:Container> - <js:beads> - <js:HorizontalLayout /> - </js:beads> - <js:Panel title="Left Side" className="leftSide"> - <js:beads> - <js:VerticalLayout /> - </js:beads> - <js:TextInput id="symbolTI" > - <js:beads> - <js:SimpleBinding eventName="stockSymbolChanged" - sourceID="applicationModel" - sourcePropertyName="stockSymbol" - destinationPropertyName="text" /> - </js:beads> - </js:TextInput> - <js:Label id="field" /> - <js:Label className="output" height="24"> - <js:beads> - <js:SimpleBinding eventName="responseTextChanged" - sourceID="applicationModel" - sourcePropertyName="responseText" - destinationPropertyName="text" /> - </js:beads> - </js:Label> - <js:TextButton text="Get Quote" className="quoteButton" - click="_symbol = symbolTI.text; dispatchEvent(new CustomEvent('buttonClicked'))" /> - </js:Panel> - <js:Panel title="Right Side" className="rightSide"> - <js:beads> - <js:VerticalLayout /> - </js:beads> - <js:DropDownList id="list" width="100" height="17" - change="_symbol = list.selectedItem as String; dispatchEvent(new CustomEvent('listChanged'))"> - <js:beads> - <js:ConstantBinding - sourceID="applicationModel" - sourcePropertyName="strings" - destinationPropertyName="dataProvider" /> - </js:beads> - </js:DropDownList> - <js:RadioButton id="radio1" text="Price" value="Ask" groupName="group1" change="radioChanged(event)"/> - <js:RadioButton id="radio2" text="Change" value="Change" groupName="group1" change="radioChanged(event)"/> - <js:RadioButton id="radio3" text="Day's High" value="DaysHigh" groupName="group1" change="radioChanged(event)"/> - <js:RadioButton id="radio4" text="Day's Low" value="DaysLow" groupName="group1" change="radioChanged(event)"/> - <js:CheckBox id="showAllData" text="Show All Data" /> - </js:Panel> - </js:Container> - <js:TextArea id="ta" width="300" height="100"> - <js:beads> - <js:SimpleBinding eventName="change" - sourceID="showAllData" - sourcePropertyName="selected" - destinationPropertyName="visible" /> - <js:SimpleBinding eventName="responseDataChanged" - sourceID="applicationModel" - sourcePropertyName="allData" - destinationPropertyName="text" /> - </js:beads> - </js:TextArea> - </js:Container> -</js:ViewBase> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/README.txt ---------------------------------------------------------------------- diff --git a/examples/StockQuote/src/README.txt b/examples/StockQuote/src/README.txt deleted file mode 100644 index 44d8015..0000000 --- a/examples/StockQuote/src/README.txt +++ /dev/null @@ -1,49 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// - -DESCRIPTION - -The StockQuote example is very closely related to the DataBindingTest and shows -a number of FlexJS components and beads, including the HTTPService used to -obtain the stock information. - -This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX) -into JavaScript and HTML and run without Flash. - -COMPONENTS and BEADS - -- CheckBox -- Container -- DropDownList -- Label -- Panel -- RadioButton -- TextArea -- TextButton -- TextInput - -- ConstantBinding -- NonVirtualHorizontalLayout -- NonVirtualVerticalLayout -- SimpleBinding - -NOTES - -Some work needs to be done with the layout; both ActionScript and JavaScript platforms -are different and each requires some work. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/StockDataJSONItemConverter.as ---------------------------------------------------------------------- diff --git a/examples/StockQuote/src/StockDataJSONItemConverter.as b/examples/StockQuote/src/StockDataJSONItemConverter.as deleted file mode 100644 index a39606b..0000000 --- a/examples/StockQuote/src/StockDataJSONItemConverter.as +++ /dev/null @@ -1,40 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// -package -{ - import org.apache.flex.collections.converters.JSONItemConverter; - - public class StockDataJSONItemConverter extends JSONItemConverter - { - public function StockDataJSONItemConverter() - { - super(); - } - - override public function convertItem(data:String):Object - { - var obj:Object = super.convertItem(data); - if (obj["query"]["count"] == 0) - return "No Data"; - - obj = obj["query"]["results"]["quote"]; - return obj; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/StockQuote.mxml ---------------------------------------------------------------------- diff --git a/examples/StockQuote/src/StockQuote.mxml b/examples/StockQuote/src/StockQuote.mxml deleted file mode 100644 index cb3d098..0000000 --- a/examples/StockQuote/src/StockQuote.mxml +++ /dev/null @@ -1,52 +0,0 @@ -<?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. - ---> -<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009" - xmlns:local="*" - xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:models="models.*" - xmlns:controllers="controllers.*" - initialize="MyModel(model).stockSymbol='ADBE'" - > - <js:valuesImpl> - <js:SimpleCSSValuesImpl /> - </js:valuesImpl> - <js:initialView> - <local:MyInitialView /> - </js:initialView> - <js:model> - <models:MyModel /> - </js:model> - <js:controller> - <controllers:MyController /> - </js:controller> - <js:beads> - <js:HTTPService id="service"> - <js:LazyCollection id="collection"> - <js:inputParser> - <js:JSONInputParser /> - </js:inputParser> - <js:itemConverter> - <local:StockDataJSONItemConverter /> - </js:itemConverter> - </js:LazyCollection> - </js:HTTPService> - <js:ViewSourceContextMenuOption /> - </js:beads> -</js:Application> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/controllers/MyController.as ---------------------------------------------------------------------- diff --git a/examples/StockQuote/src/controllers/MyController.as b/examples/StockQuote/src/controllers/MyController.as deleted file mode 100644 index c7332e3..0000000 --- a/examples/StockQuote/src/controllers/MyController.as +++ /dev/null @@ -1,81 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// -package controllers -{ - import org.apache.flex.events.Event; - - import org.apache.flex.core.Application; - import org.apache.flex.core.IDocument; - - import models.MyModel; - - public class MyController implements IDocument - { - public function MyController(app:Application = null) - { - if (app) - { - this.app = app as StockQuote; - 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:StockQuote; - - private function viewChangeHandler(event:Event):void - { - app.initialView.addEventListener("buttonClicked", buttonClickHandler); - app.initialView.addEventListener("radioClicked", radioClickHandler); - app.initialView.addEventListener("listChanged", listChangedHandler); - } - - 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 radioClickHandler(event:Event):void - { - var field:String = MyInitialView(app.initialView).requestedField; - MyModel(app.model).requestedField = field; - } - - private function completeHandler(event:Event):void - { - MyModel(app.model).responseData = app.collection.getItemAt(0); - } - - private function listChangedHandler(event:Event):void - { - MyModel(app.model).stockSymbol = MyInitialView(app.initialView).symbol; - } - - public function setDocument(document:Object, id:String = null):void - { - this.app = document as StockQuote; - app.addEventListener("viewChanged", viewChangeHandler); - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b7fba067/examples/StockQuote/src/models/MyModel.as ---------------------------------------------------------------------- diff --git a/examples/StockQuote/src/models/MyModel.as b/examples/StockQuote/src/models/MyModel.as deleted file mode 100644 index c724f4b..0000000 --- a/examples/StockQuote/src/models/MyModel.as +++ /dev/null @@ -1,126 +0,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. -// -//////////////////////////////////////////////////////////////////////////////// -package models -{ - import org.apache.flex.events.Event; - import org.apache.flex.events.EventDispatcher; - - public class MyModel extends EventDispatcher - { - public function MyModel() - { - } - - private var _requestedField:String = "Ask"; - - [Bindable("requestedFieldChanged")] - public function get requestedField():String - { - return _requestedField; - } - - public function set requestedField(value:String):void - { - if (value != _requestedField) - { - _requestedField = value; - dispatchEvent(new Event("requestedFieldChanged")); - if (_responseData) - dispatchEvent(new Event("responseTextChanged")); - } - } - - private var _responseText:String; - - [Bindable("responseTextChanged")] - public function get responseText():String - { - if (_responseData == null) - return ""; - if (_responseData == "No Data") - return _responseData as String; - var s:String = _responseData[_requestedField]; - if (s == null) - { - if (_requestedField == "Ask") - s = _responseData["Bid"]; - } - return s; - } - - private var _responseData:Object; - - [Bindable("responseDataChanged")] - public function get responseData():Object - { - return _responseData; - } - - public function set responseData(value:Object):void - { - if (value != _responseData) - { - _responseData = value; - _allData = ""; - dispatchEvent(new Event("responseDataChanged")); - dispatchEvent(new Event("responseTextChanged")); - } - } - - private var _allData:String = ""; - - [Bindable("responseDataChanged")] - public function get allData():String - { - if (_allData == "" && _responseData != null) - { - for (var p:String in _responseData) - { - _allData += p + ": " + _responseData[p] + "\n"; - } - } - return _allData; - } - - - private var _stockSymbol:String; - - [Bindable("stockSymbolChanged")] - public function get stockSymbol():String - { - return _stockSymbol; - } - - public function set stockSymbol(value:String):void - { - if (value != _stockSymbol) - { - _stockSymbol = value; - dispatchEvent(new Event("stockSymbolChanged")); - } - } - - private var _strings:Array = ["AAPL", "ADBE", "GOOG", "MSFT", "YHOO"]; - public function get strings():Array - { - return _strings; - } - - } -} \ No newline at end of file
