You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/08/24 07:33:14 UTC
[24/34] git commit: [flex-asjs] [refs/heads/develop] - move examples
into a flexjs folder now that we have a native folder for low-level examples
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/controller/AlertsViewController.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/controller/AlertsViewController.as b/examples/MobileTrader/src/controller/AlertsViewController.as
deleted file mode 100644
index 716264d..0000000
--- a/examples/MobileTrader/src/controller/AlertsViewController.as
+++ /dev/null
@@ -1,139 +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 controller
-{
- import models.Alert;
- 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 views.AlertsView;
-
- public class AlertsViewController extends EventDispatcher implements IBeadController
- {
- public function AlertsViewController()
- {
- super();
-
- timer = new Timer(updateInterval, 0);
- timer.addEventListener("timer", timerHandler);
- }
-
- public var updateInterval:Number = 5000;
-
- protected var timer:Timer;
-
- private var _strand:IStrand;
-
- public function set strand(value:IStrand):void
- {
- _strand = value;
-
- var view:AlertsView = value as AlertsView;
- view.addEventListener("alertSet", handleAlertSet);
- }
-
- private var _model:IBeadModel;
- public function set model(value:IBeadModel):void
- {
- _model = value;
- }
- public function get model():IBeadModel
- {
- return _model;
- }
-
- private function handleAlertSet(event:Event):void
- {
- var view:AlertsView = _strand as AlertsView;
-
- var sym:String = view.symbolField.text.toUpperCase();
- var value:Number = Number(view.valueField.text);
-
- var alert:Alert = new Alert();
- alert.symbol = sym;
- alert.value = value;
- alert.greaterThan = view.higherCheck.selected;
-
- // add this stock to the watch list in case it isn't there already
- alert.stock = (model as ProductsModel).addStock(sym);
-
- // set up the alert for the stock
- (model as ProductsModel).addAlert(alert);
-
- view.symbolField.text = "";
- view.valueField.text = "";
-
- subscribe();
- }
-
- public function subscribe():void
- {
- if (!timer.running)
- {
- timer.start();
- }
- }
-
- public function unsubscribe():void
- {
- if (timer.running)
- {
- timer.stop();
- }
- }
-
- /**
- * When the timer goes off, verify all of the alerts against each stocks' last
- * price.
- */
- protected function timerHandler(event:*):void
- {
- var alerts:Array = (model as ProductsModel).alerts;
-
- if (alerts.length == 0) return;
-
- for (var i:int=0; i < alerts.length; i++)
- {
- var alert:Alert = alerts[i] as Alert;
- alert.message = "";
-
- if (alert.greaterThan) {
- if (alert.stock.last >= alert.value) {
- alert.message = "Now @"+alert.stock.last;
- }
- }
- else {
- if (alert.stock.last <= alert.value) {
- alert.message = "Now @"+alert.stock.last;
- }
- }
- }
-
- var newEvent:Event = new Event("alertsUpdate");
- model.dispatchEvent(newEvent);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/controller/WatchListController.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/controller/WatchListController.as b/examples/MobileTrader/src/controller/WatchListController.as
deleted file mode 100644
index 367b24f..0000000
--- a/examples/MobileTrader/src/controller/WatchListController.as
+++ /dev/null
@@ -1,137 +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 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 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).addStock(symbol);
-
- subscribe();
- }
-
- private function handleGridSelection(event:Event):void
- {
- var view:WatchListView = _strand as WatchListView;
- selectedStock = (model as ProductsModel).watchList[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).removeStock(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:Array = (model as ProductsModel).watchList;
-
- if (stockList.length == 0) return;
-
- if (index >= stockList.length) index = 0;
-
- (model as ProductsModel).updateStockData(stockList[index] as Stock);
- index++;
-
- var newEvent:Event = new Event("update");
- model.dispatchEvent(newEvent);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/models/Alert.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/models/Alert.as b/examples/MobileTrader/src/models/Alert.as
deleted file mode 100644
index 7b9dc8b..0000000
--- a/examples/MobileTrader/src/models/Alert.as
+++ /dev/null
@@ -1,94 +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 Alert extends EventDispatcher
- {
- public function Alert()
- {
- super();
- message = "";
- }
-
- private var _symbol:String;
- private var _value:Number;
- private var _greaterThan:Boolean;
- private var _message:String;
- private var _stock:Stock;
-
- [Binding("symbolChanged")]
- public function get symbol():String
- {
- return _symbol;
- }
- public function set symbol(value:String):void
- {
- _symbol = value;
- dispatchEvent(new Event("symbolChanged"));
- }
-
- [Binding("messageChanged")]
- public function get message():String
- {
- return _message;
- }
- public function set message(value:String):void
- {
- _message = value;
- dispatchEvent(new Event("messageChanged"));
- }
-
- [Binding("valueChanged")]
- public function get value():Number
- {
- return _value;
- }
- public function set value(newValue:Number):void
- {
- _value = newValue;
- dispatchEvent(new Event("valueChanged"));
- }
-
- [Binding("greaterThanChanged")]
- public function get greaterThan():Boolean
- {
- return _greaterThan;
- }
- public function set greaterThan(value:Boolean):void
- {
- _greaterThan = value;
- dispatchEvent(new Event("greaterThanChanged"));
- }
-
- [Binding("stockChanged")]
- public function get stock():Stock
- {
- return _stock;
- }
- public function set stock(value:Stock):void
- {
- _stock = value;
- dispatchEvent(new Event("stockChanged"));
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/models/AssetsModel.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/models/AssetsModel.as b/examples/MobileTrader/src/models/AssetsModel.as
deleted file mode 100755
index 8824bc5..0000000
--- a/examples/MobileTrader/src/models/AssetsModel.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 models
-{
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IStrand;
- import org.apache.flex.events.EventDispatcher;
-
- public class AssetsModel extends EventDispatcher implements IBeadModel
- {
- public function AssetsModel()
- {
- super();
- }
- private var _assetsData:Array = [
- {label:"Net Worth:", value:161984, netChange:-2.37},
- {label:"Last Month:", value:165915, netChange:10.98},
- {label:"6 Months Ago:", value:145962, netChange:16.56},
- {label:"Last Year:", value:138972, netChange:8.36}
- ];
- public function get assetsData():Array
- {
- return _assetsData;
- }
-
- public function set strand(value:IStrand):void
- {
- // not used
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/models/ProductsModel.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/models/ProductsModel.as b/examples/MobileTrader/src/models/ProductsModel.as
deleted file mode 100755
index 7fb7a22..0000000
--- a/examples/MobileTrader/src/models/ProductsModel.as
+++ /dev/null
@@ -1,160 +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;
-
- 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();
- }
-
- 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:Array = [];
-
- public function get watchList():Array
- {
- return _watchList;
- }
-
- private var _alerts:Array = [];
-
- public function get alerts():Array
- {
- return _alerts;
- }
-
- public function addAlert(value:Alert):void
- {
- for (var i:int =0; i < _alerts.length; i++)
- {
- var alert:Alert = _alerts[i] as Alert;
- if (alert.symbol == value.symbol) {
- _alerts[i] = value;
- return;
- }
- }
-
- _alerts.push(value);
- dispatchEvent(new Event("alertsUpdate"));
- }
-
- public function addStock(symbol:String):Stock
- {
- for (var i:int=0; i < _watchList.length; i++)
- {
- var stock:Stock = _watchList[i];
- if (stock.symbol == symbol) return stock;
- }
-
- stock = new Stock(symbol);
-
- _watchList.push(stock);
- dispatchEvent(new Event("update"));
-
- updateStockData(stock);
- return stock;
- }
-
- public function updateStockData(value:Stock):void
- {
- var sym:String = value.symbol;
- service.url = queryBegin + sym + queryEnd;
- service.send();
- service.addEventListener("complete", completeHandler);
- }
-
- public function removeStock(stock:Stock):void
- {
- for (var i:int=0; i < alerts.length; i++)
- {
- var alert:Alert = alerts[i] as Alert;
- if (stock.symbol == alert.symbol) {
- alerts.splice(i,1);
- break;
- }
- }
-
- for (i=0; i < _watchList.length; i++)
- {
- var s:Stock = _watchList[i] as Stock;
- if (stock.symbol == s.symbol) {
- _watchList.splice(i,1);
- break;
- }
- }
-
- dispatchEvent(new Event("alertsUpdate"));
- dispatchEvent(new Event("update"));
- }
-
- private function completeHandler(event:Event):void
- {
- var responseData:Object = collection.getItemAt(0);
-
- var sym:String = responseData["Symbol"];
- for (var i:int=0; i < _watchList.length; i++)
- {
- var stock:Stock = _watchList[i];
- if (stock.symbol == sym) {
- stock.updateFromData(responseData);
- break;
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/models/Stock.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/models/Stock.as b/examples/MobileTrader/src/models/Stock.as
deleted file mode 100755
index 9e53f47..0000000
--- a/examples/MobileTrader/src/models/Stock.as
+++ /dev/null
@@ -1,148 +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 = "";
- }
-
- 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"];
- }
-
- 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;
-
- [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"));
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/renderers/AlertRenderer.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/renderers/AlertRenderer.as b/examples/MobileTrader/src/renderers/AlertRenderer.as
deleted file mode 100644
index e683020..0000000
--- a/examples/MobileTrader/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/d33fe63c/examples/MobileTrader/src/renderers/StockRenderer.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/renderers/StockRenderer.as b/examples/MobileTrader/src/renderers/StockRenderer.as
deleted file mode 100755
index afba26f..0000000
--- a/examples/MobileTrader/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/d33fe63c/examples/MobileTrader/src/views/AlertsView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/AlertsView.mxml b/examples/MobileTrader/src/views/AlertsView.mxml
deleted file mode 100755
index 196f827..0000000
--- a/examples/MobileTrader/src/views/AlertsView.mxml
+++ /dev/null
@@ -1,100 +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.
-
--->
-<basic:View xmlns:fx="http://ns.adobe.com/mxml/2009"
- title="Alerts"
- xmlns:basic="library://ns.apache.org/flexjs/basic"
- xmlns:local="*"
- className="AlertsView" xmlns:renderers="renderers.*">
-
- <fx:Metadata>
- [Event("next")]
- </fx:Metadata>
-
- <fx:Script>
- <![CDATA[
- import org.apache.flex.core.IBeadModel;
- import org.apache.flex.core.IBeadController;
- import org.apache.flex.events.Event;
- import controller.AlertsViewController;
-
- public function set dataModel(value:IBeadModel):void
- {
- var cm:IBeadController = controller;
- (cm as AlertsViewController).model = value;
- }
- public function get dataModel():IBeadModel
- {
- var cm:IBeadController = controller;
- return (cm as AlertsViewController).model;
- }
-
- private function onAlertSet():void
- {
- dispatchEvent(new org.apache.flex.events.Event("alertSet"));
- }
- ]]>
- </fx:Script>
-
- <basic:Container x="4" y="10" >
- <basic:beads>
- <basic:HorizontalLayout />
- </basic:beads>
- <basic:Label text="Symbol:" />
- <basic:TextInput id="symbolField" />
- <basic:Label text="Value:" />
- <basic:TextInput id="valueField" />
- <basic:CheckBox text="Higher?" id="higherCheck" />
- <basic:TextButton text="Set" click="onAlertSet()" />
- </basic:Container>
-
- <basic:DataGrid x="0" y="40" width="480" height="200">
- <basic:beads>
- <basic:SimpleBinding
- eventName="alertsUpdate"
- sourceID="dataModel"
- sourcePropertyName="alerts"
- destinationPropertyName="dataProvider" />
- </basic:beads>
- <basic:columns>
- <basic:DataGridColumn label="Symbol" dataField="symbol">
- <basic:itemRenderer>
- <fx:Component>
- <basic:StringItemRenderer />
- </fx:Component>
- </basic:itemRenderer>
- </basic:DataGridColumn>
- <basic:DataGridColumn label="Alert" dataField="greaterThan">
- <basic:itemRenderer>
- <fx:Component>
- <renderers:AlertRenderer />
- </fx:Component>
- </basic:itemRenderer>
- </basic:DataGridColumn>
- <basic:DataGridColumn label="Message" dataField="message">
- <basic:itemRenderer>
- <fx:Component>
- <basic:StringItemRenderer />
- </fx:Component>
- </basic:itemRenderer>
- </basic:DataGridColumn>
- </basic:columns>
- </basic:DataGrid>
-
-</basic:View>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/views/AssetsView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/AssetsView.mxml b/examples/MobileTrader/src/views/AssetsView.mxml
deleted file mode 100755
index edf3916..0000000
--- a/examples/MobileTrader/src/views/AssetsView.mxml
+++ /dev/null
@@ -1,94 +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.
-
--->
-<basic:View xmlns:fx="http://ns.adobe.com/mxml/2009"
- title="Assets"
- xmlns:basic="library://ns.apache.org/flexjs/basic"
- xmlns:models="models.*"
- xmlns:local="*"
- className="AssetsView">
- <fx:Script>
- <![CDATA[
-
- ]]>
- </fx:Script>
-
- <fx:Metadata>
- [Event("next")]
- </fx:Metadata>
-
- <basic:beads>
- <basic:BasicLayout />
- </basic:beads>
-
- <basic:model>
- <models:AssetsModel />
- </basic:model>
-
- <basic:Container className="AssetsInner" width="480">
- <basic:beads>
- <basic:VerticalLayout />
- </basic:beads>
- <basic:style>
- <basic:SimpleCSSStyles top="0" left="0" right="0" />
- </basic:style>
-
- <basic:Label text="Summary" />
-
- <basic:DataGrid height="200" width="480">
- <basic:style>
- <basic:SimpleCSSStyles top="0" left="0" right="0" />
- </basic:style>
- <basic:beads>
- <basic:ConstantBinding
- sourceID="model"
- sourcePropertyName="assetsData"
- destinationPropertyName="dataProvider" />
- </basic:beads>
- <basic:columns>
- <basic:DataGridColumn label="Type" dataField="label" />
- <basic:DataGridColumn label="Value" dataField="value" />
- <basic:DataGridColumn label="Change" dataField="netChange" />
- </basic:columns>
- </basic:DataGrid>
-
- <basic:Label text="Performance History" />
-
- <!--<basic:BarChart id="barChart" width="320" height="250">
- <basic:beads>
- <basic:ConstantBinding
- sourceID="model"
- sourcePropertyName="assetsData"
- destinationPropertyName="dataProvider" />
- <basic:XAxisBead labelField="title" />
- </basic:beads>
- <basic:series>
- <basic:BarChartSeries yField="value"
- fillColor="0xFF964D">
- <basic:itemRenderer>
- <fx:Component>
- <basic:BoxItemRenderer />
- </fx:Component>
- </basic:itemRenderer>
- </basic:BarChartSeries>
- </basic:series>
- </basic:BarChart>-->
-
- </basic:Container>
-</basic:View>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/views/SearchView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/SearchView.mxml b/examples/MobileTrader/src/views/SearchView.mxml
deleted file mode 100755
index 6b834d7..0000000
--- a/examples/MobileTrader/src/views/SearchView.mxml
+++ /dev/null
@@ -1,37 +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.
-
--->
-<basic:View xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:basic="library://ns.apache.org/flexjs/basic"
- xmlns:apache="org.apache.flex.html.beads.*"
- xmlns:local="*"
- className="StockView">
-
- <fx:Script>
- <![CDATA[
- import org.apache.flex.mobile.StackedViewManager;
- private function onBackClick() : void
- {
- (viewManager as StackedViewManager).pop();
- }
- ]]>
- </fx:Script>
-
- <basic:Label text="Search View" x="20" y="100" />
-</basic:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/views/StockView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/StockView.mxml b/examples/MobileTrader/src/views/StockView.mxml
deleted file mode 100755
index e1dfb24..0000000
--- a/examples/MobileTrader/src/views/StockView.mxml
+++ /dev/null
@@ -1,98 +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.
-
--->
-<basic:View xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:basic="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>
-
- <basic:Container>
- <basic:beads>
- <basic:VerticalLayout />
- </basic:beads>
- <basic:style>
- <basic:SimpleCSSStyles top="10px" left="10px" />
- </basic:style>
-
- <basic:Label id="stockSymbol" text="{stock.symbol}" className="ViewTitle" />
- <basic:Label id="stockName" text="{stock.name}" className="StockName" />
-
- <basic:Container className="StockDetailArea">
- <basic:beads>
- <basic:VerticalColumnLayout numColumns="2" />
- </basic:beads>
-
- <basic:Label text="Last Price:" className="StockLabel" /> <basic:Label id="lastPrice" className="StockValue" />
- <basic:Label text="Open Price:" className="StockLabel" /> <basic:Label id="openPrice" className="StockValue" />
- <basic:Label text="Low Price:" className="StockLabel" /> <basic:Label id="lowPrice" className="StockValue" />
- <basic:Label text="High Price:" className="StockLabel" /> <basic:Label id="highPrice" className="StockValue" />
- <basic:Label text="Change: " className="StockLabel" /> <basic:Label id="changeAmount" className="StockValue" />
- </basic:Container>
-
- <basic:Container className="StockDetailArea">
- <basic:TextButton text="Remove From List" width="200" className="StockRemoveButton" click="removeFromList()" />
- </basic:Container>
- </basic:Container>
-</basic:View>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/MobileTrader/src/views/WatchListView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/WatchListView.mxml b/examples/MobileTrader/src/views/WatchListView.mxml
deleted file mode 100755
index b12fc73..0000000
--- a/examples/MobileTrader/src/views/WatchListView.mxml
+++ /dev/null
@@ -1,150 +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:View 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;
- }
- 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;
- (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="50%" height="90%" change="selectRow()" className="WatchListDataGrid">
- <js:beads>
- <js:SimpleBinding
- eventName="update"
- sourceID="dataModel"
- sourcePropertyName="watchList"
- destinationPropertyName="dataProvider" />
- </js:beads>
- <js:columns>
- <js:DataGridColumn label="Symbol" dataField="symbol">
- <js:itemRenderer>
- <fx:Component>
- <js:StringItemRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="Open" dataField="open">
- <js:itemRenderer>
- <fx:Component>
- <renderers:StockRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="Last" dataField="last" >
- <js:itemRenderer>
- <fx:Component>
- <renderers:StockRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="High" dataField="high" >
- <js:itemRenderer>
- <fx:Component>
- <renderers:StockRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- <js:DataGridColumn label="Low" dataField="low" >
- <js:itemRenderer>
- <fx:Component>
- <renderers:StockRenderer />
- </fx:Component>
- </js:itemRenderer>
- </js:DataGridColumn>
- </js:columns>
- </js:DataGrid>
-
-</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/TodoListSampleApp/build.xml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/build.xml b/examples/TodoListSampleApp/build.xml
deleted file mode 100644
index d416664..0000000
--- a/examples/TodoListSampleApp/build.xml
+++ /dev/null
@@ -1,73 +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="todoListSampleApp" default="main" basedir=".">
- <property name="FLEXJS_HOME" location="../.."/>
- <property name="example" value="TodoListSampleApp" />
-
- <property file="${FLEXJS_HOME}/env.properties"/>
- <property environment="env"/>
- <property file="${FLEXJS_HOME}/build.properties"/>
- <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
- <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
- type="file"
- property="FALCON_HOME"
- value="${env.FALCON_HOME}"/>
-
- <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar"
- type="file"
- property="FALCON_HOME"
- value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/>
-
- <available file="${env.FALCONJX_HOME}/lib/jsc.jar"
- type="file"
- property="FALCONJX_HOME"
- value="${env.FALCONJX_HOME}"/>
-
- <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar"
- type="file"
- property="FALCONJX_HOME"
- value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/>
-
- <available file="${env.GOOG_HOME}/closure/goog/base.js"
- type="file"
- property="GOOG_HOME"
- value="${env.GOOG_HOME}"/>
-
- <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js"
- type="file"
- property="GOOG_HOME"
- value="${FLEXJS_HOME}/js/lib/google/closure-library"/>
-
- <include file="${basedir}/../build_example.xml" />
-
- <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
- </target>
- <!-- Uncomment to reproduce cross-compilation error in compilejs step
- <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/d33fe63c/examples/TodoListSampleApp/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/README.txt b/examples/TodoListSampleApp/src/README.txt
deleted file mode 100644
index b3d96b9..0000000
--- a/examples/TodoListSampleApp/src/README.txt
+++ /dev/null
@@ -1,22 +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
-
-This sample is currently under construction.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/TodoListSampleApp.mxml b/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
deleted file mode 100644
index e734026..0000000
--- a/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
+++ /dev/null
@@ -1,43 +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:js="library://ns.apache.org/flexjs/basic"
- xmlns:controllers="sample.todo.controllers.*"
- xmlns:models="sample.todo.models.*"
- xmlns:views="sample.todo.views.*">
-
- <js:valuesImpl>
- <js:SimpleCSSValuesImpl/>
- </js:valuesImpl>
-
- <js:controller>
- <controllers:TodoListController/>
- </js:controller>
-
- <js:model>
- <models:TodoListModel/>
- </js:model>
-
- <js:initialView>
- <views:TodoListView/>
- </js:initialView>
-
-</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as b/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as
deleted file mode 100644
index cbc4b1e..0000000
--- a/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as
+++ /dev/null
@@ -1,62 +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 sample.todo.controllers {
- import sample.todo.events.TodoListEvent;
- import sample.todo.models.TodoListModel;
-
- import org.apache.flex.core.Application;
- import org.apache.flex.core.IDocument;
- import org.apache.flex.events.Event;
-
- public class TodoListController implements IDocument {
- private var app:TodoListSampleApp;
-
- public function TodoListController(app:Application = null) {
- if (app != null) {
- app = app as TodoListSampleApp;
- }
- }
-
- /**
- *
- */
- public function setDocument(document:Object, id:String = null):void {
- app = document as TodoListSampleApp;
- app.addEventListener("viewChanged", viewChangeHandler);
- }
-
- /**
- *
- * @param event
- */
- private function viewChangeHandler(event:Event):void {
- app.initialView.addEventListener(TodoListEvent.LOG_TODO, logTodo);
- }
-
- /**
- * log todo
- * @param event
- */
- public function logTodo(evt:TodoListEvent):void {
- // still need to change model a view get the changes
- var todoModel:TodoListModel = app.model as TodoListModel;
- //todoModel.todos.push({title: evt.todo, selected: false});
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as b/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as
deleted file mode 100644
index c4d5fd1..0000000
--- a/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as
+++ /dev/null
@@ -1,35 +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 sample.todo.events {
- import org.apache.flex.events.Event;
-
- public class TodoListEvent extends Event {
-
- public static const LOG_TODO:String = "logTodoEvent";
-
- /**
- * the todo to log
- */
- public var todo:String = null;
-
- public function TodoListEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) {
- super(type, bubbles, cancelable);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as b/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as
deleted file mode 100644
index e4d06b1..0000000
--- a/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as
+++ /dev/null
@@ -1,42 +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 sample.todo.models {
- import org.apache.flex.events.EventDispatcher;
-
- public class TodoListModel extends EventDispatcher {
- public function TodoListModel() {
- super();
- }
-
- private var _todos:Array = [
- {title: "Get something", selected: true},
- {title: "Do this", selected: true},
- {title: "Do that", selected: false}
- ];
-
- [Bindable]
- public function get todos():Array {
- return _todos;
- }
-
- public function set todos(value:Array):void {
- _todos = value;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as b/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as
deleted file mode 100644
index a4fa9f1..0000000
--- a/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as
+++ /dev/null
@@ -1,69 +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 sample.todo.renderers {
- import org.apache.flex.html.Button;
- import org.apache.flex.html.CheckBox;
- import org.apache.flex.html.Label;
- import org.apache.flex.html.supportClasses.DataItemRenderer;
-
- public class TodoItemRenderer extends DataItemRenderer {
- public function TodoItemRenderer() {
- super();
- }
-
- private var checkbox:CheckBox;
- private var title:Label;
- private var removeButton:Button;
-
- override public function addedToParent():void {
- super.addedToParent();
-
- checkbox = new CheckBox();
- addElement(checkbox);
-
- title = new Label();
- addElement(title);
-
- removeButton = new Button();
- addElement(removeButton);
- }
-
- override public function set data(value:Object):void {
- super.data = value;
-
- checkbox.selected = data.selected;
- title.text = data.title;
- }
-
- override public function adjustSize():void {
- var cy:Number = this.height / 2;
-
- checkbox.x = 10;
- checkbox.y = cy;
-
- title.x = 60;
- title.y = cy;
-
- removeButton.x = 300;
- removeButton.y = cy;
-
- updateRenderer();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml b/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml
deleted file mode 100644
index 153fb76..0000000
--- a/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml
+++ /dev/null
@@ -1,109 +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:svg="library://ns.apache.org/flexjs/svg">
-
- <fx:Script>
- <![CDATA[
- import sample.todo.events.TodoListEvent;
-
- /**
- * add to the list the text entered by the user, in the text box,
- * as a new todo list item
- */
- public function logTodo():void {
- var logEvent:TodoListEvent = new TodoListEvent(TodoListEvent.LOG_TODO);
- logEvent.todo = todoInput.text;
- dispatchEvent(logEvent);
-
- //todoList.width = Math.random() * 200; // to show changes vía ENTER key
- }
-
- /**
- * show all todos
- */
- private function showAll():void {
- }
-
- /**
- * show active todos
- */
- private function showActive():void {
- }
-
- /**
- * show completed todos
- */
- private function showCompleted():void {
- }
- ]]>
- </fx:Script>
-
- <js:Panel title="FlexJS TODO List" width="600">
- <js:beads>
- <js:VerticalLayout/>
- </js:beads>
-
- <js:TextInput id="todoInput"
- width="300"
- change="logTodo()"/>
-
- <js:List id="todoList"
- itemRenderer="sample.todo.renderers.TodoItemRenderer"
- width="300" height="400">
- <!-- dataProvider="{TodoListModel(applicationModel).todos}" -->
- <js:beads>
- <js:ConstantBinding sourceID="applicationModel"
- sourcePropertyName="todos"
- destinationPropertyName="dataProvider"/>
- </js:beads>
- </js:List>
-
- <js:Container>
- <js:beads>
- <js:HorizontalLayout/>
- </js:beads>
- <js:Label id="statusLabel" text="N items left"/>
- <svg:TextButton text="All" width="100" height="30" click="showAll()" />
- <svg:TextButton text="Active" width="100" height="30" click="showActive()" />
- <svg:TextButton text="Completed" width="100" height="30" click="showCompleted()" />
- </js:Container>
- </js:Panel>
-
- <fx:Style>
- @namespace basic "library://ns.apache.org/flexjs/basic";
- @namespace renderers "sample.todo.renderers.*";
-
- /* use className="todoList" on the List element in place of itemRenderer if you want to specify
- * the itemRenderer in a style definition along with other settings.
- */
- .todoList {
- IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.beads.DataItemRendererFactoryForArrayData");
- IItemRenderer: ClassReference("sample.todo.renderers.TodoItemRenderer");
- }
-
- renderers|TodoItemRenderer {
- height: 40;
- IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
- }
- </fx:Style>
-
-</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/ChartExample/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ChartExample/build.xml b/examples/flexjs/ChartExample/build.xml
new file mode 100644
index 0000000..60306cb
--- /dev/null
+++ b/examples/flexjs/ChartExample/build.xml
@@ -0,0 +1,74 @@
+<?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="chartexample" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="ChartExample" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${env.FALCON_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/>
+
+ <available file="${env.FALCONJX_HOME}/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${env.FALCONJX_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/>
+
+ <available file="${env.GOOG_HOME}/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${env.GOOG_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${FLEXJS_HOME}/js/lib/google/closure-library"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+<!-- temp remove build_example.compilejs -->
+ <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/d33fe63c/examples/flexjs/ChartExample/src/ChartExample.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ChartExample/src/ChartExample.mxml b/examples/flexjs/ChartExample/src/ChartExample.mxml
new file mode 100644
index 0000000..6cf51d9
--- /dev/null
+++ b/examples/flexjs/ChartExample/src/ChartExample.mxml
@@ -0,0 +1,37 @@
+<?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"
+ >
+
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:model>
+ <models:ProductsModel />
+ </js:model>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+</js:Application>
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/ChartExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ChartExample/src/MyInitialView.mxml b/examples/flexjs/ChartExample/src/MyInitialView.mxml
new file mode 100644
index 0000000..f83b059
--- /dev/null
+++ b/examples/flexjs/ChartExample/src/MyInitialView.mxml
@@ -0,0 +1,312 @@
+<?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:local="*"
+ xmlns:models="models.*"
+ initComplete="testit()"
+ >
+ <fx:Script>
+ <![CDATA[
+
+ import models.ProductsModel;
+
+ private function testit():void
+ {
+ var m:ProductsModel = applicationModel as ProductsModel;
+ m.generateWaves(50);
+ waveChart.dataProvider = m.wave1;
+ }
+
+ ]]>
+ </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;
+ }
+ </fx:Style>
+
+ <js:Label id="output" x="50" y="30" width="100" />
+
+ <js:ColumnChart id="columnChart" x="20" y="20" width="400" height="200" className="AllCharts">
+ <js:beads>
+ <js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="productList"
+ destinationPropertyName="dataProvider" />
+ <js:HorizontalCategoryAxisBead categoryField="title" />
+ <js:VerticalLinearAxisBead valueField="sales2013" />
+ </js:beads>
+ <js:series>
+ <js:ColumnSeries yField="sales2013">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#FF964D" alpha="1.0" />
+ </js:fill>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ </js:ColumnSeries>
+ <js:ColumnSeries yField="sales2014">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#964DFF" alpha="1.0" />
+ </js:fill>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ </js:ColumnSeries>
+ </js:series>
+ </js:ColumnChart>
+
+ <js:BarChart id="barChart" x="500" y="20" width="400" height="300" className="AllCharts">
+ <js:beads>
+ <js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="productList"
+ destinationPropertyName="dataProvider" />
+ <js:VerticalCategoryAxisBead categoryField="title" />
+ <js:HorizontalLinearAxisBead valueField="sales2013" />
+ </js:beads>
+ <js:series>
+ <js:BarSeries xField="sales2013">
+ <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:BarSeries xField="sales2014">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#964DFF" alpha="1.0" />
+ </js:fill>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ </js:BarSeries>
+ </js:series>
+ </js:BarChart>
+
+ <js:StackedColumnChart id="stackedChart" x="20" y="300" width="400" height="200" className="AllCharts">
+ <js:beads>
+ <js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="productList"
+ destinationPropertyName="dataProvider" />
+ <js:HorizontalCategoryAxisBead categoryField="title" />
+ </js:beads>
+ <js:series>
+ <js:ColumnSeries yField="sales2013">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#FF964D" alpha="0.5" />
+ </js:fill>
+ <js:stroke>
+ <js:SolidColorStroke color="#FF964D" weight="2" />
+ </js:stroke>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ </js:ColumnSeries>
+ <js:ColumnSeries yField="sales2014">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#964DFF" alpha="0.5" />
+ </js:fill>
+ <js:stroke>
+ <js:SolidColorStroke color="#964DFF" weight="2" />
+ </js:stroke>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ </js:ColumnSeries>
+ </js:series>
+ </js:StackedColumnChart>
+
+ <js:StackedBarChart id="stackedBarChart" x="500" y="400" width="400" height="300" className="AllCharts">
+ <js:beads>
+ <js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="productList"
+ destinationPropertyName="dataProvider" />
+ <js:VerticalCategoryAxisBead categoryField="title" />
+ </js:beads>
+ <js:series>
+ <js:BarSeries xField="sales2013">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#FF964D" alpha="0.5" />
+ </js:fill>
+ <js:stroke>
+ <js:SolidColorStroke color="#FF964D" weight="2" />
+ </js:stroke>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ </js:BarSeries>
+ <js:BarSeries xField="sales2014">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#964DFF" alpha="0.5" />
+ </js:fill>
+ <js:stroke>
+ <js:SolidColorStroke color="#964DFF" weight="2" />
+ </js:stroke>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ </js:BarSeries>
+ </js:series>
+ </js:StackedBarChart>
+
+ <js:PieChart id="pieChart" x="20" y="550" width="200" height="200" className="AllCharts">
+ <js:beads>
+ <js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="productList"
+ destinationPropertyName="dataProvider" />
+ </js:beads>
+ <js:series>
+ <js:PieSeries dataField="sales2013">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:WedgeItemRenderer />
+ </fx:Component>
+ </js:itemRenderer>
+ </js:PieSeries>
+ </js:series>
+ </js:PieChart>
+
+ <js:LineChart id="lineChart" x="500" y="750" width="400" height="200" className="AllCharts">
+ <js:beads>
+ <js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="productList"
+ destinationPropertyName="dataProvider" />
+ <js:HorizontalLinearAxisBead valueField="detail" />
+ <js:VerticalLinearAxisBead valueField="sales2013" />
+ <js:LineChartLinearVsLinearLayout />
+ </js:beads>
+ <js:series>
+ <js:LineSeries xField="detail" yField="sales2013">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#FF964D" alpha="1" />
+ </js:fill>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ <js:lineSegmentRenderer>
+ <fx:Component>
+ <js:LineSegmentItemRenderer>
+ <js:stroke>
+ <js:SolidColorStroke color="#FF964D" weight="3" alpha="0.8" />
+ </js:stroke>
+ </js:LineSegmentItemRenderer>
+ </fx:Component>
+ </js:lineSegmentRenderer>
+ </js:LineSeries>
+ <js:LineSeries xField="detail" yField="sales2014">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#964DFF" alpha="1" />
+ </js:fill>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ <js:lineSegmentRenderer>
+ <fx:Component>
+ <js:LineSegmentItemRenderer>
+ <js:stroke>
+ <js:SolidColorStroke color="#964DFF" weight="3" alpha="0.8" />
+ </js:stroke>
+ </js:LineSegmentItemRenderer>
+ </fx:Component>
+ </js:lineSegmentRenderer>
+ </js:LineSeries>
+ </js:series>
+ </js:LineChart>
+
+ <js:LineChart id="waveChart" x="20" y="800" width="400" height="200" className="AllCharts">
+ <js:beads>
+ <js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="wave"
+ destinationPropertyName="dataProvider" />
+ <js:HorizontalLinearAxisBead valueField="x" />
+ <js:VerticalLinearAxisBead valueField="sin" minimum="-1" maximum="1" />
+ <js:LineChartLinearVsLinearLayout />
+ </js:beads>
+ <js:series>
+ <js:LineSeries xField="x" yField="sin">
+ <js:lineSegmentRenderer>
+ <fx:Component>
+ <js:LineSegmentItemRenderer>
+ <js:stroke>
+ <js:SolidColorStroke color="#964DFF" weight="5" alpha="1" />
+ </js:stroke>
+ </js:LineSegmentItemRenderer>
+ </fx:Component>
+ </js:lineSegmentRenderer>
+ </js:LineSeries>
+ <js:LineSeries xField="x" yField="cos">
+ <js:lineSegmentRenderer>
+ <fx:Component>
+ <js:LineSegmentItemRenderer>
+ <js:stroke>
+ <js:SolidColorStroke color="#FF964D" weight="5" alpha="1" />
+ </js:stroke>
+ </js:LineSegmentItemRenderer>
+ </fx:Component>
+ </js:lineSegmentRenderer>
+ </js:LineSeries>
+ </js:series>
+ </js:LineChart>
+
+</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/ChartExample/src/README.txt
----------------------------------------------------------------------
diff --git a/examples/flexjs/ChartExample/src/README.txt b/examples/flexjs/ChartExample/src/README.txt
new file mode 100644
index 0000000..9179bd3
--- /dev/null
+++ b/examples/flexjs/ChartExample/src/README.txt
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+This example demonstrates how to construct a BarChart and a PieChart. The BarChart
+is composed of two series while the PieChart has one (and only one) series.
+
+At this time, PieChart supports only one series, but BarChart can support several.
+
+PieChart uses SVG on the HTML/JavaScript side to draw the wedges. This is still
+a "to do" item for BarChart, but it should be done. Further charts can follow
+the same pattern.
+
+PieChart uses a special ChartDataGroup (since all charts, so far, are based on
+List) that provides an SVG element on the JavaScript side. BarChart can make use
+of the same construct and have BoxItemRenderer create an SVG <rect> element.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/ChartExample/src/SpeedTestView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/ChartExample/src/SpeedTestView.mxml b/examples/flexjs/ChartExample/src/SpeedTestView.mxml
new file mode 100644
index 0000000..d1d4b2c
--- /dev/null
+++ b/examples/flexjs/ChartExample/src/SpeedTestView.mxml
@@ -0,0 +1,187 @@
+<?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:local="*"
+ xmlns:models="models.*"
+ >
+ <fx:Script>
+ <![CDATA[
+ import models.ProductsModel;
+
+ import org.apache.flex.events.Event;
+
+ private var startTime:Date;
+ private var endTime:Date;
+
+ private function startTimingSVG():void
+ {
+ var n:Number = Number(numPoints.text);
+
+ var m:ProductsModel = applicationModel as ProductsModel;
+ m.generateWaves(n);
+
+ trace("Will start timing");
+ startTime = new Date();
+ svgChart.addEventListener("layoutComplete",wave1Complete);
+ svgChart.dataProvider = m.wave1;
+ }
+
+ private function wave1Complete(event:org.apache.flex.events.Event):void
+ {
+ endTime = new Date();
+ var diff:Number = endTime.getTime() - startTime.getTime();
+ svgChartResults.text = diff+" msecs";
+ }
+
+ private function startTimingReg():void
+ {
+ var n:Number = Number(numPoints.text);
+
+ var m:ProductsModel = applicationModel as ProductsModel;
+ m.generateWaves(n);
+
+ trace("Will start timing");
+ startTime = new Date();
+ regChart.addEventListener("layoutComplete",wave2Complete);
+ regChart.dataProvider = m.wave1;
+ }
+
+ private function wave2Complete(event:org.apache.flex.events.Event):void
+ {
+ endTime = new Date();
+ var diff:Number = endTime.getTime() - startTime.getTime();
+ regChartResults.text = diff+" msecs";
+ }
+ ]]>
+ </fx:Script>
+
+ <fx:Style>
+ @namespace models "models.*";
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+
+ .hsline {
+ IDataGroup: ClassReference("org.apache.flex.charts.optimized.SVGChartDataGroup");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.optimized.SVGChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.optimized.SVGChartAxisGroup");
+ }
+ </fx:Style>
+
+ <js:Container x="20" y="20">
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:Label text="Points:" />
+ <js:TextInput id="numPoints" text="300" />
+ </js:Container>
+
+ <!-- SVG Line Chart -->
+
+ <js:Label text="SVG Chart" x="250" y="80" />
+
+ <js:LineChart id="svgChart" x="21" y="100" width="400" height="200" className="hsline">
+ <js:beads>
+ <!--<js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="wave"
+ destinationPropertyName="dataProvider" />-->
+ <js:HorizontalLinearAxisBead valueField="x" />
+ <js:VerticalLinearAxisBead valueField="sin" minimum="-1" maximum="1" />
+ <js:LineChartLinearVsLinearLayout />
+ </js:beads>
+ <js:series>
+ <js:LineSeries xField="x" yField="sin">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:SVGBoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#FF44FF" alpha="1" />
+ </js:fill>
+ </js:SVGBoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ <js:lineSegmentRenderer>
+ <fx:Component>
+ <js:SVGLineSegmentItemRenderer>
+ <js:stroke>
+ <js:SolidColorStroke color="#964DFF" weight="2" alpha="1" />
+ </js:stroke>
+ </js:SVGLineSegmentItemRenderer>
+ </fx:Component>
+ </js:lineSegmentRenderer>
+ </js:LineSeries>
+ </js:series>
+ </js:LineChart>
+
+ <!-- Regular Line Chart -->
+
+ <js:Label text="Reg Chart" x="650" y="80" />
+
+ <js:LineChart id="regChart" x="500" y="100" width="400" height="200">
+ <js:beads>
+ <!--<js:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="wave2"
+ destinationPropertyName="dataProvider" />-->
+ <js:HorizontalLinearAxisBead valueField="x" />
+ <js:VerticalLinearAxisBead valueField="sin" minimum="-1" maximum="1" />
+ <js:LineChartLinearVsLinearLayout />
+ </js:beads>
+ <js:series>
+ <js:LineSeries xField="x" yField="sin">
+ <js:itemRenderer>
+ <fx:Component>
+ <js:BoxItemRenderer>
+ <js:fill>
+ <js:SolidColor color="#99FF99" alpha="1" />
+ </js:fill>
+ </js:BoxItemRenderer>
+ </fx:Component>
+ </js:itemRenderer>
+ <js:lineSegmentRenderer>
+ <fx:Component>
+ <js:LineSegmentItemRenderer>
+ <js:stroke>
+ <js:SolidColorStroke color="#33DD33" weight="2" alpha="1" />
+ </js:stroke>
+ </js:LineSegmentItemRenderer>
+ </fx:Component>
+ </js:lineSegmentRenderer>
+ </js:LineSeries>
+ </js:series>
+ </js:LineChart>
+
+ <js:Container x="150" y="325">
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:TextButton text="SVG Go" click="startTimingSVG()" />
+ <js:Label text=" (results)" id="svgChartResults" />
+ </js:Container>
+
+ <js:Container x="650" y="325">
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:TextButton text="Reg Go" click="startTimingReg()" />
+ <js:Label text=" (results)" id="regChartResults" />
+ </js:Container>
+
+</js:ViewBase>