http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/controller/WatchListController.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/controller/WatchListController.as b/examples/flexjs/MobileStocks/src/main/flex/controller/WatchListController.as new file mode 100644 index 0000000..0d94e5f --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/controller/WatchListController.as @@ -0,0 +1,139 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 controller +{ + import models.ProductsModel; + import models.Stock; + + import org.apache.flex.core.IBeadController; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.utils.Timer; + import org.apache.flex.collections.ArrayList; + + import views.StockView; + import views.WatchListView; + + public class WatchListController extends EventDispatcher implements IBeadController + { + public function WatchListController() + { + super(); + + timer = new Timer(updateInterval, 0); + timer.addEventListener("timer", timerHandler); + } + + public var updateInterval:Number = 5000; + + protected var timer:Timer; + + private var index:Number = 0; + private var selectedStock:Stock; + private var _strand:IStrand; + + public function set strand(value:IStrand):void + { + _strand = value; + + var view:WatchListView = value as WatchListView; + view.addEventListener("addSymbol", handleAddSymbol); + view.addEventListener("stockSelected", handleGridSelection); + } + + private var _model:IBeadModel; + public function set model(value:IBeadModel):void + { + _model = value; + } + public function get model():IBeadModel + { + return _model; + } + + private function handleAddSymbol(event:Event):void + { + var view:WatchListView = _strand as WatchListView; + var symbol:String = view.symbolName.text.toUpperCase(); + + view.symbolName.text = ""; + + (model as ProductsModel).addStockToWatchList(symbol); + (model as ProductsModel).saveDataToStorage(); + + subscribe(); + } + + private function handleGridSelection(event:Event):void + { + var view:WatchListView = _strand as WatchListView; + selectedStock = (model as ProductsModel).watchList.getItemAt(view.selectedStockIndex) as Stock; + trace("Selected stock "+selectedStock.symbol); + + var stockView:StockView = view.showStockDetails(selectedStock); + stockView.addEventListener("removeFromList", handleRemoveFromList); + } + + public function handleRemoveFromList(event:Event):void + { + (model as ProductsModel).removeStockFromWatchList(selectedStock); + + var view:WatchListView = _strand as WatchListView; + view.popView(); + } + + public function subscribe():void + { + if (!timer.running) + { + timer.start(); + } + } + + public function unsubscribe():void + { + if (timer.running) + { + timer.stop(); + } + } + + /** + * Each time the handler goes off a different stock in the list + * is updated. This keeps the app from sending too many requests + * all at once. + */ + protected function timerHandler(event:*):void + { + var stockList:ArrayList = (model as ProductsModel).watchList; + + if (stockList.length == 0) return; + + if (index >= stockList.length) index = 0; + + (model as ProductsModel).updateStockData(stockList.getItemAt(index) as Stock); + index++; + + var newEvent:Event = new Event("update"); + model.dispatchEvent(newEvent); + } + } +}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/models/ProductsModel.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/models/ProductsModel.as b/examples/flexjs/MobileStocks/src/main/flex/models/ProductsModel.as new file mode 100755 index 0000000..ab7689e --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/models/ProductsModel.as @@ -0,0 +1,271 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core.IBeadModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.net.HTTPService; + import org.apache.flex.collections.parsers.JSONInputParser; + import org.apache.flex.collections.LazyCollection; + import org.apache.flex.collections.ArrayList; + + import org.apache.flex.storage.PermanentStorage; + import org.apache.flex.storage.events.FileEvent; + import org.apache.flex.storage.events.FileErrorEvent; + + public class ProductsModel extends EventDispatcher implements IBeadModel + { + public function ProductsModel() + { + super(); + + service = new HTTPService(); + collection = new LazyCollection; + collection.inputParser = new JSONInputParser(); + collection.itemConverter = new StockDataJSONItemConverter(); + + _watchList = new ArrayList(); + _assetList = new ArrayList(); + } + + public function loadDataFromStorage():void + { + var storage:PermanentStorage = new PermanentStorage(); + var useFile:String = "com.apache.flex.MobileStocks2"; + + storage.addEventListener("READ", handleRead); + storage.addEventListener("ERROR", handleReadError); + storage.readTextFromDataFile(useFile); + } + + private function handleRead(event:FileEvent):void + { + trace(event.data); + var result:XML = new XML(event.data); + trace("XML parsing:"); + trace(result); + + var assetItems:XMLList = result..asset; + trace("Got "+assetItems.length()+" assets"); + for each (var asset:XML in assetItems) { + trace("symbol = " + asset.@symbol + ", shares = " + asset.@shares); + addStockToAssetList(asset.@symbol, Number(asset.@shares)); + } + + var watchItems:XMLList = result..watch; + trace("Got "+watchItems.length()+" watches"); + for each (var watch:XML in watchItems) { + trace("symbol = "+watch.@symbol); + addStockToWatchList(watch.@symbol); + } + } + + private function handleReadError(event:FileErrorEvent):void + { + trace("Read error: "+event.errorMessage); + } + + public function saveDataToStorage():void + { + var storage:PermanentStorage = new PermanentStorage(); + var useFile:String = "com.apache.flex.MobileStocks2"; + var assets:String = ""; + + for (var i:int=0; i < _assetList.length; i++) { + var stock:Stock = _assetList.getItemAt(i) as Stock; + assets = assets + '<asset symbol="'+stock.symbol+'" shares="'+stock.shares+'" />'; + } + + var watches:String = ""; + for (i=0; i < _watchList.length; i++) { + stock = _watchList.getItemAt(i) as Stock; + watches = watches + '<watch symbol="'+stock.symbol+'" />'; + } + + var output:String = "<data><assets>"+assets+"</assets><watches>"+watches+"</watches></data>"; + + trace("Writing: "+output); + + storage.addEventListener("WRITE", handleSave); + storage.addEventListener("ERROR", handleSaveError); + storage.writeTextToDataFile(useFile, output); + } + + private function handleSave(event:FileEvent):void + { + trace("Save completed"); + } + + private function handleSaveError(event:FileErrorEvent):void + { + trace("Write error: "+event.errorMessage); + } + + private var service:HTTPService; + private var collection:LazyCollection; + 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 _strand:IStrand; + public function set strand(value:IStrand):void + { + _strand = value; + + service.addBead(collection); + _strand.addBead(service); + } + + private var _tabList:Array = ["Assets", "Watch", "Alerts"]; + public function get tabList():Array + { + return _tabList; + } + + private var _labelFields:Array = [ "id", "title", "detail" ]; + public function get labelFields():Array + { + return _labelFields; + } + + private var _watchList:ArrayList; + + public function get watchList():ArrayList + { + return _watchList; + } + + private var _assetList:ArrayList; + + public function get assetList():ArrayList + { + return _assetList; + } + + public function addStockToAssetList(symbol:String, shares:Number):Stock + { + for (var i:int=0; i < _assetList.length; i++) + { + var stock:Stock = _assetList.getItemAt(i) as Stock; + if (stock.symbol == symbol) { + stock.shares = shares; + _assetList.itemUpdatedAt(i); + return stock; + } + } + + stock = new Stock(symbol); + stock.shares = shares; + + _assetList.addItem(stock); + updateStockData(stock); + + return stock; + } + + public function addStockToWatchList(symbol:String):Stock + { + for (var i:int=0; i < _watchList.length; i++) + { + var stock:Stock = _watchList.getItemAt(i) as Stock; + if (stock.symbol == symbol) { + _watchList.itemUpdatedAt(i); + return stock; + } + } + + stock = new Stock(symbol); + _watchList.addItem(stock); + updateStockData(stock); + return stock; + } + + public function removeStockFromWatchList(stock:Stock):void + { + for (var i:int=0; i < _watchList.length; i++) + { + var s:Stock = _watchList.getItemAt(i) as Stock; + if (stock.symbol == s.symbol) { + _watchList.removeItemAt(i); + break; + } + } + + dispatchEvent(new Event("update")); + } + + public function removeStockFromAssetListAtIndex(index:int):void + { + if (index >= 0 && index < _assetList.length) { + _assetList.removeItemAt(index); + dispatchEvent(new Event("update")); + } + } + + // UPDATE STOCK INFORMATION FROM REMOTE SYSTEM + + public function updateStockData(value:Stock):void + { + var sym:String = value.symbol; + service.url = queryBegin + sym + queryEnd; + service.send(); + service.addEventListener("complete", completeHandler); + } + + private function completeHandler(event:Event):void + { + var responseData:Object = collection.getItemAt(0); + if ((responseData is String) && (responseData == "No Data")) return; + var sym:String = responseData["Symbol"]; + + var queueNext:Stock = null; + + for (var i:int=0; i < _watchList.length; i++) + { + var stock:Stock = _watchList.getItemAt(i) as Stock; + if (stock.symbol == sym) { + stock.updateFromData(responseData); + _watchList.itemUpdatedAt(i); + } + else if (stock.last == 0) { + queueNext = stock; + } + } + + for (i=0; i < _assetList.length; i++) + { + stock = _assetList.getItemAt(i) as Stock; + if (stock.symbol == sym) { + stock.updateFromData(responseData); + _assetList.itemUpdatedAt(i); + } + else if (stock.last == 0) { + queueNext = stock; + } + } + + if (queueNext != null) { + trace("--- queue: "+queueNext.symbol); + updateStockData(queueNext); + } + + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/models/Stock.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/models/Stock.as b/examples/flexjs/MobileStocks/src/main/flex/models/Stock.as new file mode 100755 index 0000000..e66f353 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/models/Stock.as @@ -0,0 +1,168 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 Stock extends EventDispatcher + { + public var history:Array; + + public function Stock(symbol:String=null, last:Number=0) + { + this.symbol = symbol; + this.last = last; + this.low = last; + this.high = last; + this.open = last; + this.change = 0; + this.name = ""; + this.shares = 0; + } + + public function updateFromData(obj:Object):void + { + name = obj["Name"]; + low = obj["DaysLow"]; + high = obj["DaysHigh"]; + open = obj["Open"]; + change = obj["Change"]; + symbol = obj["Symbol"]; + last = obj["LastTradePriceOnly"]; + // shares do not change this way + } + + private var _symbol:String; + private var _name:String; + private var _low:Number; + private var _high:Number; + private var _open:Number; + private var _last:Number; + private var _change:Number; + private var _date:Date; + + private var _shares:Number; + + [Bindable("symbolChanged")] + public function get symbol():String + { + return _symbol; + } + public function set symbol(value:String):void + { + _symbol = value; + dispatchEvent(new Event("symbolChanged")); + } + + [Bindable("nameChanged")] + public function get name():String + { + return _name; + } + public function set name(value:String):void + { + _name = value; + dispatchEvent(new Event("nameChanged")); + } + + [Bindable("lowChanged")] + public function get low():Number + { + return _low; + } + public function set low(value:Number):void + { + _low = value; + dispatchEvent(new Event("lowChanged")); + } + + [Bindable("highChanged")] + public function get high():Number + { + return _high; + } + public function set high(value:Number):void + { + _high = value; + dispatchEvent(new Event("highChanged")); + } + + [Bindable("openChanged")] + public function get open():Number + { + return _open; + } + public function set open(value:Number):void + { + _open = value; + dispatchEvent(new Event("openChanged")); + } + + [Bindable("lastChanged")] + public function get last():Number + { + return _last; + } + public function set last(value:Number):void + { + _last = value; + dispatchEvent(new Event("lastChanged")); + } + + [Bindable("changeChanged")] + public function get change():Number + { + return _change; + } + public function set change(value:Number):void + { + _change = value; + dispatchEvent(new Event("changeChanged")); + } + + [Bindable("dateChanged")] + public function get date():Date + { + return _date; + } + public function set date(value:Date):void + { + _date = value; + dispatchEvent(new Event("dateChanged")); + } + + [Bindable("sharedChanged")] + public function get shares():Number + { + return _shares; + } + public function set shares(value:Number):void + { + _shares = value; + dispatchEvent(new Event("sharesChanged")); + } + + public function get total():Number + { + return _shares * _last; + } + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/renderers/AlertRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/renderers/AlertRenderer.as b/examples/flexjs/MobileStocks/src/main/flex/renderers/AlertRenderer.as new file mode 100644 index 0000000..e683020 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/renderers/AlertRenderer.as @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 renderers +{ + import org.apache.flex.html.supportClasses.StringItemRenderer; + + public class AlertRenderer extends StringItemRenderer + { + public function AlertRenderer() + { + super(); + } + + override public function set data(value:Object):void + { + super.data = value; + + if (labelField == "greaterThan") { + if (Boolean(value[labelField])) { + text = "when over "+value["value"]; + } + else { + text = "when under "+value["value"]; + } + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/renderers/CompanyNameRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/renderers/CompanyNameRenderer.as b/examples/flexjs/MobileStocks/src/main/flex/renderers/CompanyNameRenderer.as new file mode 100644 index 0000000..e899b57 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/renderers/CompanyNameRenderer.as @@ -0,0 +1,37 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 renderers +{ + import org.apache.flex.html.supportClasses.StringItemRenderer; + + public class CompanyNameRenderer extends StringItemRenderer + { + public function CompanyNameRenderer() + { + super(); + } + + override public function set data(value:Object):void + { + super.data = value; + + text = data.name + " (" + data.symbol + ")"; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/renderers/SharesTotalRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/renderers/SharesTotalRenderer.as b/examples/flexjs/MobileStocks/src/main/flex/renderers/SharesTotalRenderer.as new file mode 100644 index 0000000..f6ac94b --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/renderers/SharesTotalRenderer.as @@ -0,0 +1,37 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 renderers +{ + import org.apache.flex.html.supportClasses.StringItemRenderer; + + public class SharesTotalRenderer extends StringItemRenderer + { + public function SharesTotalRenderer() + { + super(); + } + + override public function set data(value:Object):void + { + super.data = value; + + text = "$"+String( int(data.total*100)/100.0 ); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/renderers/StockRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/renderers/StockRenderer.as b/examples/flexjs/MobileStocks/src/main/flex/renderers/StockRenderer.as new file mode 100755 index 0000000..afba26f --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/renderers/StockRenderer.as @@ -0,0 +1,47 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 renderers +{ + import org.apache.flex.html.supportClasses.StringItemRenderer; + + public class StockRenderer extends StringItemRenderer + { + public function StockRenderer() + { + super(); + } + + override public function set data(value:Object):void + { + super.data = value; + + var n1:Number = Number(value[labelField]); + if (!isNaN(n1)) { + n1 = Math.round(n1*100)/100.0; + + // something to keep in mind when using FlexJS for cross-platform + // use: make sure that public properties are used versus protected + // functions or properties. in most cases, internal vars and functions + // will be platform-specific whereas public properties and function + // should be cross-platform. + text = String(n1); + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/views/LaunchView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/views/LaunchView.mxml b/examples/flexjs/MobileStocks/src/main/flex/views/LaunchView.mxml new file mode 100644 index 0000000..3d38bda --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/views/LaunchView.mxml @@ -0,0 +1,204 @@ +<?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:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" + title="Assets" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:models="models.*" + xmlns:local="*" + xmlns:views="views.*" + className="LaunchView"> + + <fx:Script> + <![CDATA[ + import controller.LaunchViewController; + import models.ProductsModel; + import models.Stock; + + import org.apache.flex.binding.SimpleBinding; + import org.apache.flex.core.IBeadController; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.events.Event; + import org.apache.flex.events.ValueChangeEvent; + import org.apache.flex.mobile.IViewManager; + import org.apache.flex.mobile.StackedViewManager; + import org.apache.flex.html.beads.DataProviderChangeNotifier; + + public function set dataModel(value:IBeadModel):void + { + var cm:IBeadController = controller; + (cm as LaunchViewController).model = value; + + var newEvent:ValueChangeEvent = new ValueChangeEvent("valueChange", false, false, null, value); + newEvent.propertyName = "dataModel"; + dispatchEvent(newEvent); + } + + public function get dataModel():IBeadModel + { + var cm:IBeadController = controller; + return (cm as LaunchViewController).model; + } + + public function addSymbol():void + { + dispatchEvent(new org.apache.flex.events.Event("addSymbol")); + } + + public function removeSymbol():void + { + dispatchEvent(new org.apache.flex.events.Event("removeSymbol")); + } + + public function gridSelected():void + { + dispatchEvent(new org.apache.flex.events.Event("symbolSelected")); + } + ]]> + </fx:Script> + + <fx:Style> + @namespace js "library://ns.apache.org/flexjs/basic"; + .AllCharts { + border-width: 0px; + padding-left: 2px; + padding-top: 10px; + padding-bottom: 2px; + padding-right: 10px; + } + + .DataGridListArea .StringItemRenderer { + font-size: 10px; + } + + .HorizontalAxis .TickLabel { + color: #333333; + } + + .VerticalAxis .TickLabel { + color: #333333; + } + + /*.Outer1 { + background-color: #FFFFFF; + vertical-align: middle; + }*/ + + .InputChild { + vertical-align: middle; + } + + /*.Outer2 { + background-color: #FFFFFF; + }*/ + + .LaunchGrid { + background-color: #FFFFFF; + } + + .DataGridListArea { + background-color: #FFFFFF; + } + </fx:Style> + + <fx:Metadata> + [Event("next")] + </fx:Metadata> + + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <!-- +<js:model> + <models:AssetsModel /> + </js:model> + --> + + <js:Container height="40" width="100%"> + <js:beads> + <js:OneFlexibleChildHorizontalLayout flexibleChild="spacer1" maxWidth="400" maxHeight="20" /> + </js:beads> + <js:Label text="Symbol:" className="InputChild" /> + <js:TextInput id="symbolInput" width="50" className="InputChild" /> + <js:Spacer width="10" /> + <js:Label text="Shares:" className="InputChild" /> + <js:TextInput id="sharesInput" width="50" className="InputChild" /> + <js:Spacer width="10" /> + <js:TextButton id="addButton" text="Add" width="80" click="addSymbol()" className="InputChild" /> + <js:Spacer id="spacer1" width="1" /> + <js:TextButton id="removeButton" text="Remove" width="80" click="removeSymbol()" className="InputChild" /> + </js:Container> + + <js:Container height="45%" width="100%"> + <js:DataGrid id="assetGrid" height="100%" width="100%" rowHeight="25" change="gridSelected()" className="LaunchGrid"> + <js:beads> + <js:DataGridPercentageLayout /> + <js:SimpleBinding + eventName="update" + sourceID="dataModel" + sourcePropertyName="assetList" + destinationPropertyName="dataProvider" /> + <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" + destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> + </js:beads> + <js:columns> + <js:DataGridColumn columnWidth="36" label="Company (SYMB)" dataField="name" itemRenderer="renderers.CompanyNameRenderer" /> + <js:DataGridColumn columnWidth="20" label="Shares" dataField="shares" /> + <js:DataGridColumn columnWidth="20" label="Last" dataField="last" /> + <js:DataGridColumn columnWidth="24" label="Total $" dataField="shares" itemRenderer="renderers.SharesTotalRenderer" /> + </js:columns> + </js:DataGrid> + </js:Container> + + <js:Spacer height="3%" /> + + <js:BarChart id="barChart" width="100%" height="40%" className="AllCharts"> + <js:model> + <js:ChartArrayListSelectionModel /> + </js:model> + <js:beads> + <js:DataItemRendererFactoryForSeriesArrayListData /> + <js:BarChartLayoutForArrayList gap="2" /> + <js:SimpleBinding + eventName="update" + sourceID="dataModel" + sourcePropertyName="assetList" + destinationPropertyName="dataProvider" /> + <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" + destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> + <js:HorizontalLinearAxisForArrayListBead valueField="total" /> + <js:VerticalCategoryAxisForArrayListBead categoryField="symbol" /> + </js:beads> + <js:series> + <js:BarSeries xField="total"> + <js:itemRenderer> + <fx:Component> + <js:BoxItemRenderer> + <js:fill> + <js:SolidColor color="#FF964D" alpha="1.0" /> + </js:fill> + </js:BoxItemRenderer> + </fx:Component> + </js:itemRenderer> + </js:BarSeries> + </js:series> + </js:BarChart> + +</js:TitleView> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/views/StockView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/views/StockView.mxml b/examples/flexjs/MobileStocks/src/main/flex/views/StockView.mxml new file mode 100755 index 0000000..ca86ba7 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/views/StockView.mxml @@ -0,0 +1,102 @@ +<?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:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:apache="org.apache.flex.html.beads.*" + xmlns:local="*" + className="StockView"> + + <fx:Script> + <![CDATA[ + import models.Stock; + + import org.apache.flex.events.Event; + import org.apache.flex.mobile.StackedViewManager; + + private var _stock:Stock; + + [Bindable("stockChanged")] + public function get stock():Stock + { + return _stock; + } + public function set stock(value:Stock):void + { + _stock = value; + dispatchEvent(new org.apache.flex.events.Event("stockChanged")); + } + + private function onBackClick() : void + { + (viewManager as StackedViewManager).pop(); + } + + override public function addedToParent():void + { + super.addedToParent(); + + stockSymbol.text = stock.symbol; + stockName.text = stock.name; + lastPrice.text = String(stock.last); + openPrice.text = String(stock.open); + lowPrice.text = String(stock.low); + highPrice.text = String(stock.high); + changeAmount.text = String(stock.change); + } + + private function removeFromList():void + { + dispatchEvent(new org.apache.flex.events.Event("removeFromList")); + } + ]]> + </fx:Script> + + <js:Container> + <js:beads> + <js:VerticalLayout /> + </js:beads> + <js:style> + <js:SimpleCSSStyles top="10px" left="10px" /> + </js:style> + + <js:Label id="stockSymbol" text="{stock.symbol}" className="ViewTitle" /> + <js:Label id="stockName" text="{stock.name}" className="StockName" /> + + <js:Spacer height="10" /> + + <js:Container className="StockDetailArea"> + <js:beads> + <js:VerticalColumnLayout numColumns="2" /> + </js:beads> + + <js:Label text="Last Price:" className="StockLabel" /> <js:Label id="lastPrice" className="StockValue" /> + <js:Label text="Open Price:" className="StockLabel" /> <js:Label id="openPrice" className="StockValue" /> + <js:Label text="Low Price:" className="StockLabel" /> <js:Label id="lowPrice" className="StockValue" /> + <js:Label text="High Price:" className="StockLabel" /> <js:Label id="highPrice" className="StockValue" /> + <js:Label text="Change: " className="StockLabel" /> <js:Label id="changeAmount" className="StockValue" /> + </js:Container> + + <js:Spacer height="10" /> + + <js:Container className="StockDetailArea"> + <js:TextButton text="Remove From List" width="200" className="StockRemoveButton" click="removeFromList()" /> + </js:Container> + </js:Container> +</js:TitleView> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/flex/views/WatchListView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/flex/views/WatchListView.mxml b/examples/flexjs/MobileStocks/src/main/flex/views/WatchListView.mxml new file mode 100755 index 0000000..1c317fe --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/flex/views/WatchListView.mxml @@ -0,0 +1,135 @@ +<?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:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" + title="Watch List" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:controller="controller.*" + xmlns:local="*" + className="WatchListView" + xmlns:renderers="renderers.*"> + + <fx:Script> + <![CDATA[ + import controller.WatchListController; + + import models.ProductsModel; + import models.Stock; + + import org.apache.flex.binding.SimpleBinding; + import org.apache.flex.core.IBeadController; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.events.Event; + import org.apache.flex.mobile.IViewManager; + import org.apache.flex.mobile.StackedViewManager; + + public function set dataModel(value:IBeadModel):void + { + var cm:IBeadController = controller; + (cm as WatchListController).model = value; + + var newEvent:ValueChangeEvent = new ValueChangeEvent("valueChange", false, false, null, value); + newEvent.propertyName = "dataModel"; + dispatchEvent(newEvent); + } + public function get dataModel():IBeadModel + { + var cm:IBeadController = controller; + return (cm as WatchListController).model; + } + + private function onSelectStock():void + { + var stockView:StockView = new StockView(); + var svm:IViewManager = viewManager; + (viewManager as StackedViewManager).push(stockView); + } + + private function addSymbol():void + { + dispatchEvent(new org.apache.flex.events.Event("addSymbol")); + } + + public var selectedStockIndex:Number; + + private function selectRow():void + { + selectedStockIndex = dataGrid.selectedIndex; + dispatchEvent(new org.apache.flex.events.Event("stockSelected")); + } + + public function showStockDetails(stock:Stock):StockView + { + var stockView:StockView = new StockView(); + stockView.stock = stock; + var vm:* = viewManager; + (viewManager as StackedViewManager).push(stockView); + + var cm:IBeadController = controller; + + return stockView; + } + + public function popView():void + { + (viewManager as StackedViewManager).pop(); + } + ]]> + </fx:Script> + + <js:beads> + <js:VerticalLayout /> + </js:beads> + + <js:HContainer className="WatchListInputArea" width="100%" height="10%"> + <js:Label text="Symbol:" /> + <js:TextInput id="symbolName" /> + <js:TextButton text="Add" click="addSymbol()" /> + </js:HContainer> + + <js:Spacer height="10" /> + + <js:DataGrid id="dataGrid" width="100%" height="85%" change="selectRow()" className="WatchListDataGrid"> + <js:beads> + <js:DataGridPercentageLayout /> + <js:SimpleBinding + eventName="update" + sourceID="dataModel" + sourcePropertyName="watchList" + destinationPropertyName="dataProvider" /> + <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="watchList" + destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> + </js:beads> + <js:columns> + <js:DataGridColumn label="Company (SYMB)" dataField="symbol" columnWidth="45" + itemRenderer="renderers.CompanyNameRenderer" /> + <js:DataGridColumn label="Open" dataField="open" columnWidth="11" + itemRenderer="renderers.StockRenderer" /> + <js:DataGridColumn label="Last" dataField="last"columnWidth="11" + itemRenderer="renderers.StockRenderer" /> + <js:DataGridColumn label="Change" dataField="change"columnWidth="11" + itemRenderer="renderers.StockRenderer" /> + <js:DataGridColumn label="High" dataField="high"columnWidth="11" + itemRenderer="renderers.StockRenderer" /> + <js:DataGridColumn label="Low" dataField="low" columnWidth="11" + itemRenderer="renderers.StockRenderer" /> + </js:columns> + </js:DataGrid> + +</js:TitleView> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/main/resources/config.xml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/main/resources/config.xml b/examples/flexjs/MobileStocks/src/main/resources/config.xml new file mode 100644 index 0000000..00b9f64 --- /dev/null +++ b/examples/flexjs/MobileStocks/src/main/resources/config.xml @@ -0,0 +1,44 @@ +<?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. + +--> +<widget id="${groupId}.${artifactId}" version="${version}" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> + <name>${artifactId}</name> + <description> + ${description} + </description> + <author email="d...@flex.apache.org" href="http://flex.apache.org"> + Apache Flex Team + </author> + <content src="index.html" /> + <plugin name="cordova-plugin-whitelist" version="1" /> + <access origin="*" /> + <allow-intent href="http://*/*" /> + <allow-intent href="https://*/*" /> + <allow-intent href="tel:*" /> + <allow-intent href="sms:*" /> + <allow-intent href="mailto:*" /> + <allow-intent href="geo:*" /> + <platform name="android"> + <allow-intent href="market:*" /> + </platform> + <platform name="ios"> + <allow-intent href="itms:*" /> + <allow-intent href="itms-apps:*" /> + </platform> +</widget> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/models/ProductsModel.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/models/ProductsModel.as b/examples/flexjs/MobileStocks/src/models/ProductsModel.as deleted file mode 100755 index ab7689e..0000000 --- a/examples/flexjs/MobileStocks/src/models/ProductsModel.as +++ /dev/null @@ -1,271 +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.core.IBeadModel; - import org.apache.flex.core.IStrand; - import org.apache.flex.events.Event; - import org.apache.flex.events.EventDispatcher; - import org.apache.flex.net.HTTPService; - import org.apache.flex.collections.parsers.JSONInputParser; - import org.apache.flex.collections.LazyCollection; - import org.apache.flex.collections.ArrayList; - - import org.apache.flex.storage.PermanentStorage; - import org.apache.flex.storage.events.FileEvent; - import org.apache.flex.storage.events.FileErrorEvent; - - public class ProductsModel extends EventDispatcher implements IBeadModel - { - public function ProductsModel() - { - super(); - - service = new HTTPService(); - collection = new LazyCollection; - collection.inputParser = new JSONInputParser(); - collection.itemConverter = new StockDataJSONItemConverter(); - - _watchList = new ArrayList(); - _assetList = new ArrayList(); - } - - public function loadDataFromStorage():void - { - var storage:PermanentStorage = new PermanentStorage(); - var useFile:String = "com.apache.flex.MobileStocks2"; - - storage.addEventListener("READ", handleRead); - storage.addEventListener("ERROR", handleReadError); - storage.readTextFromDataFile(useFile); - } - - private function handleRead(event:FileEvent):void - { - trace(event.data); - var result:XML = new XML(event.data); - trace("XML parsing:"); - trace(result); - - var assetItems:XMLList = result..asset; - trace("Got "+assetItems.length()+" assets"); - for each (var asset:XML in assetItems) { - trace("symbol = " + asset.@symbol + ", shares = " + asset.@shares); - addStockToAssetList(asset.@symbol, Number(asset.@shares)); - } - - var watchItems:XMLList = result..watch; - trace("Got "+watchItems.length()+" watches"); - for each (var watch:XML in watchItems) { - trace("symbol = "+watch.@symbol); - addStockToWatchList(watch.@symbol); - } - } - - private function handleReadError(event:FileErrorEvent):void - { - trace("Read error: "+event.errorMessage); - } - - public function saveDataToStorage():void - { - var storage:PermanentStorage = new PermanentStorage(); - var useFile:String = "com.apache.flex.MobileStocks2"; - var assets:String = ""; - - for (var i:int=0; i < _assetList.length; i++) { - var stock:Stock = _assetList.getItemAt(i) as Stock; - assets = assets + '<asset symbol="'+stock.symbol+'" shares="'+stock.shares+'" />'; - } - - var watches:String = ""; - for (i=0; i < _watchList.length; i++) { - stock = _watchList.getItemAt(i) as Stock; - watches = watches + '<watch symbol="'+stock.symbol+'" />'; - } - - var output:String = "<data><assets>"+assets+"</assets><watches>"+watches+"</watches></data>"; - - trace("Writing: "+output); - - storage.addEventListener("WRITE", handleSave); - storage.addEventListener("ERROR", handleSaveError); - storage.writeTextToDataFile(useFile, output); - } - - private function handleSave(event:FileEvent):void - { - trace("Save completed"); - } - - private function handleSaveError(event:FileErrorEvent):void - { - trace("Write error: "+event.errorMessage); - } - - private var service:HTTPService; - private var collection:LazyCollection; - 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 _strand:IStrand; - public function set strand(value:IStrand):void - { - _strand = value; - - service.addBead(collection); - _strand.addBead(service); - } - - private var _tabList:Array = ["Assets", "Watch", "Alerts"]; - public function get tabList():Array - { - return _tabList; - } - - private var _labelFields:Array = [ "id", "title", "detail" ]; - public function get labelFields():Array - { - return _labelFields; - } - - private var _watchList:ArrayList; - - public function get watchList():ArrayList - { - return _watchList; - } - - private var _assetList:ArrayList; - - public function get assetList():ArrayList - { - return _assetList; - } - - public function addStockToAssetList(symbol:String, shares:Number):Stock - { - for (var i:int=0; i < _assetList.length; i++) - { - var stock:Stock = _assetList.getItemAt(i) as Stock; - if (stock.symbol == symbol) { - stock.shares = shares; - _assetList.itemUpdatedAt(i); - return stock; - } - } - - stock = new Stock(symbol); - stock.shares = shares; - - _assetList.addItem(stock); - updateStockData(stock); - - return stock; - } - - public function addStockToWatchList(symbol:String):Stock - { - for (var i:int=0; i < _watchList.length; i++) - { - var stock:Stock = _watchList.getItemAt(i) as Stock; - if (stock.symbol == symbol) { - _watchList.itemUpdatedAt(i); - return stock; - } - } - - stock = new Stock(symbol); - _watchList.addItem(stock); - updateStockData(stock); - return stock; - } - - public function removeStockFromWatchList(stock:Stock):void - { - for (var i:int=0; i < _watchList.length; i++) - { - var s:Stock = _watchList.getItemAt(i) as Stock; - if (stock.symbol == s.symbol) { - _watchList.removeItemAt(i); - break; - } - } - - dispatchEvent(new Event("update")); - } - - public function removeStockFromAssetListAtIndex(index:int):void - { - if (index >= 0 && index < _assetList.length) { - _assetList.removeItemAt(index); - dispatchEvent(new Event("update")); - } - } - - // UPDATE STOCK INFORMATION FROM REMOTE SYSTEM - - public function updateStockData(value:Stock):void - { - var sym:String = value.symbol; - service.url = queryBegin + sym + queryEnd; - service.send(); - service.addEventListener("complete", completeHandler); - } - - private function completeHandler(event:Event):void - { - var responseData:Object = collection.getItemAt(0); - if ((responseData is String) && (responseData == "No Data")) return; - var sym:String = responseData["Symbol"]; - - var queueNext:Stock = null; - - for (var i:int=0; i < _watchList.length; i++) - { - var stock:Stock = _watchList.getItemAt(i) as Stock; - if (stock.symbol == sym) { - stock.updateFromData(responseData); - _watchList.itemUpdatedAt(i); - } - else if (stock.last == 0) { - queueNext = stock; - } - } - - for (i=0; i < _assetList.length; i++) - { - stock = _assetList.getItemAt(i) as Stock; - if (stock.symbol == sym) { - stock.updateFromData(responseData); - _assetList.itemUpdatedAt(i); - } - else if (stock.last == 0) { - queueNext = stock; - } - } - - if (queueNext != null) { - trace("--- queue: "+queueNext.symbol); - updateStockData(queueNext); - } - - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/models/Stock.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/models/Stock.as b/examples/flexjs/MobileStocks/src/models/Stock.as deleted file mode 100755 index 55f74cc..0000000 --- a/examples/flexjs/MobileStocks/src/models/Stock.as +++ /dev/null @@ -1,168 +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 Stock extends EventDispatcher - { - public var history:Array; - - public function Stock(symbol:String=null, last:Number=0) - { - this.symbol = symbol; - this.last = last; - this.low = last; - this.high = last; - this.open = last; - this.change = 0; - this.name = ""; - this.shares = 0; - } - - public function updateFromData(obj:Object):void - { - name = obj["Name"]; - low = obj["DaysLow"]; - high = obj["DaysHigh"]; - open = obj["Open"]; - change = obj["Change"]; - symbol = obj["Symbol"]; - last = obj["LastTradePriceOnly"]; - // shares do not change this way - } - - private var _symbol:String; - private var _name:String; - private var _low:Number; - private var _high:Number; - private var _open:Number; - private var _last:Number; - private var _change:Number; - private var _date:Date; - - private var _shares:Number; - - [Bindable("symbolChanged")] - public function get symbol():String - { - return _symbol; - } - public function set symbol(value:String):void - { - _symbol = value; - dispatchEvent(new Event("symbolChanged")); - } - - [Bindable("nameChanged")] - public function get name():String - { - return _name; - } - public function set name(value:String):void - { - _name = value; - dispatchEvent(new Event("nameChanged")); - } - - [Bindable("lowChanged")] - public function get low():Number - { - return _low; - } - public function set low(value:Number):void - { - _low = value; - dispatchEvent(new Event("lowChanged")); - } - - [Bindable("highChanged")] - public function get high():Number - { - return _high; - } - public function set high(value:Number):void - { - _high = value; - dispatchEvent(new Event("highChanged")); - } - - [Bindable("openChanged")] - public function get open():Number - { - return _open; - } - public function set open(value:Number):void - { - _open = value; - dispatchEvent(new Event("openChanged")); - } - - [Bindable("lastChanged")] - public function get last():Number - { - return _last; - } - public function set last(value:Number):void - { - _last = value; - dispatchEvent(new Event("lastChanged")); - } - - [Bindable("changeChanged")] - public function get change():Number - { - return _change; - } - public function set change(value:Number):void - { - _change = value; - dispatchEvent(new Event("changeChanged")); - } - - [Bindable("dateChanged")] - public function get date():Date - { - return _date; - } - public function set date(value:Date):void - { - _date = value; - dispatchEvent(new Event("dateChanged")); - } - - [Bindable("sharedChanged")] - public function get shares():Number - { - return _shares; - } - public function set shares(value:Number):void - { - _shares = value; - dispatchEvent(new Event("sharesChanged")); - } - - public function get total():Number - { - return _shares * _last; - } - } - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/renderers/AlertRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/renderers/AlertRenderer.as b/examples/flexjs/MobileStocks/src/renderers/AlertRenderer.as deleted file mode 100644 index e683020..0000000 --- a/examples/flexjs/MobileStocks/src/renderers/AlertRenderer.as +++ /dev/null @@ -1,44 +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 renderers -{ - import org.apache.flex.html.supportClasses.StringItemRenderer; - - public class AlertRenderer extends StringItemRenderer - { - public function AlertRenderer() - { - super(); - } - - override public function set data(value:Object):void - { - super.data = value; - - if (labelField == "greaterThan") { - if (Boolean(value[labelField])) { - text = "when over "+value["value"]; - } - else { - text = "when under "+value["value"]; - } - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/renderers/CompanyNameRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/renderers/CompanyNameRenderer.as b/examples/flexjs/MobileStocks/src/renderers/CompanyNameRenderer.as deleted file mode 100644 index e899b57..0000000 --- a/examples/flexjs/MobileStocks/src/renderers/CompanyNameRenderer.as +++ /dev/null @@ -1,37 +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 renderers -{ - import org.apache.flex.html.supportClasses.StringItemRenderer; - - public class CompanyNameRenderer extends StringItemRenderer - { - public function CompanyNameRenderer() - { - super(); - } - - override public function set data(value:Object):void - { - super.data = value; - - text = data.name + " (" + data.symbol + ")"; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/renderers/SharesTotalRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/renderers/SharesTotalRenderer.as b/examples/flexjs/MobileStocks/src/renderers/SharesTotalRenderer.as deleted file mode 100644 index f6ac94b..0000000 --- a/examples/flexjs/MobileStocks/src/renderers/SharesTotalRenderer.as +++ /dev/null @@ -1,37 +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 renderers -{ - import org.apache.flex.html.supportClasses.StringItemRenderer; - - public class SharesTotalRenderer extends StringItemRenderer - { - public function SharesTotalRenderer() - { - super(); - } - - override public function set data(value:Object):void - { - super.data = value; - - text = "$"+String( int(data.total*100)/100.0 ); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/renderers/StockRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/renderers/StockRenderer.as b/examples/flexjs/MobileStocks/src/renderers/StockRenderer.as deleted file mode 100755 index afba26f..0000000 --- a/examples/flexjs/MobileStocks/src/renderers/StockRenderer.as +++ /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. -// -//////////////////////////////////////////////////////////////////////////////// -package renderers -{ - import org.apache.flex.html.supportClasses.StringItemRenderer; - - public class StockRenderer extends StringItemRenderer - { - public function StockRenderer() - { - super(); - } - - override public function set data(value:Object):void - { - super.data = value; - - var n1:Number = Number(value[labelField]); - if (!isNaN(n1)) { - n1 = Math.round(n1*100)/100.0; - - // something to keep in mind when using FlexJS for cross-platform - // use: make sure that public properties are used versus protected - // functions or properties. in most cases, internal vars and functions - // will be platform-specific whereas public properties and function - // should be cross-platform. - text = String(n1); - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/views/LaunchView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/views/LaunchView.mxml b/examples/flexjs/MobileStocks/src/views/LaunchView.mxml deleted file mode 100644 index 3d38bda..0000000 --- a/examples/flexjs/MobileStocks/src/views/LaunchView.mxml +++ /dev/null @@ -1,204 +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:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" - title="Assets" - xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:models="models.*" - xmlns:local="*" - xmlns:views="views.*" - className="LaunchView"> - - <fx:Script> - <![CDATA[ - import controller.LaunchViewController; - import models.ProductsModel; - import models.Stock; - - import org.apache.flex.binding.SimpleBinding; - import org.apache.flex.core.IBeadController; - import org.apache.flex.core.IBeadModel; - import org.apache.flex.events.Event; - import org.apache.flex.events.ValueChangeEvent; - import org.apache.flex.mobile.IViewManager; - import org.apache.flex.mobile.StackedViewManager; - import org.apache.flex.html.beads.DataProviderChangeNotifier; - - public function set dataModel(value:IBeadModel):void - { - var cm:IBeadController = controller; - (cm as LaunchViewController).model = value; - - var newEvent:ValueChangeEvent = new ValueChangeEvent("valueChange", false, false, null, value); - newEvent.propertyName = "dataModel"; - dispatchEvent(newEvent); - } - - public function get dataModel():IBeadModel - { - var cm:IBeadController = controller; - return (cm as LaunchViewController).model; - } - - public function addSymbol():void - { - dispatchEvent(new org.apache.flex.events.Event("addSymbol")); - } - - public function removeSymbol():void - { - dispatchEvent(new org.apache.flex.events.Event("removeSymbol")); - } - - public function gridSelected():void - { - dispatchEvent(new org.apache.flex.events.Event("symbolSelected")); - } - ]]> - </fx:Script> - - <fx:Style> - @namespace js "library://ns.apache.org/flexjs/basic"; - .AllCharts { - border-width: 0px; - padding-left: 2px; - padding-top: 10px; - padding-bottom: 2px; - padding-right: 10px; - } - - .DataGridListArea .StringItemRenderer { - font-size: 10px; - } - - .HorizontalAxis .TickLabel { - color: #333333; - } - - .VerticalAxis .TickLabel { - color: #333333; - } - - /*.Outer1 { - background-color: #FFFFFF; - vertical-align: middle; - }*/ - - .InputChild { - vertical-align: middle; - } - - /*.Outer2 { - background-color: #FFFFFF; - }*/ - - .LaunchGrid { - background-color: #FFFFFF; - } - - .DataGridListArea { - background-color: #FFFFFF; - } - </fx:Style> - - <fx:Metadata> - [Event("next")] - </fx:Metadata> - - <js:beads> - <js:VerticalLayout /> - </js:beads> - - <!-- -<js:model> - <models:AssetsModel /> - </js:model> - --> - - <js:Container height="40" width="100%"> - <js:beads> - <js:OneFlexibleChildHorizontalLayout flexibleChild="spacer1" maxWidth="400" maxHeight="20" /> - </js:beads> - <js:Label text="Symbol:" className="InputChild" /> - <js:TextInput id="symbolInput" width="50" className="InputChild" /> - <js:Spacer width="10" /> - <js:Label text="Shares:" className="InputChild" /> - <js:TextInput id="sharesInput" width="50" className="InputChild" /> - <js:Spacer width="10" /> - <js:TextButton id="addButton" text="Add" width="80" click="addSymbol()" className="InputChild" /> - <js:Spacer id="spacer1" width="1" /> - <js:TextButton id="removeButton" text="Remove" width="80" click="removeSymbol()" className="InputChild" /> - </js:Container> - - <js:Container height="45%" width="100%"> - <js:DataGrid id="assetGrid" height="100%" width="100%" rowHeight="25" change="gridSelected()" className="LaunchGrid"> - <js:beads> - <js:DataGridPercentageLayout /> - <js:SimpleBinding - eventName="update" - sourceID="dataModel" - sourcePropertyName="assetList" - destinationPropertyName="dataProvider" /> - <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" - destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> - </js:beads> - <js:columns> - <js:DataGridColumn columnWidth="36" label="Company (SYMB)" dataField="name" itemRenderer="renderers.CompanyNameRenderer" /> - <js:DataGridColumn columnWidth="20" label="Shares" dataField="shares" /> - <js:DataGridColumn columnWidth="20" label="Last" dataField="last" /> - <js:DataGridColumn columnWidth="24" label="Total $" dataField="shares" itemRenderer="renderers.SharesTotalRenderer" /> - </js:columns> - </js:DataGrid> - </js:Container> - - <js:Spacer height="3%" /> - - <js:BarChart id="barChart" width="100%" height="40%" className="AllCharts"> - <js:model> - <js:ChartArrayListSelectionModel /> - </js:model> - <js:beads> - <js:DataItemRendererFactoryForSeriesArrayListData /> - <js:BarChartLayoutForArrayList gap="2" /> - <js:SimpleBinding - eventName="update" - sourceID="dataModel" - sourcePropertyName="assetList" - destinationPropertyName="dataProvider" /> - <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" - destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> - <js:HorizontalLinearAxisForArrayListBead valueField="total" /> - <js:VerticalCategoryAxisForArrayListBead categoryField="symbol" /> - </js:beads> - <js:series> - <js:BarSeries xField="total"> - <js:itemRenderer> - <fx:Component> - <js:BoxItemRenderer> - <js:fill> - <js:SolidColor color="#FF964D" alpha="1.0" /> - </js:fill> - </js:BoxItemRenderer> - </fx:Component> - </js:itemRenderer> - </js:BarSeries> - </js:series> - </js:BarChart> - -</js:TitleView> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/views/StockView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/views/StockView.mxml b/examples/flexjs/MobileStocks/src/views/StockView.mxml deleted file mode 100755 index ca86ba7..0000000 --- a/examples/flexjs/MobileStocks/src/views/StockView.mxml +++ /dev/null @@ -1,102 +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:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" - xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:apache="org.apache.flex.html.beads.*" - xmlns:local="*" - className="StockView"> - - <fx:Script> - <![CDATA[ - import models.Stock; - - import org.apache.flex.events.Event; - import org.apache.flex.mobile.StackedViewManager; - - private var _stock:Stock; - - [Bindable("stockChanged")] - public function get stock():Stock - { - return _stock; - } - public function set stock(value:Stock):void - { - _stock = value; - dispatchEvent(new org.apache.flex.events.Event("stockChanged")); - } - - private function onBackClick() : void - { - (viewManager as StackedViewManager).pop(); - } - - override public function addedToParent():void - { - super.addedToParent(); - - stockSymbol.text = stock.symbol; - stockName.text = stock.name; - lastPrice.text = String(stock.last); - openPrice.text = String(stock.open); - lowPrice.text = String(stock.low); - highPrice.text = String(stock.high); - changeAmount.text = String(stock.change); - } - - private function removeFromList():void - { - dispatchEvent(new org.apache.flex.events.Event("removeFromList")); - } - ]]> - </fx:Script> - - <js:Container> - <js:beads> - <js:VerticalLayout /> - </js:beads> - <js:style> - <js:SimpleCSSStyles top="10px" left="10px" /> - </js:style> - - <js:Label id="stockSymbol" text="{stock.symbol}" className="ViewTitle" /> - <js:Label id="stockName" text="{stock.name}" className="StockName" /> - - <js:Spacer height="10" /> - - <js:Container className="StockDetailArea"> - <js:beads> - <js:VerticalColumnLayout numColumns="2" /> - </js:beads> - - <js:Label text="Last Price:" className="StockLabel" /> <js:Label id="lastPrice" className="StockValue" /> - <js:Label text="Open Price:" className="StockLabel" /> <js:Label id="openPrice" className="StockValue" /> - <js:Label text="Low Price:" className="StockLabel" /> <js:Label id="lowPrice" className="StockValue" /> - <js:Label text="High Price:" className="StockLabel" /> <js:Label id="highPrice" className="StockValue" /> - <js:Label text="Change: " className="StockLabel" /> <js:Label id="changeAmount" className="StockValue" /> - </js:Container> - - <js:Spacer height="10" /> - - <js:Container className="StockDetailArea"> - <js:TextButton text="Remove From List" width="200" className="StockRemoveButton" click="removeFromList()" /> - </js:Container> - </js:Container> -</js:TitleView> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileStocks/src/views/WatchListView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileStocks/src/views/WatchListView.mxml b/examples/flexjs/MobileStocks/src/views/WatchListView.mxml deleted file mode 100755 index 1c317fe..0000000 --- a/examples/flexjs/MobileStocks/src/views/WatchListView.mxml +++ /dev/null @@ -1,135 +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:TitleView xmlns:fx="http://ns.adobe.com/mxml/2009" - title="Watch List" - xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:controller="controller.*" - xmlns:local="*" - className="WatchListView" - xmlns:renderers="renderers.*"> - - <fx:Script> - <![CDATA[ - import controller.WatchListController; - - import models.ProductsModel; - import models.Stock; - - import org.apache.flex.binding.SimpleBinding; - import org.apache.flex.core.IBeadController; - import org.apache.flex.core.IBeadModel; - import org.apache.flex.events.Event; - import org.apache.flex.mobile.IViewManager; - import org.apache.flex.mobile.StackedViewManager; - - public function set dataModel(value:IBeadModel):void - { - var cm:IBeadController = controller; - (cm as WatchListController).model = value; - - var newEvent:ValueChangeEvent = new ValueChangeEvent("valueChange", false, false, null, value); - newEvent.propertyName = "dataModel"; - dispatchEvent(newEvent); - } - public function get dataModel():IBeadModel - { - var cm:IBeadController = controller; - return (cm as WatchListController).model; - } - - private function onSelectStock():void - { - var stockView:StockView = new StockView(); - var svm:IViewManager = viewManager; - (viewManager as StackedViewManager).push(stockView); - } - - private function addSymbol():void - { - dispatchEvent(new org.apache.flex.events.Event("addSymbol")); - } - - public var selectedStockIndex:Number; - - private function selectRow():void - { - selectedStockIndex = dataGrid.selectedIndex; - dispatchEvent(new org.apache.flex.events.Event("stockSelected")); - } - - public function showStockDetails(stock:Stock):StockView - { - var stockView:StockView = new StockView(); - stockView.stock = stock; - var vm:* = viewManager; - (viewManager as StackedViewManager).push(stockView); - - var cm:IBeadController = controller; - - return stockView; - } - - public function popView():void - { - (viewManager as StackedViewManager).pop(); - } - ]]> - </fx:Script> - - <js:beads> - <js:VerticalLayout /> - </js:beads> - - <js:HContainer className="WatchListInputArea" width="100%" height="10%"> - <js:Label text="Symbol:" /> - <js:TextInput id="symbolName" /> - <js:TextButton text="Add" click="addSymbol()" /> - </js:HContainer> - - <js:Spacer height="10" /> - - <js:DataGrid id="dataGrid" width="100%" height="85%" change="selectRow()" className="WatchListDataGrid"> - <js:beads> - <js:DataGridPercentageLayout /> - <js:SimpleBinding - eventName="update" - sourceID="dataModel" - sourcePropertyName="watchList" - destinationPropertyName="dataProvider" /> - <js:DataProviderChangeNotifier sourceID="dataModel" propertyName="watchList" - destinationPropertyName="dataProvider" changeEventName="dataProviderChanged" /> - </js:beads> - <js:columns> - <js:DataGridColumn label="Company (SYMB)" dataField="symbol" columnWidth="45" - itemRenderer="renderers.CompanyNameRenderer" /> - <js:DataGridColumn label="Open" dataField="open" columnWidth="11" - itemRenderer="renderers.StockRenderer" /> - <js:DataGridColumn label="Last" dataField="last"columnWidth="11" - itemRenderer="renderers.StockRenderer" /> - <js:DataGridColumn label="Change" dataField="change"columnWidth="11" - itemRenderer="renderers.StockRenderer" /> - <js:DataGridColumn label="High" dataField="high"columnWidth="11" - itemRenderer="renderers.StockRenderer" /> - <js:DataGridColumn label="Low" dataField="low" columnWidth="11" - itemRenderer="renderers.StockRenderer" /> - </js:columns> - </js:DataGrid> - -</js:TitleView> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/resources/config.xml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/resources/config.xml b/examples/flexjs/MobileTrader/resources/config.xml deleted file mode 100644 index 00b9f64..0000000 --- a/examples/flexjs/MobileTrader/resources/config.xml +++ /dev/null @@ -1,44 +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. - ---> -<widget id="${groupId}.${artifactId}" version="${version}" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> - <name>${artifactId}</name> - <description> - ${description} - </description> - <author email="d...@flex.apache.org" href="http://flex.apache.org"> - Apache Flex Team - </author> - <content src="index.html" /> - <plugin name="cordova-plugin-whitelist" version="1" /> - <access origin="*" /> - <allow-intent href="http://*/*" /> - <allow-intent href="https://*/*" /> - <allow-intent href="tel:*" /> - <allow-intent href="sms:*" /> - <allow-intent href="mailto:*" /> - <allow-intent href="geo:*" /> - <platform name="android"> - <allow-intent href="market:*" /> - </platform> - <platform name="ios"> - <allow-intent href="itms:*" /> - <allow-intent href="itms-apps:*" /> - </platform> -</widget> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e75059f7/examples/flexjs/MobileTrader/src/MobileTrader.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/MobileTrader.mxml b/examples/flexjs/MobileTrader/src/MobileTrader.mxml deleted file mode 100755 index c76531c..0000000 --- a/examples/flexjs/MobileTrader/src/MobileTrader.mxml +++ /dev/null @@ -1,39 +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:models="models.*" - xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:controller="controller.*" - > - - <js:valuesImpl> - <js:SimpleCSSValuesImpl /> - </js:valuesImpl> - - <js:model> - <models:ProductsModel /> - </js:model> - - <js:initialView> - <local:MyInitialView width="100%" height="100%" /> - </js:initialView> -</js:Application>