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 2014/04/26 01:14:36 UTC
[1/2] MobileTrader demo app donated by Adobe Systems Inc.
Repository: flex-utilities
Updated Branches:
refs/heads/develop 3dc107b94 -> b2f1e508a
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/views/AdvisorView.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/views/AdvisorView.mxml b/MobileTrader/src/views/AdvisorView.mxml
new file mode 100644
index 0000000..910f6c1
--- /dev/null
+++ b/MobileTrader/src/views/AdvisorView.mxml
@@ -0,0 +1,109 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:cs="http://ns.adobe.com/rtc"
+ destructionPolicy="never"
+ currentState="logon"
+ xmlns:charts="charts.*">
+
+ <fx:Script>
+
+ <![CDATA[
+ import com.adobe.rtc.events.SessionEvent;
+
+ import mx.collections.ArrayCollection;
+ import mx.core.FlexGlobals;
+
+ protected var cameraIndex:int;
+
+ protected function login():void
+ {
+ session.roomURL = FlexGlobals.topLevelApplication.roomURL;
+ cameraIndex=cameraList.selectedIndex;
+ session.login();
+ currentState = "connecting";
+ cameraList.selectedIndex = -1;
+ }
+
+ protected function session_synchronizationChange(event:SessionEvent):void
+ {
+ if (session.isSynchronized)
+ {
+ currentState = "default";
+ webCam.publisher.cameraNameIndex = ""+cameraIndex;
+ webCam.startWebcam();
+ }
+ else
+ {
+ currentState = "logon";
+ }
+ }
+
+ ]]>
+
+ </fx:Script>
+
+ <s:states>
+ <s:State name="logon"/>
+ <s:State name="default"/>
+ <s:State name="connecting"/>
+ <s:State name="error"/>
+ </s:states>
+
+ <fx:Declarations>
+ <cs:AdobeHSAuthenticator id="auth" userName="user"/>
+ <cs:ConnectSession id="session" authenticator="{auth}"
+ synchronizationChange="session_synchronizationChange(event)"
+ error="currentState='error'"/>
+ </fx:Declarations>
+
+ <cs:WebCamera id="webCam" top="0" left="0" width="200" bottom="0" includeIn="default" connectSession="{session}"/>
+
+ <charts:CollaborativePortfolioChart top="8" left="200" bottom="0" right="0" includeIn="default" session="{session}"/>
+
+ <cs:SharedCursorPane top="8" left="202" bottom="0" right="0" includeIn="default" connectSession="{session}"/>
+
+ <s:Label text="Select a camera:" top="20" left="20" right="20" includeIn="logon"/>
+
+ <s:List id="cameraList" dataProvider="{new ArrayCollection(Camera.names)}" top="60" left="20" right="20" bottom="100" borderVisible="true" includeIn="logon"
+ alternatingItemColors="{[0xFFFFFF, 0xFFFFFF]}"
+ change="login()"/>
+
+ <s:Button label="Collaboration Settings" includeIn="logon" left="20" right="20" bottom="20" height="60" click="navigator.pushView(SettingsView)"/>
+
+ <s:Label text="We can't find your financial advisor." horizontalCenter="0" verticalCenter="-14" includeIn="error"/>
+ <s:Label text="Check your network connection." horizontalCenter="0" verticalCenter="14" includeIn="error"/>
+
+ <s:Button label="OK" left="20" right="20" bottom="20" height="80" includeIn="error"
+ click="currentState='logon'"/>
+
+ <s:Group verticalCenter="0" horizontalCenter="0" height="150" includeIn="connecting" >
+ <s:Rect top="0" bottom="0" left="0" right="0" radiusX="4" radiusY="4" alpha=".5">
+ <s:fill>
+ <s:SolidColor color="#000000"/>
+ </s:fill>
+ </s:Rect>
+ <s:Label text="Connecting to financial advisor..." fontSize="24" color="#FFFFFF" verticalCenter="-20" left="20" right="20"/>
+ <s:BusyIndicator verticalCenter="28" horizontalCenter="0"/>
+ </s:Group>
+
+</s:View>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/views/AlertsView.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/views/AlertsView.mxml b/MobileTrader/src/views/AlertsView.mxml
new file mode 100644
index 0000000..3aa171f
--- /dev/null
+++ b/MobileTrader/src/views/AlertsView.mxml
@@ -0,0 +1,72 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ destructionPolicy="never">
+
+ <fx:Script>
+ <![CDATA[
+
+ import mx.collections.ArrayCollection;
+
+ import spark.events.IndexChangeEvent;
+
+ [Embed("assets/phone.png")]
+ private var phoneIcon:Class;
+
+ [Bindable]
+ protected var alerts:ArrayCollection = new ArrayCollection([
+ {type: "tel", name: "Call Financial Advisor", details: "617-219-2000", icon: phoneIcon},
+ {type: "http", name: "Adobe posts strong results", details: "http://finance.google.com"},
+ {type: "http", name: "Dow and S&P down for second week", details: "http://bloomberg.com"}]);
+
+ protected function list_changeHandler(event:IndexChangeEvent):void
+ {
+ var action:Object = list.selectedItem;
+ list.selectedIndex = -1;
+ switch (action.type)
+ {
+ case "tel":
+ navigateToURL(new URLRequest("tel:" + action.details));
+ break;
+
+ case "http":
+ navigateToURL(new URLRequest(action.details));
+ break;
+ }
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:List id="list" top="0" bottom="0" left="0" right="0" dataProvider="{alerts}" change="list_changeHandler(event)">
+ <s:itemRenderer>
+ <fx:Component>
+ <s:IconItemRenderer
+ labelField="name"
+ messageField="details"
+ decorator="{data.icon}"
+ height="70"/>
+ </fx:Component>
+ </s:itemRenderer>
+ </s:List>
+
+</s:View>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/views/AssetsView.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/views/AssetsView.mxml b/MobileTrader/src/views/AssetsView.mxml
new file mode 100644
index 0000000..ce53b2e
--- /dev/null
+++ b/MobileTrader/src/views/AssetsView.mxml
@@ -0,0 +1,86 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:charts="charts.*"
+ xmlns:views="views.*"
+ destructionPolicy="never" xmlns:components="components.*">
+
+ <fx:Script>
+ <![CDATA[
+ import mx.core.FlexGlobals;
+
+ override public function setCurrentState(stateName:String, playTransition:Boolean=true):void
+ {
+ if (stateName == "landscape")
+ {
+ if (FlexGlobals.topLevelApplication.height<500)
+ super.setCurrentState("landscapeSmall", playTransition);
+ else if (FlexGlobals.topLevelApplication.height<600)
+ super.setCurrentState("landscapeMedium", playTransition);
+ else
+ super.setCurrentState("landscapeLarge", playTransition);
+ }
+ else
+ {
+ super.setCurrentState(stateName, playTransition);
+ }
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:CurrencyFormatter id="cf" useCurrencySymbol="true" fractionalDigits="0" />
+ <s:NumberFormatter id="nf" fractionalDigits="2" />
+ </fx:Declarations>
+
+ <s:states>
+ <s:State name="portrait"/>
+ <s:State name="landscape"/>
+ <s:State name="landscapeLarge"/>
+ <s:State name="landscapeMedium"/>
+ <s:State name="landscapeSmall"/>
+ <s:State name="landscapeHistory"/>
+ </s:states>
+
+ <s:Label text="Summary" top="16" left="20" fontSize="24" excludeFrom="landscapeMedium"
+ color="#646464"
+ color.landscapeHistory="#999999"
+ click.landscapeHistory="currentState='landscapeSmall'"/>
+
+ <components:AssetsSummary id="assetsSummary" top="50" top.landscapeMedium="16" left="20" right="20" excludeFrom="landscapeHistory"/>
+
+ <s:Label text="Performance History" top="240" left="20" fontSize="24" excludeFrom="landscapeMedium"
+ color="#646464"
+ color.landscapeSmall="#999999"
+ mouseDown.landscapeSmall="currentState='landscapeHistory'"
+ top.landscapeSmall="16" left.landscapeSmall="170"
+ top.landscapeHistory="16" left.landscapeHistory="170" />
+
+ <charts:PortfolioChart id="chart" top="280" top.landscapeMedium="200" left="20" right="20" bottom="28"
+ excludeFrom="landscapeSmall" top.landscapeHistory="50" bottom.landscapeMedium="10"/>
+
+ <s:Label bottom="4" text="Swipe/zoom to navigate chart. Rotate device for bigger chart" fontSize="16" color="#AAAAAA" horizontalCenter="0" includeIn="portrait"/>
+ <s:Label bottom="4" text="Swipe/zoom to navigate chart." fontSize="16" color="#AAAAAA" horizontalCenter="0" includeIn="landscapeLarge,landscapeHistory"/>
+ <s:Label bottom="4" text="Rotate device for combined view." fontSize="16" color="#AAAAAA" horizontalCenter="0" includeIn="landscapeSmall"/>
+
+</s:View>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/views/MobileTraderHomeView.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/views/MobileTraderHomeView.mxml b/MobileTrader/src/views/MobileTraderHomeView.mxml
new file mode 100644
index 0000000..e67be75
--- /dev/null
+++ b/MobileTrader/src/views/MobileTraderHomeView.mxml
@@ -0,0 +1,25 @@
+<?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.
+
+-->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView">
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+</s:View>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/views/SettingsView.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/views/SettingsView.mxml b/MobileTrader/src/views/SettingsView.mxml
new file mode 100644
index 0000000..d610e52
--- /dev/null
+++ b/MobileTrader/src/views/SettingsView.mxml
@@ -0,0 +1,67 @@
+<?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.
+
+-->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark" xmlns:views="views.*"
+ creationComplete="roomURL.text=FlexGlobals.topLevelApplication.roomURL">
+
+ <fx:Script>
+ <![CDATA[
+ import flash.net.navigateToURL;
+
+ import mx.core.FlexGlobals;
+
+ import spark.managers.PersistenceManager;
+
+ protected var persistenceManager:PersistenceManager = new PersistenceManager();
+
+ protected function save():void
+ {
+ FlexGlobals.topLevelApplication.roomURL = roomURL.text;
+ persistenceManager.setProperty("roomURL", roomURL.text);
+ persistenceManager.save();
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:navigationContent>
+ <s:Button icon="@Embed('assets/back.png')" click="navigator.popView();" height="55"/>
+ </s:navigationContent>
+
+ <s:layout>
+ <s:VerticalLayout paddingTop="20" paddingLeft="20" paddingRight="20" paddingBottom="20"/>
+ </s:layout>
+
+ <s:Label text="Collaboration Services Room URL:" top="20" left="20" right="20"/>
+
+ <s:TextInput id="roomURL" width="100%" change="save()"/>
+
+ <s:Image width="100%" height="100%" fillMode="scale" scaleMode="stretch"/>
+
+ <s:Label width="100%">
+ <s:text>
+MobileTrader uses LiveCycle Collaboration Service (LCCS) to enable real time collaboration between users of the application.
+This includes videoconference, voice over IP, and application collaboration (UI synchronization).
+You need to specify a collaboration room URL to enable this feature. If you don't have an LCCS account, you can sign up for a free trial at https://afcs.acrobat.com/.
+You will then be able to create a room and enable this feature of MobileTrader.
+ </s:text>
+ </s:Label>
+
+</s:View>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/views/StockView.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/views/StockView.mxml b/MobileTrader/src/views/StockView.mxml
new file mode 100644
index 0000000..edee2fe
--- /dev/null
+++ b/MobileTrader/src/views/StockView.mxml
@@ -0,0 +1,125 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:charts="charts.*"
+ width="100%" height="100%"
+ creationComplete="creationComplete()"
+ viewActivate="activateHandler()"
+ viewDeactivate="deactivateHandler()">
+
+
+ <fx:Script>
+ <![CDATA[
+ import controller.Feed;
+
+ import mx.core.FlexGlobals;
+
+ [Bindable]
+ [Embed("assets/up.png")]
+ protected var iconUp:Class;
+
+ [Bindable]
+ [Embed("assets/down.png")]
+ protected var iconDown:Class;
+
+ protected var feed:Feed;
+
+ protected function creationComplete():void
+ {
+ feed = FlexGlobals.topLevelApplication.feed;
+ }
+
+ protected function activateHandler():void
+ {
+ feed.subscribe();
+ }
+
+ protected function deactivateHandler():void
+ {
+ feed.unsubscribe();
+ }
+
+ override public function setCurrentState(stateName:String, playTransition:Boolean=true):void
+ {
+ if (stateName == "landscape")
+ {
+ if (FlexGlobals.topLevelApplication.height<500)
+ super.setCurrentState("landscapeSmall", playTransition);
+ else if (FlexGlobals.topLevelApplication.height<600)
+ super.setCurrentState("landscapeMedium", playTransition);
+ else
+ super.setCurrentState("landscapeLarge", playTransition);
+ }
+ else
+ {
+ super.setCurrentState(stateName, playTransition);
+ }
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:states>
+ <s:State name="portrait"/>
+ <s:State name="landscape"/>
+ <s:State name="landscapeSmall"/>
+ <s:State name="landscapeMedium"/>
+ <s:State name="landscapeLarge"/>
+ </s:states>
+
+ <fx:Declarations>
+ <s:NumberFormatter id="nf" fractionalDigits="2" trailingZeros="true"/>
+ </fx:Declarations>
+
+ <s:navigationContent>
+ <s:Button icon="@Embed('assets/back.png')" click="navigator.popView();" height="55"/>
+ </s:navigationContent>
+
+ <s:Label text="{data.symbol}" fontSize="36" left="10" top="10" height="79" width="95" backgroundColor="#F0F0F0" verticalAlign="middle" textAlign="center" color="#646464"/>
+
+ <s:HGroup top="10" left="106" right="10" gap="1">
+ <s:Label text="Open" width="85" height="39" backgroundColor="#919191" verticalAlign="middle" paddingRight="8" textAlign="right"/>
+ <s:Label text="Last" width="85" height="39" backgroundColor="#919191" verticalAlign="middle" paddingRight="8" textAlign="right"/>
+ <s:Label text="Change" width="85" height="39" backgroundColor="#919191" verticalAlign="middle" paddingRight="8" textAlign="right" includeIn="landscapeLarge,landscapeMedium,landscapeSmall"/>
+ <s:Label text="High" width="85" height="39" backgroundColor="#919191" verticalAlign="middle" paddingRight="8" textAlign="right"/>
+ <s:Label text="Low" width="85" height="39" backgroundColor="#919191" verticalAlign="middle" paddingRight="8" textAlign="right"/>
+ </s:HGroup>
+
+ <s:HGroup top="50" left="106" right="10" gap="1">
+ <s:Label text="{nf.format(data.open)}" width="85" height="39" backgroundColor="#F0F0F0" verticalAlign="middle" paddingRight="8" textAlign="right"/>
+ <s:Group>
+ <s:Label text="{nf.format(data.last)}" color="{data.change>0?0x006600:0xFF0000}" width="85" height="39" backgroundColor="#F0F0F0" verticalAlign="middle" paddingRight="18" textAlign="right"/>
+ <s:Image source="{data.change>0?iconUp:iconDown}" x="70" y="14"/>
+ </s:Group>
+ <s:Label text="{nf.format(data.change)}" color="{data.change>0?0x006600:0xFF0000}" width="85" height="39" backgroundColor="#F0F0F0" verticalAlign="middle" paddingRight="8" textAlign="right" includeIn="landscapeLarge,landscapeMedium,landscapeSmall"/>
+ <s:Label text="{nf.format(data.high)}" width="85" height="39" backgroundColor="#F0F0F0" verticalAlign="middle" paddingRight="8" textAlign="right"/>
+ <s:Label text="{nf.format(data.low)}" width="85" height="39" backgroundColor="#F0F0F0" verticalAlign="middle" paddingRight="8" textAlign="right"/>
+ </s:HGroup>
+
+ <charts:RealTimeChart stock="{data}"
+ top="150" top.landscapeSmall="120" top.landscapeMedium="120"
+ height="350" height.landscapeSmall="{undefined}" height.landscapeMedium="{undefined}"
+ bottom.landscapeSmall="30" bottom.landscapeMedium="40" left="20" right="20"/>
+
+ <s:Label bottom="4" text="Rotate device for bigger chart." fontSize="16" color="#AAAAAA" horizontalCenter="0" includeIn="portrait"/>
+
+</s:View>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/views/WatchListView.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/views/WatchListView.mxml b/MobileTrader/src/views/WatchListView.mxml
new file mode 100644
index 0000000..f448cf1
--- /dev/null
+++ b/MobileTrader/src/views/WatchListView.mxml
@@ -0,0 +1,82 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ width="100%" height="100%" destructionPolicy="never"
+ backgroundColor="#F0F0F0"
+ creationComplete="creationComplete()"
+ viewActivate="activateHandler()"
+ viewDeactivate="deactivateHandler()">
+
+ <fx:Script>
+ <![CDATA[
+ import controller.Feed;
+
+ import mx.core.FlexGlobals;
+
+ public var feed:Feed;
+
+ protected function creationComplete():void
+ {
+ feed = FlexGlobals.topLevelApplication.feed;
+ list.dataProvider = feed.stockList;
+ feed.subscribe();
+ }
+
+ protected function activateHandler():void
+ {
+ feed.subscribe();
+ }
+
+ protected function deactivateHandler():void
+ {
+ feed.unsubscribe();
+ }
+
+ protected function listChange():void
+ {
+ feed.unsubscribe();
+ navigator.pushView(StockView, list.selectedItem);
+ list.selectedIndex = -1;
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:SkinnableContainer top="0" left="0" right="0" backgroundColor="#919191" height="40">
+ <s:layout>
+ <s:HorizontalLayout paddingLeft="0" paddingRight="0" paddingTop="0" gap="-1"/>
+ </s:layout>
+ <s:Button label="Stock" width="100%" height="100%" skinClass="skins.ListHeaderButtonSkin" fontWeight="normal"/>
+ <s:Button label="Open" width="100%" height="100%" skinClass="skins.ListHeaderButtonSkinRightAlign" fontWeight="normal"/>
+ <s:Button label="Last" width="100%" height="100%" skinClass="skins.ListHeaderButtonSkinRightAlign" fontWeight="normal"/>
+ <s:Button label="High" width="100%" height="100%" skinClass="skins.ListHeaderButtonSkinRightAlign" fontWeight="normal"/>
+ <s:Button label="Low" width="100%" height="100%" skinClass="skins.ListHeaderButtonSkinRightAlign" fontWeight="normal"/>
+ <s:Button label="" width="60" height="100%" skinClass="skins.ListHeaderButtonSkinRightAlign" fontWeight="normal"/>
+ </s:SkinnableContainer>
+
+ <s:List id="list" itemRenderer="renderers.StockRenderer" borderVisible="false"
+ top="41" left="0" right="0" bottom="28"
+ change="listChange()"/>
+
+ <s:Label bottom="4" text="Select stock to see real time chart" fontSize="16" color="#AAAAAA" horizontalCenter="0"/>
+
+</s:View>
\ No newline at end of file
[2/2] git commit: [flex-utilities] [refs/heads/develop] -
MobileTrader demo app donated by Adobe Systems Inc.
Posted by ah...@apache.org.
MobileTrader demo app donated by Adobe Systems Inc.
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/b2f1e508
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/b2f1e508
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/b2f1e508
Branch: refs/heads/develop
Commit: b2f1e508ac9d293ded855aebd12859cb7391e707
Parents: 3dc107b
Author: Alex Harui <ah...@apache.org>
Authored: Fri Apr 25 16:14:16 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Fri Apr 25 16:14:16 2014 -0700
----------------------------------------------------------------------
MobileTrader/src/MobileTrader-app.xml | 276 +++++++++++++++++++
MobileTrader/src/MobileTrader.mxml | 63 +++++
MobileTrader/src/assets/Stocks.png | Bin 0 -> 56262 bytes
MobileTrader/src/assets/alarm_on_48.png | Bin 0 -> 495 bytes
MobileTrader/src/assets/arrow_left.png | Bin 0 -> 52561 bytes
MobileTrader/src/assets/arrow_left_24.png | Bin 0 -> 47785 bytes
MobileTrader/src/assets/back.png | Bin 0 -> 64121 bytes
MobileTrader/src/assets/background.png | Bin 0 -> 49376 bytes
MobileTrader/src/assets/chart_icon.png | Bin 0 -> 52491 bytes
MobileTrader/src/assets/chart_line_48.png | Bin 0 -> 687 bytes
MobileTrader/src/assets/down.png | Bin 0 -> 51486 bytes
MobileTrader/src/assets/logo.png | Bin 0 -> 55223 bytes
MobileTrader/src/assets/man_48.png | Bin 0 -> 586 bytes
MobileTrader/src/assets/money_48.png | Bin 0 -> 676 bytes
MobileTrader/src/assets/phone.png | Bin 0 -> 55463 bytes
MobileTrader/src/assets/splash-trader.jpg | Bin 0 -> 339335 bytes
MobileTrader/src/assets/splash.jpg | Bin 0 -> 52136 bytes
MobileTrader/src/assets/up.png | Bin 0 -> 51531 bytes
MobileTrader/src/blackberry-tablet.xml | 22 ++
MobileTrader/src/charts/AxisArrayList.as | 80 ++++++
MobileTrader/src/charts/BarChart.mxml | 95 +++++++
.../src/charts/CollaborativePortfolioChart.mxml | 89 ++++++
MobileTrader/src/charts/PortfolioChart.mxml | 174 ++++++++++++
MobileTrader/src/charts/RealTimeChart.mxml | 125 +++++++++
MobileTrader/src/charts/SummaryChart.mxml | 125 +++++++++
MobileTrader/src/components/AssetsSummary.mxml | 173 ++++++++++++
MobileTrader/src/controller/Feed.as | 143 ++++++++++
MobileTrader/src/model/Stock.as | 48 ++++
.../src/renderers/AssetSummaryRenderer.mxml | 47 ++++
MobileTrader/src/renderers/StockRenderer.as | 134 +++++++++
MobileTrader/src/skins/ActionBarSkin.mxml | 67 +++++
.../src/skins/ListHeaderButtonSkin.mxml | 186 +++++++++++++
.../skins/ListHeaderButtonSkinRightAlign.mxml | 186 +++++++++++++
MobileTrader/src/styles.css | 43 +++
MobileTrader/src/views/AdvisorView.mxml | 109 ++++++++
MobileTrader/src/views/AlertsView.mxml | 72 +++++
MobileTrader/src/views/AssetsView.mxml | 86 ++++++
.../src/views/MobileTraderHomeView.mxml | 25 ++
MobileTrader/src/views/SettingsView.mxml | 67 +++++
MobileTrader/src/views/StockView.mxml | 125 +++++++++
MobileTrader/src/views/WatchListView.mxml | 82 ++++++
41 files changed, 2642 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/MobileTrader-app.xml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/MobileTrader-app.xml b/MobileTrader/src/MobileTrader-app.xml
new file mode 100644
index 0000000..853ee7d
--- /dev/null
+++ b/MobileTrader/src/MobileTrader-app.xml
@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!--
+
+ 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.
+
+-->
+<application xmlns="http://ns.adobe.com/air/application/2.6">
+
+<!-- Adobe AIR Application Descriptor File Template.
+
+ Specifies parameters for identifying, installing, and launching AIR applications.
+
+ xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/2.6
+ The last segment of the namespace specifies the version
+ of the AIR runtime required for this application to run.
+
+ minimumPatchLevel - The minimum patch level of the AIR runtime required to run
+ the application. Optional.
+-->
+
+ <!-- A universally unique application identifier. Must be unique across all AIR applications.
+ Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
+ <id>MobileTrader</id>
+
+ <!-- Used as the filename for the application. Required. -->
+ <filename>MobileTrader</filename>
+
+ <!-- The name that is displayed in the AIR application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <name>MobileTrader</name>
+
+ <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
+ Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
+ An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
+ <versionNumber>0.0.0</versionNumber>
+
+ <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
+ <!-- <versionLabel></versionLabel> -->
+
+ <!-- Description, displayed in the AIR application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <!-- <description></description> -->
+
+ <!-- Copyright information. Optional -->
+ <!-- <copyright></copyright> -->
+
+ <!-- Publisher ID. Used if you're updating an application created prior to 1.5.3 -->
+ <!-- <publisherID></publisherID> -->
+
+ <!-- Settings for the application's initial window. Required. -->
+ <initialWindow>
+ <!-- The main SWF or HTML file of the application. Required. -->
+ <!-- Note: In Flash Builder, the SWF reference is set automatically. -->
+ <content>[This value will be overwritten by Flash Builder in the output app.xml]</content>
+
+ <!-- The title of the main window. Optional. -->
+ <!-- <title></title> -->
+
+ <!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
+ <!-- <systemChrome></systemChrome> -->
+
+ <!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
+ <!-- <transparent></transparent> -->
+
+ <!-- Whether the window is initially visible. Optional. Default false. -->
+ <!-- <visible></visible> -->
+
+ <!-- Whether the user can minimize the window. Optional. Default true. -->
+ <!-- <minimizable></minimizable> -->
+
+ <!-- Whether the user can maximize the window. Optional. Default true. -->
+ <!-- <maximizable></maximizable> -->
+
+ <!-- Whether the user can resize the window. Optional. Default true. -->
+ <!-- <resizable></resizable> -->
+
+ <!-- The window's initial width in pixels. Optional. -->
+ <!-- <width></width> -->
+
+ <!-- The window's initial height in pixels. Optional. -->
+ <!-- <height></height> -->
+
+ <!-- The window's initial x position. Optional. -->
+ <!-- <x></x> -->
+
+ <!-- The window's initial y position. Optional. -->
+ <!-- <y></y> -->
+
+ <!-- The window's minimum size, specified as a width/height pair in pixels, such as "400 200". Optional. -->
+ <!-- <minSize></minSize> -->
+
+ <!-- The window's initial maximum size, specified as a width/height pair in pixels, such as "1600 1200". Optional. -->
+ <!-- <maxSize></maxSize> -->
+
+ <!-- The initial aspect ratio of the app when launched (either "portrait" or "landscape"). Optional. Mobile only. Default is the natural orientation of the device -->
+
+ <!-- <aspectRatio></aspectRatio> -->
+
+ <!-- Whether the app will begin auto-orienting on launch. Optional. Mobile only. Default false -->
+
+ <!-- <autoOrients></autoOrients> -->
+
+ <!-- Whether the app launches in full screen. Optional. Mobile only. Default false -->
+
+ <!-- <fullScreen></fullScreen> -->
+
+ <!-- The render mode for the app (either auto, cpu, or gpu). Optional. Mobile only. Default auto -->
+
+ <!-- <renderMode></renderMode> -->
+
+ <!-- Whether or not to pan when a soft keyboard is raised or lowered (either "pan" or "none"). Optional. Defaults "pan." -->
+ <!-- <softKeyboardBehavior></softKeyboardBehavior> -->
+ <autoOrients>true</autoOrients>
+ <fullScreen>false</fullScreen>
+ <visible>true</visible>
+ <softKeyboardBehavior>none</softKeyboardBehavior>
+ </initialWindow>
+
+ <!-- We recommend omitting the supportedProfiles element, -->
+ <!-- which in turn permits your application to be deployed to all -->
+ <!-- devices supported by AIR. If you wish to restrict deployment -->
+ <!-- (i.e., to only mobile devices) then add this element and list -->
+ <!-- only the profiles which your application does support. -->
+ <!-- <supportedProfiles>desktop extendedDesktop mobileDevice extendedMobileDevice</supportedProfiles> -->
+
+ <!-- The subpath of the standard default installation location to use. Optional. -->
+ <!-- <installFolder></installFolder> -->
+
+ <!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
+ <!-- <programMenuFolder></programMenuFolder> -->
+
+ <!-- The icon the system uses for the application. For at least one resolution,
+ specify the path to a PNG file included in the AIR package. Optional. -->
+ <icon>
+ <!--
+ <image16x16></image16x16>
+ <image32x32></image32x32>
+ <image36x36></image36x36>
+ <image48x48></image48x48>
+ <image72x72></image72x72>
+ <image114x114></image114x114>
+ <image128x128></image128x128>
+ -->
+ <image57x57>assets/Stocks.png</image57x57>
+ </icon>
+
+ <!-- Whether the application handles the update when a user double-clicks an update version
+ of the AIR file (true), or the default AIR application installer handles the update (false).
+ Optional. Default false. -->
+ <!-- <customUpdateUI></customUpdateUI> -->
+
+ <!-- Whether the application can be launched when the user clicks a link in a web browser.
+ Optional. Default false. -->
+ <!-- <allowBrowserInvocation></allowBrowserInvocation> -->
+
+ <!-- Listing of file types for which the application can register. Optional. -->
+ <!-- <fileTypes> -->
+
+ <!-- Defines one file type. Optional. -->
+ <!-- <fileType> -->
+
+ <!-- The name that the system displays for the registered file type. Required. -->
+ <!-- <name></name> -->
+
+ <!-- The extension to register. Required. -->
+ <!-- <extension></extension> -->
+
+ <!-- The description of the file type. Optional. -->
+ <!-- <description></description> -->
+
+ <!-- The MIME content type. -->
+ <!-- <contentType></contentType> -->
+
+ <!-- The icon to display for the file type. Optional. -->
+ <!-- <icon>
+ <image16x16></image16x16>
+ <image32x32></image32x32>
+ <image48x48></image48x48>
+ <image128x128></image128x128>
+ </icon> -->
+
+ <!-- </fileType> -->
+ <!-- </fileTypes> -->
+
+ <!-- iOS specific capabilities -->
+ <!-- <iPhone> -->
+ <!-- A list of plist key/value pairs to be added to the application Info.plist -->
+ <!-- <InfoAdditions>
+ <![CDATA[
+ <key>UIDeviceFamily</key>
+ <array>
+ <string>1</string>
+ <string>2</string>
+ </array>
+ <key>UIStatusBarStyle</key>
+ <string>UIStatusBarStyleBlackOpaque</string>
+ <key>UIRequiresPersistentWiFi</key>
+ <string>YES</string>
+ ]]>
+ </InfoAdditions> -->
+ <!-- <requestedDisplayResolution></requestedDisplayResolution> -->
+ <!-- </iPhone> -->
+
+ <!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->
+ <!--<android>
+ <manifestAdditions>
+ <![CDATA[
+ <manifest android:installLocation="auto">
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+ <uses-configuration android:reqFiveWayNav="true"/>
+ <supports-screens android:normalScreens="true"/>
+ <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
+ <application android:enabled="true">
+ <activity android:excludeFromRecents="false">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+ </activity>
+ </application>
+ </manifest>
+ ]]>
+ </manifestAdditions>
+ </android> -->
+ <!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->
+
+<android>
+ <manifestAdditions><![CDATA[
+ <manifest android:installLocation="auto">
+ <!--See the Adobe AIR documentation for more information about setting Google Android permissions-->
+ <!--Removing the permission android.permission.INTERNET will have the side effect
+ of preventing you from debugging your application on your device-->
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
+ <!--<uses-permission android:name="android.permission.READ_PHONE_STATE"/>-->
+ <!--<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>-->
+ <!--The DISABLE_KEYGUARD and WAKE_LOCK permissions should be toggled together
+ in order to access AIR's SystemIdleMode APIs-->
+ <!--<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>-->
+ <!--<uses-permission android:name="android.permission.WAKE_LOCK"/>-->
+ <uses-permission android:name="android.permission.CAMERA"/>
+ <!--<uses-permission android:name="android.permission.RECORD_AUDIO"/>-->
+ <!--The ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE permissions should be toggled
+ together in order to use AIR's NetworkInfo APIs-->
+ <!--<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>-->
+ <!--<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>-->
+ </manifest>
+
+ ]]></manifestAdditions>
+ </android>
+ <iPhone>
+ <InfoAdditions><![CDATA[
+ <key>UIDeviceFamily</key>
+ <array>
+ <string>1</string>
+ <string>2</string>
+ </array>
+ ]]></InfoAdditions>
+ <requestedDisplayResolution>high</requestedDisplayResolution>
+ </iPhone>
+</application>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/MobileTrader.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/MobileTrader.mxml b/MobileTrader/src/MobileTrader.mxml
new file mode 100644
index 0000000..c357e98
--- /dev/null
+++ b/MobileTrader/src/MobileTrader.mxml
@@ -0,0 +1,63 @@
+<?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.
+
+-->
+
+<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:controller="controller.*"
+ splashScreenImage="@Embed('assets/splash.jpg')" splashScreenScaleMode="stretch"
+ applicationComplete="applicationComplete()">
+ <fx:Script>
+ <![CDATA[
+ import spark.managers.PersistenceManager;
+
+ /**
+ * The LiveCycle Collaboration Service (LCCS) room URL used for the real time collaboration feature
+ * of this application (real time collaboration with financial advisor).
+ */
+ public var roomURL:String;
+
+ protected function applicationComplete():void
+ {
+ var persistenceManager:PersistenceManager = new PersistenceManager();
+ if (persistenceManager.load())
+ {
+ var url:Object = persistenceManager.getProperty("roomURL");
+ if (url)
+ roomURL = url.toString();
+ }
+ }
+
+
+
+ ]]>
+ </fx:Script>
+
+ <fx:Style source="styles.css"/>
+
+ <fx:Declarations>
+ <controller:Feed id="feed"/>
+ </fx:Declarations>
+
+ <s:ViewNavigator label="Assets" firstView="views.AssetsView" width="100%" height="100%" icon="@Embed('assets/money_48.png')"/>
+ <s:ViewNavigator label="Watch" firstView="views.WatchListView" width="100%" height="100%" icon="@Embed('assets/chart_line_48.png')"/>
+ <s:ViewNavigator label="Alerts" firstView="views.AlertsView" width="100%" height="100%" icon="@Embed('assets/alarm_on_48.png')"/>
+ <s:ViewNavigator label="Advisor" firstView="views.AdvisorView" width="100%" height="100%" icon="@Embed('assets/man_48.png')"/>
+
+</s:TabbedViewNavigatorApplication>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/Stocks.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/Stocks.png b/MobileTrader/src/assets/Stocks.png
new file mode 100755
index 0000000..1ce9269
Binary files /dev/null and b/MobileTrader/src/assets/Stocks.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/alarm_on_48.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/alarm_on_48.png b/MobileTrader/src/assets/alarm_on_48.png
new file mode 100755
index 0000000..afc2d2f
Binary files /dev/null and b/MobileTrader/src/assets/alarm_on_48.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/arrow_left.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/arrow_left.png b/MobileTrader/src/assets/arrow_left.png
new file mode 100755
index 0000000..94c96a2
Binary files /dev/null and b/MobileTrader/src/assets/arrow_left.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/arrow_left_24.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/arrow_left_24.png b/MobileTrader/src/assets/arrow_left_24.png
new file mode 100755
index 0000000..a3019ba
Binary files /dev/null and b/MobileTrader/src/assets/arrow_left_24.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/back.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/back.png b/MobileTrader/src/assets/back.png
new file mode 100755
index 0000000..300d227
Binary files /dev/null and b/MobileTrader/src/assets/back.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/background.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/background.png b/MobileTrader/src/assets/background.png
new file mode 100755
index 0000000..87bbd59
Binary files /dev/null and b/MobileTrader/src/assets/background.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/chart_icon.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/chart_icon.png b/MobileTrader/src/assets/chart_icon.png
new file mode 100755
index 0000000..536a2ef
Binary files /dev/null and b/MobileTrader/src/assets/chart_icon.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/chart_line_48.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/chart_line_48.png b/MobileTrader/src/assets/chart_line_48.png
new file mode 100755
index 0000000..eb5ee0d
Binary files /dev/null and b/MobileTrader/src/assets/chart_line_48.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/down.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/down.png b/MobileTrader/src/assets/down.png
new file mode 100755
index 0000000..6f075e4
Binary files /dev/null and b/MobileTrader/src/assets/down.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/logo.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/logo.png b/MobileTrader/src/assets/logo.png
new file mode 100755
index 0000000..0fb0f21
Binary files /dev/null and b/MobileTrader/src/assets/logo.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/man_48.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/man_48.png b/MobileTrader/src/assets/man_48.png
new file mode 100755
index 0000000..931b2a3
Binary files /dev/null and b/MobileTrader/src/assets/man_48.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/money_48.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/money_48.png b/MobileTrader/src/assets/money_48.png
new file mode 100755
index 0000000..2d84fae
Binary files /dev/null and b/MobileTrader/src/assets/money_48.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/phone.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/phone.png b/MobileTrader/src/assets/phone.png
new file mode 100755
index 0000000..ca02011
Binary files /dev/null and b/MobileTrader/src/assets/phone.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/splash-trader.jpg
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/splash-trader.jpg b/MobileTrader/src/assets/splash-trader.jpg
new file mode 100755
index 0000000..1d09861
Binary files /dev/null and b/MobileTrader/src/assets/splash-trader.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/splash.jpg
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/splash.jpg b/MobileTrader/src/assets/splash.jpg
new file mode 100644
index 0000000..4141133
Binary files /dev/null and b/MobileTrader/src/assets/splash.jpg differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/assets/up.png
----------------------------------------------------------------------
diff --git a/MobileTrader/src/assets/up.png b/MobileTrader/src/assets/up.png
new file mode 100755
index 0000000..8e47373
Binary files /dev/null and b/MobileTrader/src/assets/up.png differ
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/blackberry-tablet.xml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/blackberry-tablet.xml b/MobileTrader/src/blackberry-tablet.xml
new file mode 100644
index 0000000..7dd226b
--- /dev/null
+++ b/MobileTrader/src/blackberry-tablet.xml
@@ -0,0 +1,22 @@
+<?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.
+
+-->
+
+
+<qnx/>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/charts/AxisArrayList.as
----------------------------------------------------------------------
diff --git a/MobileTrader/src/charts/AxisArrayList.as b/MobileTrader/src/charts/AxisArrayList.as
new file mode 100644
index 0000000..03d86b5
--- /dev/null
+++ b/MobileTrader/src/charts/AxisArrayList.as
@@ -0,0 +1,80 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 charts
+{
+ import mx.collections.ArrayList;
+
+ public class AxisArrayList extends ArrayList
+ {
+ private var _max:Number = 100;
+ public function get max():Number
+ {
+ return _max;
+ }
+ public function set max(value:Number):void
+ {
+ _max = value;
+ update();
+ }
+
+ private var _min:Number = 0;
+ public function get min():Number
+ {
+ return _min;
+ }
+ public function set min(value:Number):void
+ {
+ _min = value;
+ update();
+ }
+
+ private var _step:Number = 10;
+ public function get step():Number
+ {
+ return _step;
+ }
+ public function set step(value:Number):void
+ {
+ _step = value;
+ update();
+ }
+
+ private function update():void
+ {
+ var arr:Array = [];
+ var i:Number;
+ if (step > 0)
+ {
+ for (i = min; i <= max; i += step)
+ {
+ arr.push(i);
+ }
+ }
+ else
+ {
+ for (i = max; i >= min; i += step)
+ {
+ arr.push(i);
+ }
+ }
+ source = arr;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/charts/BarChart.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/charts/BarChart.mxml b/MobileTrader/src/charts/BarChart.mxml
new file mode 100644
index 0000000..3ba016d
--- /dev/null
+++ b/MobileTrader/src/charts/BarChart.mxml
@@ -0,0 +1,95 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ width="100%" height="163" backgroundColor="#F0F0F0">
+
+ <s:Line left="0" right="0" top="40">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Line left="0" right="0" top="81">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Line left="0" right="0" top="122">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Line top="0" bottom="0" left="{width/2}">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="0" bottom="0" left="{width/4}">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="0" bottom="0" right="{width/4}">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Rect top="10" left="0" height="20" width="{140000/200000*width}">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="#ec1d00" ratio="0" alpha="1"/>
+ <s:GradientEntry color="#d01800" ratio="1" alpha="1"/>
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+ <s:Rect top="51" left="0" height="20" width="{160000/200000*width}">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="#f14a00" ratio="0" alpha="1"/>
+ <s:GradientEntry color="#d64100" ratio="1" alpha="1"/>
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+ <s:Rect top="91" left="0" height="20" width="{120000/200000*width}">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="#f14a00" ratio="0" alpha="1"/>
+ <s:GradientEntry color="#d64100" ratio="1" alpha="1"/>
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+ <s:Rect top="131" left="0" height="20" width="{100000/200000*width}">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="#018f0e" ratio="0" alpha="1"/>
+ <s:GradientEntry color="#00720b" ratio="1" alpha="1"/>
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+</s:SkinnableContainer>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/charts/CollaborativePortfolioChart.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/charts/CollaborativePortfolioChart.mxml b/MobileTrader/src/charts/CollaborativePortfolioChart.mxml
new file mode 100644
index 0000000..ff44c3c
--- /dev/null
+++ b/MobileTrader/src/charts/CollaborativePortfolioChart.mxml
@@ -0,0 +1,89 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<charts:PortfolioChart xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark" xmlns:charts="charts.*" xmlns:ns="http://ns.adobe.com/rtc">
+
+ <fx:Script>
+ <![CDATA[
+ import com.adobe.rtc.events.CollectionNodeEvent;
+ import com.adobe.rtc.messaging.MessageItem;
+ import com.adobe.rtc.session.ConnectSession;
+
+ import mx.binding.utils.ChangeWatcher;
+ import mx.events.PropertyChangeEvent;
+ import mx.utils.UIDUtil;
+
+ protected var _uid:String = UIDUtil.createUID();
+
+ protected var changeWatcher:ChangeWatcher;
+
+ public function set session(session:ConnectSession):void
+ {
+ broker.connectSession = session;
+ broker.subscribe();
+ changeWatcher = ChangeWatcher.watch(scroller.viewport, "horizontalScrollPosition", scrollHandler);
+ }
+
+ override protected function zoom(scaleX:Number):void
+ {
+ super.zoom(scaleX);
+ var message:MessageItem = new MessageItem("gesture");
+ message.body = {uid: _uid, action: "zoom", scaleX: scaleX};
+ broker.publishItem(message);
+ }
+
+ protected function scrollHandler(e:Event):void
+ {
+ var message:MessageItem = new MessageItem("gesture");
+ message.body = {uid: _uid, action: "scroll", horizontalScrollPosition: scroller.viewport.horizontalScrollPosition};
+ broker.publishItem(message);
+ }
+
+ protected function onItemReceive(event:CollectionNodeEvent):void
+ {
+ if (event.item.body.uid == _uid)
+ {
+ // Ignoring own message
+ return;
+ }
+ var messageBody:Object = event.item.body;
+ switch (messageBody.action)
+ {
+ case "zoom":
+ super.zoom(messageBody.scaleX);
+ break;
+ case "scroll":
+ changeWatcher.unwatch();
+ scroller.viewport.horizontalScrollPosition = messageBody.horizontalScrollPosition;
+ changeWatcher = ChangeWatcher.watch(scroller.viewport, "horizontalScrollPosition", scrollHandler);
+ break;
+ }
+ }
+
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <ns:CollectionNode id="broker" sharedID="gesture" itemReceive="onItemReceive(event)"/>
+ </fx:Declarations>
+
+</charts:PortfolioChart>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/charts/PortfolioChart.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/charts/PortfolioChart.mxml b/MobileTrader/src/charts/PortfolioChart.mxml
new file mode 100644
index 0000000..c69502a
--- /dev/null
+++ b/MobileTrader/src/charts/PortfolioChart.mxml
@@ -0,0 +1,174 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ width="100%" height="100%" clipAndEnableScrolling="true"
+ creationComplete="completeHandler()"
+ resize="redraw()" xmlns:charts="charts.*">
+
+ <fx:Script>
+ <![CDATA[
+ import spark.effects.Move;
+
+ protected var _data:Array;
+
+ protected var min:Number;
+ [Bindable] protected var max:Number;
+
+ public function set data(data:Array):void
+ {
+ _data = data;
+ min = data[0];
+ max = data[0];
+ for (var i:int=1; i<data.length; i++)
+ {
+ if (data[i]<min) min = data[i];
+ if (data[i]>max) max = data[i];
+ }
+ redraw();
+ }
+
+ public function get data():Array
+ {
+ return _data;
+ }
+
+ protected function completeHandler():void
+ {
+ data = [
+ 80236, 85639, 82364, 72369, 69523, 85632, 86352, 82562, 87523, 89658, 96853, 106256,
+ 112045, 100258, 112584, 86352, 86523, 108532, 110253, 120145, 116325, 114856, 110256, 111857,
+ 112852, 115632, 128632, 121741, 92365, 95638, 132800, 128963, 125698, 112587, 121856, 126874,
+ 131569, 97563, 98563, 100235, 110523, 119536, 121532, 117563, 125963, 139523, 131856, 138972,
+ 125639, 103698, 130856, 147523, 110263, 125698, 145962, 138653, 131568, 111258, 125693, 161984
+ ];
+
+ Multitouch.inputMode = MultitouchInputMode.GESTURE;
+ rect.addEventListener(TransformGestureEvent.GESTURE_ZOOM, function(e:TransformGestureEvent):void{zoom(e.scaleX)});
+
+ }
+
+ protected function zoom(scaleX:Number):void
+ {
+ var w:Number = path.width * scaleX;
+ if (scaleX>1)
+ path.width = w > width*5 ? width*5 : w;
+ else
+ {
+ path.width = w < width ? width : w;
+ if (path.x + path.width < width) path.x = width - path.width;
+ }
+ }
+
+ protected function redraw():void
+ {
+ if (!data) return;
+
+ var pathData:String = "M 0 " + height;
+
+ var xPos:Number;
+ var yPos:Number;
+ for (var i:int=0; i<data.length; i++)
+ {
+ yPos = height - data[i] / max * height;
+ xPos = width / 11 * i;
+ pathData += " L " + xPos + " " + yPos;
+ }
+ pathData += "L " + xPos + " " + height + " z";
+ path.data = pathData;
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:CurrencyFormatter id="cf" useCurrencySymbol="true" currencySymbol="$" fractionalDigits="0"/>
+ <s:DateTimeFormatter id="df" dateTimePattern="MM/yy"/>
+ <charts:AxisArrayList id="hAxisData" step="-12" max="60"/>
+ </fx:Declarations>
+
+ <s:Line top="8" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line verticalCenter="8" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="{rect.height/4+8}" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="{rect.height/4*3+8}" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Label top="0" left="4" text="{cf.format(max)}" fontSize="16"/>
+ <s:Label top="{rect.height/4}" left="4" text="{cf.format(max/4*3)}" fontSize="16"/>
+ <s:Label top="{rect.height/4*3}" left="4" text="{cf.format(max/4)}" fontSize="16"/>
+ <s:Label verticalCenter="8" left="4" text="{cf.format(max/2)}" fontSize="16"/>
+
+ <s:Scroller id="scroller" top="8" bottom="0" left="0" right="0">
+
+ <s:Group id="rect" top="0" bottom="0" left="0" right="0" effectEnd="trace('%%effectEnd '+path.x);" mouseUp="trace('up '+rect.x)">
+
+ <s:DataGroup dataProvider="{hAxisData}" top="0" bottom="0" left="0" right="0">
+ <s:itemRenderer>
+ <fx:Component>
+ <s:DataRenderer height="{outerDocument.rect.height}" width="{Math.round(outerDocument.path.width/outerDocument.hAxisData.length)}">
+ <s:Label text="{outerDocument.df.format(new Date(new Date().time - 2592000000 * Number(data)))}" right="4" bottom="4" fontSize="16"/>
+ <s:Line right="24" top="0" bottom="24">
+ <s:stroke>
+ <s:SolidColorStroke color="#999999" weight="1"/>
+ </s:stroke>
+ </s:Line>
+ </s:DataRenderer>
+ </fx:Component>
+ </s:itemRenderer>
+ <s:layout>
+ <s:HorizontalLayout gap="0"/>
+ </s:layout>
+ </s:DataGroup>
+
+ <s:Path id="path" width="{width*5}" height="100%">
+
+ <s:stroke>
+ <s:SolidColorStroke color="#00719b" weight="1"/>
+ </s:stroke>
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="#00BAFF" ratio="0" alpha=".5"/>
+ <s:GradientEntry color="#00719b" ratio="1" alpha=".5"/>
+ </s:LinearGradient>
+ </s:fill>
+
+ </s:Path>
+
+ </s:Group>
+
+ </s:Scroller>
+
+</s:Group>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/charts/RealTimeChart.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/charts/RealTimeChart.mxml b/MobileTrader/src/charts/RealTimeChart.mxml
new file mode 100644
index 0000000..b063bbf
--- /dev/null
+++ b/MobileTrader/src/charts/RealTimeChart.mxml
@@ -0,0 +1,125 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark">
+
+ <fx:Script>
+ <![CDATA[
+
+ import model.Stock;
+
+ import mx.binding.utils.ChangeWatcher;
+ import mx.collections.ArrayCollection;
+
+ [Bindable]
+ public var _stock:Stock;
+
+ [Bindable] protected var minValue:Number;
+ [Bindable] protected var maxValue:Number;
+
+ protected var minTime:Number;
+ protected var maxTime:Number;
+
+ protected var changeWatcher:ChangeWatcher;
+
+ public function set stock(stock:Stock):void
+ {
+ _stock = stock;
+ changeWatcher = ChangeWatcher.watch(_stock, "last", drawChart, false, true);
+ callLater(drawChart);
+ }
+
+ public function drawChart(e:Event=null):void
+ {
+ var history:ArrayCollection = _stock.history;
+ minValue = history[0].last;
+ maxValue = history[0].last;
+ var i:int;
+ for (i=1; i<history.length; i++)
+ {
+ if (history[i].last < minValue) minValue = history[i].last;
+ if (history[i].last > maxValue) maxValue = history[i].last;
+ }
+
+ var pathData:String = "";
+
+ var length:int = history.length;
+
+ for (i=0; i<length; i++)
+ {
+ var yPos:Number = width - (history[i].last - minValue) / (maxValue - minValue) * width;
+ var xPos:Number = (i - 0) / (length - 1) * width;
+ pathData += (i==0 ? "M " : " L ") + xPos + " " + yPos;
+ }
+ path.data = pathData;
+
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:NumberFormatter id="nf" fractionalDigits="2" trailingZeros="true"/>
+ </fx:Declarations>
+
+ <s:states>
+ <s:State name="default"/>
+ <s:State name="landscape"/>
+ </s:states>
+ <s:Line top="0" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="{height/4}" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="{height/4*2}" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="{height/4*3}" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line bottom="0" left="60" right="0">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#999999"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Label top="-8" left="4" text="{nf.format(maxValue)}" fontSize="16" />
+ <s:Label top="{height/4-8}" left="4" text="{nf.format(minValue + (maxValue-minValue)/4*3)}" fontSize="16"/>
+ <s:Label top="{height/4*2-8}" left="4" text="{nf.format(minValue + (maxValue-minValue)/2)}" fontSize="16"/>
+ <s:Label top="{height/4*3-8}" left="4" text="{nf.format(minValue + (maxValue-minValue)/4)}" fontSize="16"/>
+ <s:Label bottom="-8" left="4" text="{nf.format(minValue)}" fontSize="16" />
+
+ <s:Path id="path" width="100%" height="100%">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#FF5900" />
+ </s:stroke>
+ </s:Path>
+
+</s:Group>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/charts/SummaryChart.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/charts/SummaryChart.mxml b/MobileTrader/src/charts/SummaryChart.mxml
new file mode 100644
index 0000000..a944c7c
--- /dev/null
+++ b/MobileTrader/src/charts/SummaryChart.mxml
@@ -0,0 +1,125 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark" width="100%" height="163"
+ backgroundColor="#F0F0F0"
+ creationComplete="completeHandler()"
+ resize="redraw()">
+
+ <fx:Script>
+ <![CDATA[
+
+ protected var _data:Array;
+
+ protected var min:Number;
+ [Bindable] protected var max:Number;
+
+ protected function completeHandler():void
+ {
+ data = [
+ 80236, 85639, 82364, 72369, 69523, 85632, 86352, 82562, 87523, 89658, 96853, 106256,
+ 112045, 100258, 112584, 86352, 86523, 108532, 110253, 120145, 116325, 114856, 110256, 111857,
+ 112852, 115632, 128632, 121741, 92365, 95638, 132800, 128963, 125698, 112587, 121856, 126874,
+ 131569, 97563, 98563, 100235, 110523, 119536, 121532, 117563, 125963, 139523, 131856, 138972,
+ 125639, 103698, 130856, 147523, 110263, 125698, 145962, 138653, 131568, 111258, 125693, 161984
+ ];
+
+ }
+
+ public function set data(data:Array):void
+ {
+ _data = data;
+ min = data[0];
+ max = data[0];
+ for (var i:int=1; i<data.length; i++)
+ {
+ if (data[i]<min) min = data[i];
+ if (data[i]>max) max = data[i];
+ }
+ redraw();
+ }
+
+ public function redraw():void
+ {
+ if (!data) return;
+
+ var pathData:String="";
+
+ var xPos:Number;
+ var yPos:Number;
+ for (var i:int=0; i<data.length; i++)
+ {
+ yPos = height - (data[i] - min) / (max - min) * height;
+ xPos = width / 11 * i;
+ pathData += (pathData == ""?"M ":" L ") + xPos + " " + yPos;
+ }
+ path.data = pathData;
+ }
+
+ public function get data():Array
+ {
+ return _data;
+ }
+
+ ]]>
+ </fx:Script>
+
+ <s:Line left="0" right="0" top="40">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Line left="0" right="0" top="81">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Line left="0" right="0" top="122">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Line top="0" bottom="0" left="{width/2}">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="0" bottom="0" left="{width/4}">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+ <s:Line top="0" bottom="0" right="{width/4}">
+ <s:stroke>
+ <s:SolidColorStroke color="#DCDCDC"/>
+ </s:stroke>
+ </s:Line>
+
+ <s:Path id="path" width="100%" height="100%">
+ <s:stroke>
+ <s:SolidColorStroke weight="1" color="#FF5900" />
+ </s:stroke>
+ </s:Path>
+
+</s:SkinnableContainer>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/components/AssetsSummary.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/components/AssetsSummary.mxml b/MobileTrader/src/components/AssetsSummary.mxml
new file mode 100644
index 0000000..01c7bb9
--- /dev/null
+++ b/MobileTrader/src/components/AssetsSummary.mxml
@@ -0,0 +1,173 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:charts="charts.*"
+ currentState="grid"
+ mouseDown="rotateContent()"
+ resize="resizeHandler(event)">
+
+ <fx:Script>
+ <![CDATA[
+ import mx.collections.ArrayCollection;
+ import mx.core.FlexGlobals;
+ import mx.events.ResizeEvent;
+
+ [Bindable]
+ protected var items:ArrayCollection = new ArrayCollection([
+ {label: "Net Worth", value: 161984, change: -2.37},
+ {label: "Last Month", value: 165915, change: 10.98},
+ {label: "6 Months Ago", value: 145962, change: 16.56},
+ {label: "Last Year", value: 138972, change: 8.36}
+ ]);
+
+ [Bindable]
+ protected var chartLeft:int;
+
+ protected function resizeHandler(event:ResizeEvent):void
+ {
+ if (FlexGlobals.topLevelApplication.width < 600)
+ {
+ if (currentState == "gridAndLine" || currentState == "gridAndBar" )
+ currentState = "grid";
+ }
+ else
+ {
+ if (currentState == "grid" || currentState == "line")
+ {
+ currentState = "gridAndLine";
+ chartLeft = 432;
+ }
+ else if (currentState == "bar")
+ {
+ currentState = "gridAndBar";
+ chartLeft = 432;
+ }
+ }
+ }
+
+ protected function rotateContent():void
+ {
+ if (currentState == "grid")
+ {
+ currentState = "line";
+ chartLeft = 171;
+ }
+ else if (currentState == "line")
+ {
+ currentState = "bar";
+ chartLeft = 171;
+ }
+ else if (currentState == "bar")
+ {
+ currentState = "grid";
+ }
+ else if (currentState == "gridAndLine")
+ {
+ currentState = "gridAndBar";
+ chartLeft = 432;
+ }
+ else if (currentState == "gridAndBar")
+ {
+ currentState = "gridAndLine";
+ chartLeft = 432;
+ }
+ }
+
+ ]]>
+ </fx:Script>
+
+
+ <s:states>
+ <s:State name="grid" />
+ <s:State name="line" />
+ <s:State name="bar" />
+ <s:State name="gridAndLine" />
+ <s:State name="gridAndBar" />
+ </s:states>
+
+ <s:transitions>
+ <s:Transition fromState="gridAndLine" toState="gridAndBar" autoReverse="true">
+ <s:Parallel>
+ <s:Rotate3D target="{line}" angleXFrom="0" angleXTo="0" angleZFrom="0" duration="350" autoCenterTransform="true" angleYTo="180" angleYFrom="0" autoCenterProjection="true" angleZTo="0"/>
+ <s:Fade target="{line}" startDelay="200" duration="50"/>
+ <s:Fade target="{bar}" startDelay="250" duration="100"/>
+ </s:Parallel>
+ </s:Transition>
+ <s:Transition fromState="gridAndBar" toState="gridAndLine" autoReverse="true">
+ <s:Parallel>
+ <s:Rotate3D target="{bar}" angleXFrom="0" angleXTo="0" angleZFrom="0" duration="350" autoCenterTransform="true" angleYTo="180" angleYFrom="0" autoCenterProjection="true" angleZTo="0"/>
+ <s:Fade target="{bar}" startDelay="200" duration="50"/>
+ <s:Fade target="{line}" startDelay="250" duration="100"/>
+ </s:Parallel>
+ </s:Transition>
+ <s:Transition fromState="grid" toState="line" autoReverse="true">
+ <s:Parallel>
+ <s:Rotate3D target="{grid}" angleXFrom="0" angleXTo="0" angleZFrom="0" duration="350" autoCenterTransform="true" angleYTo="180" angleYFrom="0" autoCenterProjection="true" angleZTo="0"/>
+ <s:Fade target="{grid}" startDelay="200" duration="50"/>
+ <s:Fade target="{line}" startDelay="250" duration="100"/>
+ </s:Parallel>
+ </s:Transition>
+ <s:Transition fromState="line" toState="bar" autoReverse="true">
+ <s:Parallel>
+ <s:Rotate3D target="{line}" angleXFrom="0" angleXTo="0" angleZFrom="0" duration="350" autoCenterTransform="true" angleYTo="180" angleYFrom="0" autoCenterProjection="true" angleZTo="0"/>
+ <s:Fade target="{line}" startDelay="200" duration="50"/>
+ <s:Fade target="{bar}" startDelay="250" duration="100"/>
+ </s:Parallel>
+ </s:Transition>
+ <s:Transition fromState="bar" toState="grid" autoReverse="true">
+ <s:Parallel>
+ <s:Rotate3D target="{bar}" angleXFrom="0" angleXTo="0" angleZFrom="0" duration="350" autoCenterTransform="true" angleYTo="180" angleYFrom="0" autoCenterProjection="true" angleZTo="0"/>
+ <s:Fade target="{bar}" startDelay="200" duration="50"/>
+ <s:Fade target="{grid}" startDelay="250" duration="100"/>
+ </s:Parallel>
+ </s:Transition>
+ </s:transitions>
+
+ <s:DataGroup id="headers" dataProvider="{items}" width="170">
+ <s:layout>
+ <s:VerticalLayout gap="1"/>
+ </s:layout>
+ <s:itemRenderer>
+ <fx:Component>
+ <s:DataRenderer width="100%">
+ <s:Label text="{data.label}:" backgroundColor="#919191" height="40" verticalAlign="middle" width="100%" textAlign="right" paddingRight="8"/>
+ <s:Rect width="4" height="40">
+ <s:fill>
+ <s:SolidColor color="#FF5900"/>
+ </s:fill>
+ </s:Rect>
+ </s:DataRenderer>
+ </fx:Component>
+ </s:itemRenderer>
+ </s:DataGroup>
+
+ <s:DataGroup id="grid" includeIn="grid,gridAndBar,gridAndLine" dataProvider="{items}" itemRenderer="renderers.AssetSummaryRenderer"
+ left="171" width.gridAndBar="250" width.gridAndLine="260" width.grid="100%">
+ <s:layout>
+ <s:VerticalLayout gap="1"/>
+ </s:layout>
+ </s:DataGroup>
+
+ <charts:SummaryChart id="line" includeIn="line,gridAndLine" right="0" top="0" left="{chartLeft}"/>
+ <charts:BarChart id="bar" includeIn="bar,gridAndBar" right="0" top="0" left="{chartLeft}"/>
+
+</s:Group>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/controller/Feed.as
----------------------------------------------------------------------
diff --git a/MobileTrader/src/controller/Feed.as b/MobileTrader/src/controller/Feed.as
new file mode 100644
index 0000000..41b56eb
--- /dev/null
+++ b/MobileTrader/src/controller/Feed.as
@@ -0,0 +1,143 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Christophe Coenraets, http://coenraets.org
+ */
+package controller
+{
+ import flash.events.TimerEvent;
+ import flash.utils.Dictionary;
+ import flash.utils.Timer;
+ import model.Stock;
+ import mx.collections.ArrayCollection;
+
+ public class Feed
+ {
+ 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:Dictionary;
+
+ [Bindable]
+ public var stockList:ArrayCollection;
+
+ public function Feed()
+ {
+ stockMap = new Dictionary();
+ stockList = new ArrayCollection();
+
+ stockList.addItem(new Stock("XOM", 81.39));
+ stockList.addItem(new Stock("WMT", 51.47));
+ stockList.addItem(new Stock("CVX", 102.93));
+ stockList.addItem(new Stock("AIG", 36.01));
+ stockList.addItem(new Stock("IBM", 155.49));
+ stockList.addItem(new Stock("SAP", 57.53));
+ stockList.addItem(new Stock("MOT", 41.50));
+ stockList.addItem(new Stock("MCD", 73));
+
+ var stockCount:int = stockList.length;
+
+ for (var k:int = 0; k < stockCount; k++)
+ {
+ var s:Stock = stockList.getItemAt(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.getItemAt(j) as Stock, false);
+ }
+ }
+ timer = new Timer(1000 / 8, 0);
+ timer.addEventListener(TimerEvent.TIMER, timerHandler);
+ }
+
+ public function subscribe():void
+ {
+ if (!timer.running)
+ {
+ timer.start();
+ }
+ }
+
+ public function unsubscribe():void
+ {
+ if (timer.running)
+ {
+ timer.stop();
+ }
+ }
+
+ protected function timerHandler(event:TimerEvent):void
+ {
+ if (index >= stockList.length) index = 0;
+ simulateChange(stockList.getItemAt(updateOrder[index]) as Stock, true);
+ index++;
+ }
+
+ 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 ArrayCollection();
+ }
+ if (removeFirst)
+ {
+ stock.history.removeItemAt(0);
+ }
+ stock.history.addItem({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-utilities/blob/b2f1e508/MobileTrader/src/model/Stock.as
----------------------------------------------------------------------
diff --git a/MobileTrader/src/model/Stock.as b/MobileTrader/src/model/Stock.as
new file mode 100644
index 0000000..832eacf
--- /dev/null
+++ b/MobileTrader/src/model/Stock.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Christophe Coenraets, http://coenraets.org
+ */
+package model
+{
+ import mx.collections.ArrayCollection;
+
+ [Bindable]
+ 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:ArrayCollection;
+
+ public function Stock(symbol:String, last:Number)
+ {
+ this.symbol = symbol;
+ this.last = last;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/renderers/AssetSummaryRenderer.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/renderers/AssetSummaryRenderer.mxml b/MobileTrader/src/renderers/AssetSummaryRenderer.mxml
new file mode 100644
index 0000000..e28772b
--- /dev/null
+++ b/MobileTrader/src/renderers/AssetSummaryRenderer.mxml
@@ -0,0 +1,47 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:DataRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark" width="100%">
+
+ <fx:Script>
+ <![CDATA[
+ [Bindable]
+ [Embed("assets/up.png")]
+ protected var iconUp:Class;
+
+ [Bindable]
+ [Embed("assets/down.png")]
+ protected var iconDown:Class;
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:CurrencyFormatter id="cf" useCurrencySymbol="true" fractionalDigits="0" />
+ <s:NumberFormatter id="nf" fractionalDigits="2" />
+ </fx:Declarations>
+
+ <s:HGroup gap="1" width="100%">
+ <s:Label text="{cf.format(data.value)}" backgroundColor="#F0F0F0" height="40" verticalAlign="middle" width="140" textAlign="right" paddingRight="8"/>
+ <s:Label text="{data.change>0?'+':''}{nf.format(data.change)}" color="{data.change>0?0x006600:0xFF0000}" backgroundColor="#F0F0F0" height="40" verticalAlign="middle" width="119" textAlign="right" paddingRight="20"/>
+ </s:HGroup>
+ <s:Image source="{data.change>0?iconUp:iconDown}" x="242" top="14"/>
+
+</s:DataRenderer>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/renderers/StockRenderer.as
----------------------------------------------------------------------
diff --git a/MobileTrader/src/renderers/StockRenderer.as b/MobileTrader/src/renderers/StockRenderer.as
new file mode 100644
index 0000000..16981c6
--- /dev/null
+++ b/MobileTrader/src/renderers/StockRenderer.as
@@ -0,0 +1,134 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+/**
+ * Christophe Coenraets, http://coenraets.org
+ */
+package renderers
+{
+ import flashx.textLayout.formats.VerticalAlign;
+
+ import mx.formatters.NumberFormatter;
+ import mx.graphics.SolidColor;
+ import mx.states.SetStyle;
+
+ import spark.components.Group;
+ import spark.components.HGroup;
+ import spark.components.Image;
+ import spark.components.Label;
+ import spark.components.LabelItemRenderer;
+ import spark.primitives.Rect;
+
+ public class StockRenderer extends LabelItemRenderer
+ {
+ public var hGroup:HGroup;
+ public var symbolLabel:Label;
+ public var openLabel:Label;
+ public var lastLabel:Label;
+ public var highLabel:Label;
+ public var lowLabel:Label;
+ public var chartIcon:Image;
+
+ [Embed("assets/chart_icon.png")]
+ private var chartIconClass:Class;
+
+ protected var nf:NumberFormatter = new NumberFormatter();
+
+ public function StockRenderer()
+ {
+ super();
+ nf.precision = 2;
+ }
+
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+ if (!value) return;
+ symbolLabel.text = value.symbol;
+ openLabel.text = nf.format(value.open);
+ lastLabel.text = nf.format(value.last);
+ if (value.change < 0)
+ lastLabel.setStyle("color", 0xFF0000);
+ else
+ lastLabel.setStyle("color", 0x006600);
+ highLabel.text = nf.format(value.high);
+ lowLabel.text = nf.format(value.low);
+ }
+
+ override protected function createChildren():void {
+ if (!hGroup)
+ {
+ hGroup = new HGroup();
+ hGroup.paddingLeft = 10;
+ hGroup.paddingRight = 10;
+ hGroup.verticalAlign = "middle";
+ addChild(hGroup);
+ }
+
+ if (!symbolLabel) {
+ symbolLabel = new Label();
+ symbolLabel.percentWidth = 100;
+ hGroup.addElement(symbolLabel);
+ }
+ if (!openLabel) {
+ openLabel = new Label();
+ openLabel.percentWidth = 100;
+ openLabel.setStyle("textAlign", "right");
+ hGroup.addElement(openLabel);
+ }
+ if (!lastLabel) {
+ lastLabel = new Label();
+ lastLabel.percentWidth = 100;
+ lastLabel.setStyle("textAlign", "right");
+ hGroup.addElement(lastLabel);
+ }
+ if (!highLabel) {
+ highLabel = new Label();
+ highLabel.percentWidth = 100;
+ highLabel.setStyle("textAlign", "right");
+ hGroup.addElement(highLabel);
+ }
+ if (!lowLabel) {
+ lowLabel = new Label();
+ lowLabel.percentWidth = 100;
+ lowLabel.setStyle("textAlign", "right");
+ hGroup.addElement(lowLabel);
+ }
+ if (!chartIcon) {
+ chartIcon = new Image();
+ chartIcon.source = chartIconClass;
+ hGroup.addElement(chartIcon);
+ }
+
+
+ }
+
+ // Override layoutContents() to lay out the HGroup container.
+ override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
+ {
+ // Make sure our width/height is in the min/max for the label
+ var childWidth:Number = unscaledWidth - 6;
+ childWidth = Math.max(hGroup.getMinBoundsWidth(), Math.min(hGroup.getMaxBoundsWidth(), childWidth));
+ var childHeight:Number = unscaledHeight - 10;
+ childHeight = Math.max(hGroup.getMinBoundsHeight(), Math.min(hGroup.getMaxBoundsHeight(), childHeight));
+ // Set the label's position and size
+ hGroup.setLayoutBoundsSize(childWidth, childHeight);
+ hGroup.setLayoutBoundsPosition(3, 5);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/skins/ActionBarSkin.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/skins/ActionBarSkin.mxml b/MobileTrader/src/skins/ActionBarSkin.mxml
new file mode 100644
index 0000000..593ae0c
--- /dev/null
+++ b/MobileTrader/src/skins/ActionBarSkin.mxml
@@ -0,0 +1,67 @@
+<?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.
+
+-->
+<!-- Christophe Coenraets, http://coenraets.org -->
+<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark">
+ <!-- host component -->
+ <fx:Metadata>
+ [HostComponent("spark.components.ActionBar")]
+ </fx:Metadata>
+
+ <!-- states -->
+ <s:states>
+ <s:State name="titleContentWithActionAndNavigation" />
+ <s:State name="titleContentWithNavigation" />
+ <s:State name="titleContentWithAction" />
+ <s:State name="titleContent" />
+ <s:State name="titleWithActionAndNavigation" />
+ <s:State name="titleWithNavigation" />
+ <s:State name="titleWithAction" />
+ <s:State name="title" />
+ </s:states>
+
+ <!-- SkinParts
+ name=titleGroup, type=spark.components.Group, required=false
+ name=actionGroup, type=spark.components.Group, required=false
+ name=navigationGroup, type=spark.components.Group, required=false
+ name=titleDisplay, type=spark.core.IDisplayText, required=false
+ -->
+ <s:layout>
+ <s:BasicLayout/>
+ </s:layout>
+
+ <s:Image source="@Embed('assets/background.png')" scaleMode="stretch" left="0" right="0"/>
+
+ <s:HGroup width="100%">
+ <s:Group id="navigationGroup">
+
+ </s:Group>
+
+ <s:Image source="@Embed('assets/logo.png')" x="60"/>
+
+ <s:Group id="titleGroup" width="100%">
+ </s:Group>
+
+ <s:Group id="actionGroup">
+
+ </s:Group>
+ </s:HGroup>
+
+</s:Skin>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/skins/ListHeaderButtonSkin.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/skins/ListHeaderButtonSkin.mxml b/MobileTrader/src/skins/ListHeaderButtonSkin.mxml
new file mode 100644
index 0000000..8b81dcb
--- /dev/null
+++ b/MobileTrader/src/skins/ListHeaderButtonSkin.mxml
@@ -0,0 +1,186 @@
+<?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.
+
+-->
+
+
+<!--- The default skin class for the Spark Button component.
+
+@see spark.components.Button
+
+@langversion 3.0
+@playerversion Flash 10
+@playerversion AIR 1.5
+@productversion Flex 4
+-->
+<s:SparkButtonSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
+ minWidth="21" minHeight="21"
+ alpha.disabled="0.5">
+
+ <fx:Metadata>
+ <![CDATA[
+ /**
+ * @copy spark.skins.spark.ApplicationSkin#hostComponent
+ */
+ [HostComponent("spark.components.Button")]
+ ]]>
+ </fx:Metadata>
+
+ <fx:Script fb:purpose="styling">
+ <![CDATA[
+ import spark.components.Group;
+ /* Define the skin elements that should not be colorized.
+ For button, the graphics are colorized but the label is not. */
+ static private const exclusions:Array = ["labelDisplay"];
+
+ /**
+ * @private
+ */
+ override public function get colorizeExclusions():Array {return exclusions;}
+
+ /**
+ * @private
+ */
+ override protected function initializationComplete():void
+ {
+ useChromeColor = true;
+ super.initializationComplete();
+ }
+
+ /**
+ * @private
+ */
+ override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void
+ {
+ var cr:Number = getStyle("cornerRadius");
+
+ if (cornerRadius != cr)
+ {
+ cornerRadius = cr;
+ //shadow.radiusX = cornerRadius;
+ fill.radiusX = 0;
+ //lowlight.radiusX = 0;
+ //highlight.radiusX = 0;
+ border.radiusX = 0;
+ }
+
+ if (highlightStroke) highlightStroke.radiusX = cornerRadius;
+ if (hldownstroke1) hldownstroke1.radiusX = cornerRadius;
+ if (hldownstroke2) hldownstroke2.radiusX = cornerRadius;
+
+ super.updateDisplayList(unscaledWidth, unscaledHeight);
+ }
+
+ private var cornerRadius:Number = 0;
+
+ ]]>
+ </fx:Script>
+
+ <!-- states -->
+ <s:states>
+ <s:State name="up" />
+ <s:State name="over" />
+ <s:State name="down" />
+ <s:State name="disabled" />
+ </s:states>
+
+ <!-- layer 1: shadow -->
+
+
+ <!-- layer 2: fill -->
+ <!--- @private -->
+ <s:Rect id="fill" left="0" right="0" top="0" bottom="0" radiusX="0">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="0xFFFFFF"
+ color.over="0xBBBDBD"
+ color.down="0xAAAAAA"
+ alpha="0.85" />
+ <s:GradientEntry color="0xD8D8D8"
+ color.over="0x9FA0A1"
+ color.down="0x929496"
+ alpha="0.85" />
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+
+
+
+
+ <!-- layer 5: highlight stroke (all states except down) -->
+ <!--- @private -->
+ <s:Rect id="highlightStroke" left="0" right="0" top="0" bottom="0" radiusX="0" excludeFrom="down">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0xFFFFFF" alpha.over="0.22" />
+ <s:GradientEntry color="0xD8D8D8" alpha.over="0.22" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+
+ <!-- layer 6: highlight stroke (down state only) -->
+ <!--- @private -->
+ <s:Rect id="hldownstroke1" left="0" right="0" top="0" bottom="0" radiusX="0" includeIn="down">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.0" />
+ <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.001" />
+ <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.0011" />
+ <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.965" />
+ <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.9651" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+ <!--- @private -->
+ <s:Rect id="hldownstroke2" left="0" right="0" top="0" bottom="0" radiusX="0" includeIn="down">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0x000000" alpha="0.09" ratio="0.0" />
+ <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.0001" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+
+ <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 -->
+ <!--- @private -->
+ <s:Rect id="border" left="0" right="0" top="0" bottom="0" width="69" height="20" radiusX="0">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0x000000"
+ alpha="0.5625"
+ alpha.down="0.6375" />
+ <s:GradientEntry color="0x000000"
+ alpha="0.75"
+ alpha.down="0.85" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+
+ <!-- layer 8: text -->
+ <!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay -->
+ <s:Label id="labelDisplay"
+ textAlign="left"
+ maxDisplayedLines="1"
+ horizontalCenter="0" verticalCenter="1" verticalAlign="middle"
+ left="10" right="10" top="2" bottom="2">
+ </s:Label>
+
+</s:SparkButtonSkin>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/skins/ListHeaderButtonSkinRightAlign.mxml
----------------------------------------------------------------------
diff --git a/MobileTrader/src/skins/ListHeaderButtonSkinRightAlign.mxml b/MobileTrader/src/skins/ListHeaderButtonSkinRightAlign.mxml
new file mode 100644
index 0000000..9bf3311
--- /dev/null
+++ b/MobileTrader/src/skins/ListHeaderButtonSkinRightAlign.mxml
@@ -0,0 +1,186 @@
+<?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.
+
+-->
+
+
+<!--- The default skin class for the Spark Button component.
+
+@see spark.components.Button
+
+@langversion 3.0
+@playerversion Flash 10
+@playerversion AIR 1.5
+@productversion Flex 4
+-->
+<s:SparkButtonSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:fb="http://ns.adobe.com/flashbuilder/2009"
+ minWidth="21" minHeight="21"
+ alpha.disabled="0.5">
+
+ <fx:Metadata>
+ <![CDATA[
+ /**
+ * @copy spark.skins.spark.ApplicationSkin#hostComponent
+ */
+ [HostComponent("spark.components.Button")]
+ ]]>
+ </fx:Metadata>
+
+ <fx:Script fb:purpose="styling">
+ <![CDATA[
+ import spark.components.Group;
+ /* Define the skin elements that should not be colorized.
+ For button, the graphics are colorized but the label is not. */
+ static private const exclusions:Array = ["labelDisplay"];
+
+ /**
+ * @private
+ */
+ override public function get colorizeExclusions():Array {return exclusions;}
+
+ /**
+ * @private
+ */
+ override protected function initializationComplete():void
+ {
+ useChromeColor = true;
+ super.initializationComplete();
+ }
+
+ /**
+ * @private
+ */
+ override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void
+ {
+ var cr:Number = getStyle("cornerRadius");
+
+ if (cornerRadius != cr)
+ {
+ cornerRadius = cr;
+ //shadow.radiusX = cornerRadius;
+ fill.radiusX = 0;
+ //lowlight.radiusX = 0;
+ //highlight.radiusX = 0;
+ border.radiusX = 0;
+ }
+
+ if (highlightStroke) highlightStroke.radiusX = cornerRadius;
+ if (hldownstroke1) hldownstroke1.radiusX = cornerRadius;
+ if (hldownstroke2) hldownstroke2.radiusX = cornerRadius;
+
+ super.updateDisplayList(unscaledWidth, unscaledHeight);
+ }
+
+ private var cornerRadius:Number = 0;
+
+ ]]>
+ </fx:Script>
+
+ <!-- states -->
+ <s:states>
+ <s:State name="up" />
+ <s:State name="over" />
+ <s:State name="down" />
+ <s:State name="disabled" />
+ </s:states>
+
+ <!-- layer 1: shadow -->
+
+
+ <!-- layer 2: fill -->
+ <!--- @private -->
+ <s:Rect id="fill" left="0" right="0" top="0" bottom="0" radiusX="0">
+ <s:fill>
+ <s:LinearGradient rotation="90">
+ <s:GradientEntry color="0xFFFFFF"
+ color.over="0xBBBDBD"
+ color.down="0xAAAAAA"
+ alpha="0.85" />
+ <s:GradientEntry color="0xD8D8D8"
+ color.over="0x9FA0A1"
+ color.down="0x929496"
+ alpha="0.85" />
+ </s:LinearGradient>
+ </s:fill>
+ </s:Rect>
+
+
+
+
+
+ <!-- layer 5: highlight stroke (all states except down) -->
+ <!--- @private -->
+ <s:Rect id="highlightStroke" left="0" right="0" top="0" bottom="0" radiusX="0" excludeFrom="down">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0xFFFFFF" alpha.over="0.22" />
+ <s:GradientEntry color="0xD8D8D8" alpha.over="0.22" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+
+ <!-- layer 6: highlight stroke (down state only) -->
+ <!--- @private -->
+ <s:Rect id="hldownstroke1" left="0" right="0" top="0" bottom="0" radiusX="0" includeIn="down">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.0" />
+ <s:GradientEntry color="0x000000" alpha="0.25" ratio="0.001" />
+ <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.0011" />
+ <s:GradientEntry color="0x000000" alpha="0.07" ratio="0.965" />
+ <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.9651" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+ <!--- @private -->
+ <s:Rect id="hldownstroke2" left="0" right="0" top="0" bottom="0" radiusX="0" includeIn="down">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0x000000" alpha="0.09" ratio="0.0" />
+ <s:GradientEntry color="0x000000" alpha="0.00" ratio="0.0001" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+
+ <!-- layer 7: border - put on top of the fill so it doesn't disappear when scale is less than 1 -->
+ <!--- @private -->
+ <s:Rect id="border" left="0" right="0" top="0" bottom="0" width="69" height="20" radiusX="0">
+ <s:stroke>
+ <s:LinearGradientStroke rotation="90" weight="1">
+ <s:GradientEntry color="0x000000"
+ alpha="0.5625"
+ alpha.down="0.6375" />
+ <s:GradientEntry color="0x000000"
+ alpha="0.75"
+ alpha.down="0.85" />
+ </s:LinearGradientStroke>
+ </s:stroke>
+ </s:Rect>
+
+ <!-- layer 8: text -->
+ <!--- @copy spark.components.supportClasses.ButtonBase#labelDisplay -->
+ <s:Label id="labelDisplay"
+ textAlign="right"
+ maxDisplayedLines="1"
+ horizontalCenter="0" verticalCenter="1" verticalAlign="middle"
+ left="10" right="10" top="2" bottom="2">
+ </s:Label>
+
+</s:SparkButtonSkin>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b2f1e508/MobileTrader/src/styles.css
----------------------------------------------------------------------
diff --git a/MobileTrader/src/styles.css b/MobileTrader/src/styles.css
new file mode 100644
index 0000000..f205870
--- /dev/null
+++ b/MobileTrader/src/styles.css
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+@namespace "library://ns.adobe.com/flex/spark";
+
+ActionBar
+{
+ skinClass: ClassReference("skins.ActionBarSkin");
+}
+
+TabbedViewNavigatorApplication
+{
+ backgroundColor: #000000;
+}
+
+View
+{
+ backgroundColor: #DCDCDC;
+}
+
+List
+{
+ alternatingItemColors: #F0F0F0,#DCDCDC;
+
+}
+
+global
+{
+ fontSize: 20;
+}