You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2014/04/22 20:38:21 UTC
git commit: [flex-asjs] [refs/heads/develop] - MobileTrader example:
AS example that cross-compiles to JS and can be executed on a mobile device
using PhoneGap.
Repository: flex-asjs
Updated Branches:
refs/heads/develop 284187bdf -> 7c0b48a53
MobileTrader example: AS example that cross-compiles to JS and can be executed on a mobile device using PhoneGap.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/7c0b48a5
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/7c0b48a5
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/7c0b48a5
Branch: refs/heads/develop
Commit: 7c0b48a532906c6e2b3c04677171565448798fa7
Parents: 284187b
Author: Peter Ent <pe...@apache.org>
Authored: Tue Apr 22 14:38:09 2014 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Tue Apr 22 14:38:09 2014 -0400
----------------------------------------------------------------------
examples/MobileTrader/build.xml | 45 +++++
examples/MobileTrader/src/MobileTrader.mxml | 36 ++++
examples/MobileTrader/src/MyInitialView.mxml | 130 +++++++++++++++
.../MobileTrader/src/assets/arrow_left_24.png | Bin 0 -> 47785 bytes
examples/MobileTrader/src/assets/background.png | Bin 0 -> 49376 bytes
examples/MobileTrader/src/assets/logo.png | Bin 0 -> 55223 bytes
examples/MobileTrader/src/controller/Feed.as | 162 ++++++++++++++++++
examples/MobileTrader/src/models/AssetsModel.as | 47 ++++++
.../MobileTrader/src/models/ProductsModel.as | 51 ++++++
examples/MobileTrader/src/models/Stock.as | 42 +++++
.../src/org/apache/flex/html/TabBar.as | 76 +++++++++
.../apache/flex/mobile/INavigationController.as | 47 ++++++
.../org/apache/flex/mobile/IViewController.as | 45 +++++
.../apache/flex/mobile/NavigationController.as | 107 ++++++++++++
.../src/org/apache/flex/mobile/TabController.as | 163 +++++++++++++++++++
.../org/apache/flex/mobile/ViewController.as | 68 ++++++++
.../MobileTrader/src/renderers/StockRenderer.as | 47 ++++++
examples/MobileTrader/src/views/AlertsView.mxml | 36 ++++
examples/MobileTrader/src/views/AssetsView.mxml | 83 ++++++++++
examples/MobileTrader/src/views/StockView.mxml | 45 +++++
.../MobileTrader/src/views/WatchListView.mxml | 114 +++++++++++++
examples/build.xml | 1 +
22 files changed, 1345 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/build.xml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/build.xml b/examples/MobileTrader/build.xml
new file mode 100644
index 0000000..a7885f0
--- /dev/null
+++ b/examples/MobileTrader/build.xml
@@ -0,0 +1,45 @@
+<?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="mobiletrader" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="MobileTrader" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+ <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
+ <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/MobileTrader.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/MobileTrader.mxml b/examples/MobileTrader/src/MobileTrader.mxml
new file mode 100644
index 0000000..cc9a43c
--- /dev/null
+++ b/examples/MobileTrader/src/MobileTrader.mxml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!---
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:models="models.*"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ >
+
+ <basic:valuesImpl>
+ <basic:SimpleCSSValuesImpl />
+ </basic:valuesImpl>
+ <basic:model>
+ <models:ProductsModel />
+ </basic:model>
+ <basic:initialView>
+ <local:MyInitialView />
+ </basic:initialView>
+</basic:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/MyInitialView.mxml b/examples/MobileTrader/src/MyInitialView.mxml
new file mode 100644
index 0000000..12a7907
--- /dev/null
+++ b/examples/MobileTrader/src/MyInitialView.mxml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:views="views.*"
+ xmlns:mobile="org.apache.flex.mobile.*"
+ xmlns:html="org.apache.flex.html.*">
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.core.UIBase;
+
+ import views.AlertsView;
+ import views.AssetsView;
+ import views.WatchListView;
+
+ private var currentView:UIBase;
+
+ private function onTabChange() : void
+ {
+ navController.selectedIndex = tabBar.selectedIndex;
+ }
+ ]]>
+ </fx:Script>
+
+ <fx:Style>
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+ @namespace mobile "org.apache.flex.mobile.*";
+ @namespace views "views.*";
+
+ basic|Container {
+ background-color: #FFFFFF;
+ }
+
+ .BackButton:hover {
+ background-image: url('assets/arrow_left_24.png');
+ }
+
+ .BackButton:active {
+ background-image: url('assets/arrow_left_24.png');
+ }
+
+ .BackButton {
+ background-image: url('assets/arrow_left_24.png');
+ }
+
+ .AssetsInner {
+ padding: 10px;
+ }
+
+ views|AssetsView {
+ width: 480px;
+ height: 640px;
+ }
+
+ views|WatchListView {
+ width: 480px;
+ height: 640px;
+ }
+
+ views|StockView {
+ width: 480px;
+ height: 640px;
+ }
+
+ views|AlertsView {
+ width: 480px;
+ height: 640px;
+ }
+
+ .TabBar {
+ height: 50px;
+ }
+
+ .redCell {
+ color: #FF0000;
+ }
+
+ .greenCell {
+ color: #00FF00;
+ }
+
+ </fx:Style>
+
+ <mobile:TabController id="navController" width="320" height="480" x="0" y="0" >
+ <mobile:views>
+ <mobile:NavigationController>
+ <mobile:views>
+ <views:AssetsView id="assetsView" />
+ </mobile:views>
+ </mobile:NavigationController>
+ <mobile:NavigationController>
+ <mobile:views>
+ <views:WatchListView id="watchListView" />
+ </mobile:views>
+ </mobile:NavigationController>
+ <mobile:NavigationController>
+ <mobile:views>
+ <views:AlertsView id="alertsView" />
+ </mobile:views>
+ </mobile:NavigationController>
+ </mobile:views>
+ </mobile:TabController>
+
+ <html:TabBar id="tabBar" width="320" x="0" y="480" change="onTabChange()" className="TabBar">
+ <html:beads>
+ <basic:ConstantBinding
+ sourceID="applicationModel"
+ sourcePropertyName="tabList"
+ destinationPropertyName="dataProvider" />
+ </html:beads>
+ </html:TabBar>
+
+</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/assets/arrow_left_24.png
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/assets/arrow_left_24.png b/examples/MobileTrader/src/assets/arrow_left_24.png
new file mode 100755
index 0000000..a3019ba
Binary files /dev/null and b/examples/MobileTrader/src/assets/arrow_left_24.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/assets/background.png
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/assets/background.png b/examples/MobileTrader/src/assets/background.png
new file mode 100755
index 0000000..87bbd59
Binary files /dev/null and b/examples/MobileTrader/src/assets/background.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/assets/logo.png
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/assets/logo.png b/examples/MobileTrader/src/assets/logo.png
new file mode 100755
index 0000000..0fb0f21
Binary files /dev/null and b/examples/MobileTrader/src/assets/logo.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/controller/Feed.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/controller/Feed.as b/examples/MobileTrader/src/controller/Feed.as
new file mode 100755
index 0000000..043f31a
--- /dev/null
+++ b/examples/MobileTrader/src/controller/Feed.as
@@ -0,0 +1,162 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////s
+package controller
+{
+// import flash.events.TimerEvent;
+
+ import models.Stock;
+
+ 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;
+
+ [Event("change",org.apache.flex.events.Event)]
+
+ public class Feed extends EventDispatcher implements IBeadModel
+ {
+ protected var index:int = 0;
+
+ protected var updateOrder:Array = [6,4,1,7,0,3,2,5]; // used to simulated randomness of updates
+
+ protected var timer:Timer;
+
+ protected var stockMap:Object;
+
+ private var _stockList:Array;
+ public function get stockList():Array
+ {
+ return _stockList;
+ }
+ public function set stockList(value:Array):void
+ {
+ _stockList = value;
+ }
+
+ public function set strand(value:IStrand):void
+ {
+ // not used
+ }
+
+ public function Feed()
+ {
+ stockMap = new Object();
+ stockList = new Array();
+
+ stockList.push(new Stock("XOM", 81.39));
+ stockList.push(new Stock("WMT", 51.47));
+ stockList.push(new Stock("CVX", 102.93));
+ stockList.push(new Stock("AIG", 36.01));
+ stockList.push(new Stock("IBM", 155.49));
+ stockList.push(new Stock("SAP", 57.53));
+ stockList.push(new Stock("MOT", 41.50));
+ stockList.push(new Stock("MCD", 73));
+
+ var stockCount:int = stockList.length;
+
+ for (var k:int = 0; k < stockCount; k++)
+ {
+ var s:Stock = stockList[k] as Stock;
+ s.open = s.last;
+ s.high = s.last;
+ s.low = s.last;
+ s.change = 0;
+ stockMap[s.symbol] = s;
+ }
+
+ // Simulate history for the last 2 minutes
+ for (var i:int=0; i < 120 ; i++)
+ {
+ for (var j:int=0 ; j<stockCount ; j++)
+ {
+ simulateChange(stockList[j] as Stock, false);
+ }
+ }
+ timer = new Timer(1000 / 4, 0);
+ timer.addEventListener("timer", timerHandler);
+ }
+
+ public function subscribe():void
+ {
+ if (!timer.running)
+ {
+ timer.start();
+ }
+ }
+
+ public function unsubscribe():void
+ {
+ if (timer.running)
+ {
+ timer.stop();
+ }
+ }
+
+ protected function timerHandler(event:*):void
+ {
+ if (index >= stockList.length) index = 0;
+ simulateChange(stockList[updateOrder[index]] as Stock, true);
+ index++;
+
+ var newEvent:Event = new Event("update");
+ this.dispatchEvent(newEvent);
+ }
+
+ protected function simulateChange(stock:Stock, removeFirst:Boolean = true):void
+ {
+ var maxChange:Number = stock.open * 0.005;
+ var change:Number = maxChange - Math.random() * maxChange * 2;
+
+ change = change == 0 ? 0.01 : change;
+
+ var newValue:Number = stock.last + change;
+
+ if (newValue > stock.open * 1.15 || newValue < stock.open * 0.85)
+ {
+ change = -change;
+ newValue = stock.last + change;
+ }
+
+ stock.change = change;
+ stock.last = newValue;
+
+ if (stock.last > stock.high)
+ {
+ stock.high = stock.last;
+ }
+ else if (stock.last < stock.low || stock.low == 0)
+ {
+ stock.low = stock.last;
+ }
+
+ if (!stock.history)
+ {
+ stock.history = new Array();
+ }
+ if (removeFirst)
+ {
+ stock.history.splice(1,0);
+ }
+ stock.history.push({high: stock.high, low: stock.low, open: stock.open, last: stock.last});
+
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/models/AssetsModel.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/models/AssetsModel.as b/examples/MobileTrader/src/models/AssetsModel.as
new file mode 100644
index 0000000..8824bc5
--- /dev/null
+++ b/examples/MobileTrader/src/models/AssetsModel.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 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/7c0b48a5/examples/MobileTrader/src/models/ProductsModel.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/models/ProductsModel.as b/examples/MobileTrader/src/models/ProductsModel.as
new file mode 100644
index 0000000..dd1cf2e
--- /dev/null
+++ b/examples/MobileTrader/src/models/ProductsModel.as
@@ -0,0 +1,51 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.EventDispatcher;
+
+ public class ProductsModel extends EventDispatcher
+ {
+ public function ProductsModel()
+ {
+ }
+
+ private var _tabList:Array = ["Assets", "Watch", "Alerts"];
+ public function get tabList():Array
+ {
+ return _tabList;
+ }
+
+ private var _stockData:Array = [
+ {stock:"XOM", open:81.39, last:86.22, high:88.40, low:81.30, image:""},
+ {stock:"WMT", open:51.47, last:52.00, high:52.50, low:51.04, image:""},
+ {stock:"CVX", open:102.93, last:104.13, high:104.41, low:101.15, image:""}
+ ];
+ public function get stockData():Array
+ {
+ return _stockData;
+ }
+
+ private var _labelFields:Array = [ "id", "title", "detail" ];
+ public function get labelFields():Array
+ {
+ return _labelFields;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/models/Stock.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/models/Stock.as b/examples/MobileTrader/src/models/Stock.as
new file mode 100755
index 0000000..49e63d2
--- /dev/null
+++ b/examples/MobileTrader/src/models/Stock.as
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ public class Stock
+ {
+ public var symbol:String;
+ public var name:String;
+ public var low:Number;
+ public var high:Number;
+ public var open:Number;
+ public var last:Number;
+ public var change:Number = 0;
+ public var date:Date;
+
+ public var history:Array;
+
+ public function Stock(symbol:String, last:Number)
+ {
+ this.symbol = symbol;
+ this.last = last;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/org/apache/flex/html/TabBar.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/org/apache/flex/html/TabBar.as b/examples/MobileTrader/src/org/apache/flex/html/TabBar.as
new file mode 100644
index 0000000..0f354d8
--- /dev/null
+++ b/examples/MobileTrader/src/org/apache/flex/html/TabBar.as
@@ -0,0 +1,76 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.html
+{
+
+ /**
+ * The DataGrid class displays a set of buttons that can be used to
+ * switch between navigation panels.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TabBar extends ButtonBar
+ {
+ /**
+ * Constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TabBar()
+ {
+ super();
+ }
+
+ /**
+ * Sets the width of the TabBar.
+ *
+ * @param value The new width in pixels.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set width(value:Number):void
+ {
+ super.width = value;
+ }
+
+ /**
+ * Sets the height of the TabBar.
+ *
+ * @param value The new height in pixels.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set height(value:Number):void
+ {
+ super.height = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/org/apache/flex/mobile/INavigationController.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/org/apache/flex/mobile/INavigationController.as b/examples/MobileTrader/src/org/apache/flex/mobile/INavigationController.as
new file mode 100644
index 0000000..6bd90bc
--- /dev/null
+++ b/examples/MobileTrader/src/org/apache/flex/mobile/INavigationController.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 org.apache.flex.mobile
+{
+ /**
+ * The INavigationController is an interface that should be implemented by
+ * any class that performs changes of views.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface INavigationController
+ {
+ /**
+ * Pushes the next view onto the navigation stack.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function push(value:IViewController):void;
+
+ /**
+ * Pops the top-most IViewController from the navigation stack.
+ */
+ function pop():void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/org/apache/flex/mobile/IViewController.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/org/apache/flex/mobile/IViewController.as b/examples/MobileTrader/src/org/apache/flex/mobile/IViewController.as
new file mode 100644
index 0000000..422335b
--- /dev/null
+++ b/examples/MobileTrader/src/org/apache/flex/mobile/IViewController.as
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.mobile
+{
+ /**
+ * The IViewController interface should be implemented by any class that
+ * can be used with an INavigationController. An IViewController is
+ * typically a screen on a mobile device that may be pushed or popped
+ * by the navigation controller as the user moves thru the application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IViewController
+ {
+ /**
+ * The IViewController's navigation control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function set navigationController(value:INavigationController):void;
+ function get navigationController():INavigationController;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/org/apache/flex/mobile/NavigationController.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/org/apache/flex/mobile/NavigationController.as b/examples/MobileTrader/src/org/apache/flex/mobile/NavigationController.as
new file mode 100644
index 0000000..59dec03
--- /dev/null
+++ b/examples/MobileTrader/src/org/apache/flex/mobile/NavigationController.as
@@ -0,0 +1,107 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.mobile
+{
+ import org.apache.flex.core.UIBase;
+
+ /**
+ * The NavigationController is an interface that should be implemented by
+ * any class that performs changes of views.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class NavigationController extends UIBase implements INavigationController
+ {
+ /**
+ * Controller.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function NavigationController()
+ {
+ super();
+
+ _views = [];
+ }
+
+ private var _views:Array;
+
+ /**
+ * The current set of views in the navigation stack. The last entry is
+ * the top-most (visible) view controller.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get views():Array
+ {
+ return _views;
+ }
+ public function set views(value:Array):void
+ {
+ if (_views == null) _views = [];
+
+ for(var i:int=0; i < value.length; i++) {
+ var view:IViewController = value[i] as IViewController;
+ if (view) {
+ push(view);
+ }
+ }
+ }
+
+ /**
+ * Pushes the next view onto the navigation stack.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function push(nextView:IViewController):void
+ {
+ nextView.navigationController = this;
+ _views.push(nextView);
+
+ addElement(nextView);
+ }
+ /**
+ * Pops the top-most view from the navigation stack.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function pop():void
+ {
+ if (_views.length > 1) {
+ var lastView:Object = _views.pop();
+ removeElement(lastView);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/org/apache/flex/mobile/TabController.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/org/apache/flex/mobile/TabController.as b/examples/MobileTrader/src/org/apache/flex/mobile/TabController.as
new file mode 100644
index 0000000..2f91f7c
--- /dev/null
+++ b/examples/MobileTrader/src/org/apache/flex/mobile/TabController.as
@@ -0,0 +1,163 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.mobile
+{
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.html.ButtonBar;
+
+ /**
+ * The TabController class is used to navigate between sections of an
+ * application. A TabBar is used to select which INavigationController
+ * child of the TabController should be presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class TabController extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function TabController()
+ {
+ super();
+ }
+
+ private var _views : Array;
+ private var _buttonBar:ButtonBar;
+ private var _currentView:UIBase;
+ private var _selectedIndex:Number;
+
+ /**
+ * The components under tab management.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get views():Array
+ {
+ return _views;
+ }
+ public function set views(value:Array):void
+ {
+ _views = value;
+
+ if (_currentView) {
+ removeElement(_currentView);
+ }
+
+ _currentView = views[0];
+ showCurrentView();
+ }
+
+ /**
+ * The currently selected tab view.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get currentView():UIBase
+ {
+ return _currentView;
+ }
+
+ /**
+ * The zero-based index of the currently active tab.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get selectedIndex():Number
+ {
+ return _selectedIndex;
+ }
+ public function set selectedIndex(value:Number):void
+ {
+ if (value < _views.length) {
+ if (_currentView) {
+ removeElement(_currentView);
+ }
+ _selectedIndex = value;
+ _currentView = views[value];
+ showCurrentView();
+ }
+ }
+
+ /**
+ * The TabBar being used for navigation.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get buttonBar():ButtonBar
+ {
+ return _buttonBar;
+ }
+ public function set buttonBar(value:ButtonBar):void
+ {
+ if (value != _buttonBar) {
+ if (_buttonBar) {
+ _buttonBar.removeEventListener("change",handleButtonBarChange);
+ }
+ _buttonBar = value;
+ _buttonBar.addEventListener("change",handleButtonBarChange);
+ }
+ }
+
+ /**
+ * @private
+ */
+ private function showCurrentView() : void
+ {
+ _currentView.width = this.width;
+ _currentView.height = this.height;
+ addElement(_currentView);
+ }
+
+ /**
+ * @private
+ */
+ override public function addElement(c:Object):void
+ {
+ super.addElement(c);
+ }
+
+ private function handleButtonBarChange(event:Event):void
+ {
+ var newIndex:Number = _buttonBar.selectedIndex;
+ selectedIndex = newIndex;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/org/apache/flex/mobile/ViewController.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/org/apache/flex/mobile/ViewController.as b/examples/MobileTrader/src/org/apache/flex/mobile/ViewController.as
new file mode 100644
index 0000000..9148717
--- /dev/null
+++ b/examples/MobileTrader/src/org/apache/flex/mobile/ViewController.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.mobile
+{
+ import org.apache.flex.html.Container;
+
+ /**
+ * The IViewController interface should be implemented by any class that
+ * can be used with an INavigationController. An IViewController is
+ * typically a screen on a mobile device that may be pushed or popped
+ * by the navigation controller as the user moves thru the application.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ViewController extends Container implements IViewController
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ViewController()
+ {
+ super();
+ }
+
+ private var _navigationController:INavigationController;
+
+ /**
+ * The IViewController's navigation control.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get navigationController():INavigationController
+ {
+ return _navigationController;
+ }
+ public function set navigationController(value:INavigationController):void
+ {
+ _navigationController = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/renderers/StockRenderer.as
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/renderers/StockRenderer.as b/examples/MobileTrader/src/renderers/StockRenderer.as
new file mode 100644
index 0000000..afba26f
--- /dev/null
+++ b/examples/MobileTrader/src/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/7c0b48a5/examples/MobileTrader/src/views/AlertsView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/AlertsView.mxml b/examples/MobileTrader/src/views/AlertsView.mxml
new file mode 100644
index 0000000..cf1d0a0
--- /dev/null
+++ b/examples/MobileTrader/src/views/AlertsView.mxml
@@ -0,0 +1,36 @@
+<?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.
+
+-->
+<mobile:ViewController xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:mobile="org.apache.flex.mobile.*"
+ xmlns:local="*"
+ className="AlertsView">
+
+ <fx:Script>
+ <![CDATA[
+ ]]>
+ </fx:Script>
+
+ <basic:Image source="assets/background.png" x="0" y="0" width="320" height="55" />
+ <basic:Image source="assets/logo.png" x="0" y="0" width="218" height="55" />
+
+ <basic:Label text="Alerts View" x="20" y="100" />
+
+</mobile:ViewController>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/views/AssetsView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/AssetsView.mxml b/examples/MobileTrader/src/views/AssetsView.mxml
new file mode 100644
index 0000000..21c0ae6
--- /dev/null
+++ b/examples/MobileTrader/src/views/AssetsView.mxml
@@ -0,0 +1,83 @@
+<?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.
+
+-->
+<mobile:ViewController xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:mobile="org.apache.flex.mobile.*"
+ xmlns:models="models.*"
+ xmlns:local="*"
+ className="AssetsView" xmlns:tests="tests.*">
+ <fx:Script>
+ <![CDATA[
+
+ ]]>
+ </fx:Script>
+
+ <mobile:model>
+ <models:AssetsModel />
+ </mobile:model>
+
+ <basic:Image source="assets/background.png" x="0" y="0" width="320" height="55" />
+ <basic:Image source="assets/logo.png" x="0" y="0" width="218" height="55" />
+
+ <basic:Container x="0" y="55" width="480" className="AssetsInner">
+ <basic:beads>
+ <basic:NonVirtualVerticalLayout />
+ </basic:beads>
+
+ <basic:Label text="Summary" />
+
+ <basic:DataGrid width="320" height="200">
+ <basic:beads>
+ <basic:ConstantBinding
+ sourceID="model"
+ sourcePropertyName="assetsData"
+ destinationPropertyName="dataProvider" />
+ </basic:beads>
+ <basic:columns>
+ <basic:DataGridColumn label="" dataField="label" />
+ <basic:DataGridColumn label="" dataField="value" />
+ <basic:DataGridColumn label="" 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>
+</mobile:ViewController>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/views/StockView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/StockView.mxml b/examples/MobileTrader/src/views/StockView.mxml
new file mode 100644
index 0000000..0b9447d
--- /dev/null
+++ b/examples/MobileTrader/src/views/StockView.mxml
@@ -0,0 +1,45 @@
+<?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.
+
+-->
+<mobile:ViewController xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:mobile="org.apache.flex.mobile.*"
+ xmlns:apache="org.apache.flex.html.beads.*"
+ xmlns:local="*"
+ className="StockView">
+
+ <fx:Script>
+ <![CDATA[
+ private function onBackClick() : void
+ {
+ navigationController.pop();
+ }
+ ]]>
+ </fx:Script>
+
+ <basic:Image source="assets/background.png" x="0" y="0" width="320" height="55" />
+ <basic:Button x="0" y="5" width="45" height="45" className="BackButton" click="onBackClick()">
+ <basic:beads>
+ <apache:ImageButtonView />
+ </basic:beads>
+ </basic:Button>
+ <basic:Image source="assets/logo.png" x="47" y="0" width="218" height="55" />
+
+ <basic:Label text="Stock View" x="20" y="100" />
+</mobile:ViewController>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/MobileTrader/src/views/WatchListView.mxml
----------------------------------------------------------------------
diff --git a/examples/MobileTrader/src/views/WatchListView.mxml b/examples/MobileTrader/src/views/WatchListView.mxml
new file mode 100644
index 0000000..8be0bfe
--- /dev/null
+++ b/examples/MobileTrader/src/views/WatchListView.mxml
@@ -0,0 +1,114 @@
+<?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.
+
+-->
+<mobile:ViewController xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:mobile="org.apache.flex.mobile.*"
+ xmlns:controller="controller.*"
+ xmlns:local="*"
+ className="WatchListView"
+ xmlns:renderers="renderers.*">
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.events.Event;
+
+ private function onSelectStock():void
+ {
+ var stockView:StockView = new StockView();
+ navigationController.push(stockView);
+ }
+
+ private function onStockChange(event:org.apache.flex.events.Event):void
+ {
+
+ }
+
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+
+ var feed:Feed = this.model as Feed;
+ feed.addEventListener("update",onStockChange);
+ feed.subscribe();
+ }
+ ]]>
+ </fx:Script>
+
+ <mobile:model>
+ <controller:Feed />
+ </mobile:model>
+
+ <basic:Image source="assets/background.png" x="0" y="0" width="320" height="55" />
+ <basic:Image source="assets/logo.png" x="0" y="0" width="218" height="55" />
+
+ <basic:Container x="0" y="55" width="320" className="WatchListInner">
+ <basic:beads>
+ <basic:NonVirtualVerticalLayout />
+ </basic:beads>
+
+ <basic:DataGrid width="320" height="380" change="onSelectStock()">
+ <basic:beads>
+ <basic:SimpleBinding
+ eventName="update"
+ sourceID="model"
+ sourcePropertyName="stockList"
+ 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="Open" dataField="open">
+ <basic:itemRenderer>
+ <fx:Component>
+ <renderers:StockRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:DataGridColumn>
+ <basic:DataGridColumn label="Last" dataField="last" >
+ <basic:itemRenderer>
+ <fx:Component>
+ <renderers:StockRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:DataGridColumn>
+ <basic:DataGridColumn label="High" dataField="high" >
+ <basic:itemRenderer>
+ <fx:Component>
+ <renderers:StockRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:DataGridColumn>
+ <basic:DataGridColumn label="Low" dataField="low" >
+ <basic:itemRenderer>
+ <fx:Component>
+ <renderers:StockRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:DataGridColumn>
+ </basic:columns>
+ </basic:DataGrid>
+ </basic:Container>
+
+</mobile:ViewController>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/7c0b48a5/examples/build.xml
----------------------------------------------------------------------
diff --git a/examples/build.xml b/examples/build.xml
index 9aa255c..9a47b8b 100644
--- a/examples/build.xml
+++ b/examples/build.xml
@@ -85,6 +85,7 @@
<ant dir="${basedir}/FormatExample"/>
<ant dir="${basedir}/LanguageTests"/>
<ant dir="${basedir}/ListsTest"/>
+ <ant dir="${basedir}/MobileTrader"/>
<ant dir="${basedir}/StatesTest"/>
<ant dir="${basedir}/StockQuote"/>
<ant dir="${basedir}/BarChartExample"/>