You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/08/24 07:33:07 UTC
[17/34] git commit: [flex-asjs] [refs/heads/develop] - move examples
into a flexjs folder now that we have a native folder for low-level examples
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilter.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilter.as b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilter.as
new file mode 100755
index 0000000..d182371
--- /dev/null
+++ b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilter.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 samples.flexstore
+{
+
+[Bindable]
+public class ProductFilter
+{
+ public var count:int;
+ public var experience:String;
+ public var minPrice:Number;
+ public var maxPrice:Number;
+ public var blazeds:Boolean;
+ public var mobile:Boolean;
+ public var video:Boolean;
+
+ public function ProductFilter()
+ {
+ super();
+ }
+
+ public function accept(product:Product):Boolean
+ {
+ //price is often the first test so let's fail fast if possible
+ if (minPrice > product.price || maxPrice < product.price)
+ return false;
+ if (experience != "All" && experience > product.experience)
+ return false;
+ if (blazeds && !product.blazeds)
+ return false;
+ if (mobile && !product.mobile)
+ return false;
+ if (video && !product.video)
+ return false;
+
+ return true;
+ }
+}
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilterEvent.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilterEvent.as b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilterEvent.as
new file mode 100755
index 0000000..28129e7
--- /dev/null
+++ b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductFilterEvent.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 samples.flexstore
+{
+
+import org.apache.flex.events.Event;
+
+public class ProductFilterEvent extends Event
+{
+ public static const FILTER:String = "filter";
+
+ public var live:Boolean;
+ public var filter:ProductFilter;
+
+ public function ProductFilterEvent(filter:ProductFilter, live:Boolean)
+ {
+ super(FILTER);
+ this.filter = filter;
+ this.live = live;
+ }
+}
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductListEvent.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductListEvent.as b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductListEvent.as
new file mode 100755
index 0000000..b6b9371
--- /dev/null
+++ b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductListEvent.as
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package samples.flexstore
+{
+
+import org.apache.flex.events.Event;
+
+public class ProductListEvent extends Event
+{
+ public static const ADD_PRODUCT:String = "addProduct";
+ public static const DUPLICATE_PRODUCT:String = "duplicateProduct";
+ public static const REMOVE_PRODUCT:String = "removeProduct";
+ public static const PRODUCT_QTY_CHANGE:String = "productQtyChange";
+
+ public var product:Product;
+
+ //making the default bubbles behavior of the event to true since we want
+ //it to bubble out of the ProductListItem and beyond
+ public function ProductListEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
+ {
+ super(type, bubbles, cancelable);
+ }
+
+}
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductThumbEvent.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductThumbEvent.as b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductThumbEvent.as
new file mode 100755
index 0000000..f92dc7f
--- /dev/null
+++ b/examples/flexjs/FlexJSStore_jquery/src/samples/flexstore/ProductThumbEvent.as
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package samples.flexstore
+{
+
+import org.apache.flex.events.Event;
+
+public class ProductThumbEvent extends Event
+{
+ public static const PURCHASE:String = "purchase";
+ public static const COMPARE:String = "compare";
+ public static const DETAILS:String = "details";
+ public static const BROWSE:String = "browse";
+
+ public var product:Product;
+
+ public function ProductThumbEvent(type:String, product:Product)
+ {
+ super(type);
+ this.product = product;
+ }
+
+ override public function cloneEvent():Event
+ {
+ return new ProductThumbEvent(type, product);
+ }
+}
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MapSearch/MapSearch-app.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/MapSearch-app.xml b/examples/flexjs/MapSearch/MapSearch-app.xml
new file mode 100644
index 0000000..5cf1d99
--- /dev/null
+++ b/examples/flexjs/MapSearch/MapSearch-app.xml
@@ -0,0 +1,252 @@
+<?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/4.0">
+
+<!-- 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/3.8
+ 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>org.apache.flexjs.mapsearch</id>
+
+ <!-- Used as the filename for the application. Required. -->
+ <filename>Apache FlexJS Google Map Example</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>Apache FlexJS Google Map Example</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.1</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 2013 The Apache Software Foundation.</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>MapSearch.swf</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>455</width>
+
+ <!-- The window's initial height in pixels. Optional. -->
+ <height>605</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, gpu, or direct). Optional. 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>false</autoOrients>
+ <fullScreen>false</fullScreen>
+ <visible>true</visible>
+ </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> -->
+ <supportedProfiles>extendedDesktop desktop</supportedProfiles>
+
+ <!-- The subpath of the standard default installation location to use. Optional. -->
+ <installFolder>Apache Flex</installFolder>
+
+ <!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
+ <programMenuFolder>Apache Flex</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>assets/icons/16.png</image16x16>
+ <image29x29>assets/icons/29.png</image29x29>
+ <image32x32>assets/icons/32.png</image32x32>
+ <image36x36>assets/icons/36.png</image36x36>
+ <image48x48>assets/icons/48.png</image48x48>
+ <image57x57>assets/icons/57.png</image57x57>
+ <image72x72>assets/icons/72.png</image72x72>
+ <image114x114>assets/icons/114.png</image114x114>
+ <image128x128>assets/icons/128.png</image128x128>
+ </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> -->
+ <!-- A list of plist key/value pairs to be added to the application Entitlements.plist -->
+ <!-- <Entitlements>
+ <![CDATA[
+ <key>keychain-access-groups</key>
+ <array>
+ <string></string>
+ <string></string>
+ </array>
+ ]]>
+ </Entitlements> -->
+ <!-- Display Resolution for the app (either "standard" or "high"). Optional. Default "standard" -->
+ <!-- <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-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> -->
+ <!-- Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit before namespace 3.0, 32bit after -->
+ <!-- <colorDepth></colorDepth> -->
+ <!-- </android> -->
+ <!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->
+
+</application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MapSearch/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/build.xml b/examples/flexjs/MapSearch/build.xml
new file mode 100644
index 0000000..05b8c2c
--- /dev/null
+++ b/examples/flexjs/MapSearch/build.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="mapsearch" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="MapSearch" />
+
+ <!-- this project needs AIR 3.4 FP 11.4 -->
+ <property name="swf.version" value="17" />
+ <property name="playerglobal.version" value="11.4" />
+
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${env.FALCON_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/>
+
+ <available file="${env.FALCONJX_HOME}/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${env.FALCONJX_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/>
+
+ <available file="${env.GOOG_HOME}/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${env.GOOG_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${FLEXJS_HOME}/js/lib/google/closure-library"/>
+
+ <property name="AIR_HOME" value="${env.AIR_HOME}"/>
+
+
+ <condition property="adl" value="adl.exe">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="adl" value="adl">
+ <os family="mac"/>
+ </condition>
+
+ <condition property="runtime" value="win">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="runtime" value="mac">
+ <os family="mac"/>
+ </condition>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compileair,build_example.compilejsair" description="Clean build of ${example}">
+ </target>
+
+ <target name="clean">
+ <echo>playerglobal.version = ${playerglobal.version}</echo>
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+ <target name="run">
+ <exec executable="${AIR_HOME}/bin/${adl}" dir="${basedir}/bin-debug" failonerror="true">
+ <arg value="-runtime" />
+ <arg value="${AIR_HOME}/runtimes/air/${runtime}" />
+ <arg value="-profile" />
+ <arg value="extendedDesktop" />
+ <arg value="${basedir}/bin-debug/${example}-app.xml" />
+ </exec>
+ </target>
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MapSearch/src/MapSearch.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/src/MapSearch.mxml b/examples/flexjs/MapSearch/src/MapSearch.mxml
new file mode 100644
index 0000000..af06140
--- /dev/null
+++ b/examples/flexjs/MapSearch/src/MapSearch.mxml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!---
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:models="models.*"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ >
+
+ <!-- This application demonstrates how to use the Google MAP API
+ on both the AIR and JavaScript/browser platform. After cross-
+ compiling this application for JavaScript, edit the index.html
+ file and include your Google developer API token.
+ -->
+
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+ <js:model>
+ <models:MyModel />
+ </js:model>
+ <js:beads>
+ <js:MixinManager />
+ </js:beads>
+
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MapSearch/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/src/MyInitialView.mxml b/examples/flexjs/MapSearch/src/MyInitialView.mxml
new file mode 100644
index 0000000..3199f1e
--- /dev/null
+++ b/examples/flexjs/MapSearch/src/MyInitialView.mxml
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<js:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ xmlns:google="library://ns.apache.org/flexjs/google"
+ xmlns:local="*"
+ initComplete="initControls()">
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.maps.google.models.MapModel;
+ import models.MyModel;
+
+ import org.apache.flex.events.Event;
+ import org.apache.flex.maps.google.Place;
+ import org.apache.flex.maps.google.Marker;
+
+ private function initControls() : void
+ {
+
+ }
+
+ /**
+ * Called when the map is ready for use. This function adds a variety of event
+ * listners, some of which will trigger a new search.
+ */
+ private function onMapReady() : void
+ {
+ map.addEventListener("centered", onMapCenteredOrChanged);
+ map.addEventListener("boundsChanged", onMapCenteredOrChanged);
+ map.addEventListener("zoomChanged", onMapCenteredOrChanged);
+ map.addEventListener("dragEnd", onMapCenteredOrChanged);
+ map.addEventListener("markerClicked", onMarkerClicked);
+
+ // Listen for changes to the search results on the map's model.
+ map.model.addEventListener("searchResultsChanged", onSearchResults);
+ }
+
+ private var selectedCity:String;
+
+ /**
+ * Triggered by a change in the drop list with a new city selected. This
+ * will also update the input fields.
+ */
+ private function changeCity(event:org.apache.flex.events.Event) : void
+ {
+ var index:int = list.selectedIndex;
+ mapLocation.text = MyModel(applicationModel).cities[index];
+ codeAddress();
+ }
+
+ private function codeAddress() : void
+ {
+ map.markAddress(mapLocation.text);
+ }
+
+ private function searchOnMap() : void
+ {
+ map.nearbySearch(search.text);
+ }
+
+ private function clearSearchResults() : void
+ {
+ map.clearSearchResults();
+ }
+
+ private function orientMap() : void
+ {
+ map.centerOnAddress(mapLocation.text);
+ }
+
+ /**
+ * Called when the map has been re-centered or moved. The search results are
+ * cleared and a new search is triggered.
+ */
+ private function onMapCenteredOrChanged(event:org.apache.flex.events.Event):void
+ {
+ clearSearchResults();
+ if (search.text) searchOnMap();
+ }
+
+ /**
+ * Called when search results are available in the map's model. This function
+ * transfers those results to the application's model which is bound to the
+ * List component.
+ */
+ private function onSearchResults(event:org.apache.flex.events.Event):void
+ {
+ var searchResults:Array = MapModel(map.model).searchResults;
+ MyModel(applicationModel).searchResults = searchResults;
+ }
+
+ /**
+ * Called when a marker on the map has been selected. This function centers
+ * the map on the marker and, if necessary, zooms the map in for closer
+ * inspection.
+ */
+ private function onMarkerClicked(event:org.apache.flex.events.Event):void
+ {
+ var marker:Marker = map.selectedMarker;
+ map.setZoom(12);
+ map.setCenter(marker.position);
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Style>
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+
+ .FormLabel {
+ font-weight: bold;
+ font-size: 12;
+ padding-left: 20px;
+ padding-right: 20px;
+ padding-top: 20px;
+ padding-bottom: 20px;
+ height: 22px;
+ }
+
+ .FormButton {
+ font-weight: bold;
+ font-size: 12;
+ color: #000000;
+ background-color: #FFFFFF;
+ border-style: solid;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ padding-left: 5px;
+ padding-right: 5px;
+ }
+
+ .FormInput {
+ font-weight: normal;
+ font-size: 12;
+ color: #0000DE;
+ padding: 0px;
+ height: 20px;
+ }
+
+ .InnerBox {
+ margin-top: 11px;
+ margin-bottom: 10px;
+ }
+ </fx:Style>
+
+ <js:beads>
+ <js:ViewBaseDataBinding />
+ </js:beads>
+
+
+ <js:Container x="5" y="5" className="topContainer" >
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+
+ <js:Container className="InnerBox">
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:Label id="label1" text="Location:" className="FormLabel" />
+ <js:TextInput id="mapLocation" />
+ <js:TextButton text="Go" id="goButton" click="orientMap()" className="FormButton" />
+
+ <js:DropDownList id="list" width="100" height="20"
+ change="changeCity(event)"
+ dataProvider="{MyModel(applicationModel).cities}" />
+ </js:Container>
+
+ <google:Map id="map" width="450" height="300" className="MainMap"
+ token="AIzaSyDkQgg2iojLCYeuW6hK7DkuAHD-SwJJhdE"
+ ready="onMapReady()"/>
+
+ <js:Container className="InnerBox">
+ <js:beads>
+ <js:HorizontalLayout />
+ </js:beads>
+ <js:Label id="label2" text="Search on Map:" className="FormLabel" />
+ <js:TextInput id="search" />
+ <js:TextButton text="Find" click="searchOnMap()" className="FormButton" />
+ <js:TextButton text="Clear"click="clearSearchResults()" className="FormButton" />
+ </js:Container>
+
+ <js:List id="resultsList" width="450" height="200">
+ <js:beads>
+ <js:SimpleBinding
+ sourceID="applicationModel"
+ sourcePropertyName="searchResults"
+ eventName="searchResultsChanged"
+ destinationPropertyName="dataProvider" />
+ </js:beads>
+ </js:List>
+
+ </js:Container>
+
+</js:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MapSearch/src/models/MyModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/src/models/MyModel.as b/examples/flexjs/MapSearch/src/models/MyModel.as
new file mode 100644
index 0000000..528da95
--- /dev/null
+++ b/examples/flexjs/MapSearch/src/models/MyModel.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package models
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ public class MyModel extends EventDispatcher implements IBeadModel
+ {
+ public function MyModel()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+
+ private var _cities:Array = ["Sydney", "NYC", "Mexico City", "London", "Rio de Janeiro"];
+ public function get cities():Array
+ {
+ return _cities;
+ }
+
+ private var _coordinates:Array = [{lat:-33.86, lng:151.211},
+ {lat:40.712, lng:-74.0059},
+ {lat:19.26, lng:-99.03},
+ {lat:51.4, lng:-0.1},
+ {lat:-22.95, lng:-43.12}];
+ public function get coordinates():Array
+ {
+ return _coordinates;
+ }
+
+ private var _searchResults:Array = [];
+
+ [Bindable("searchResultsChanged")]
+ public function get searchResults():Array
+ {
+ return _searchResults;
+ }
+ public function set searchResults(value:Array):void
+ {
+ _searchResults = value;
+ dispatchEvent(new Event("searchResultsChanged"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/build.xml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/build.xml b/examples/flexjs/MobileTrader/build.xml
new file mode 100644
index 0000000..2471ff8
--- /dev/null
+++ b/examples/flexjs/MobileTrader/build.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+
+<project name="mobiletrader" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="MobileTrader" />
+
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${env.FALCON_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/>
+
+ <available file="${env.FALCONJX_HOME}/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${env.FALCONJX_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler.jx/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler.jx"/>
+
+ <available file="${env.GOOG_HOME}/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${env.GOOG_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${FLEXJS_HOME}/js/lib/google/closure-library"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/MobileTrader.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/MobileTrader.mxml b/examples/flexjs/MobileTrader/src/MobileTrader.mxml
new file mode 100755
index 0000000..8def93c
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/MobileTrader.mxml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!---
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:models="models.*"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ xmlns:controller="controller.*"
+ >
+
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+
+ <js:model>
+ <models:ProductsModel />
+ </js:model>
+
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/MyInitialView.mxml b/examples/flexjs/MobileTrader/src/MyInitialView.mxml
new file mode 100755
index 0000000..606839e
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/MyInitialView.mxml
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:views="views.*"
+ xmlns:apache="org.apache.flex.html.beads.*"
+ xmlns:html="org.apache.flex.html.*"
+ xmlns:controller="controller.*"
+ initComplete="onInitComplete()" xmlns:models="models.*" >
+
+ <fx:Style>
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+ @namespace views "views.*";
+
+ basic|Container {
+ background-color: #FFFFFF;
+ }
+
+ basic|StackedViewManager {
+ padding-top: 0px;
+ padding-bottom: 0px;
+ padding-left: 0px;
+ padding-right: 0px;
+ }
+
+ basic|TabbedViewManager {
+ position : absolute ;
+ height : 640px ;
+ width : 480px ;
+ left : 100px ;
+ top : 20px ;
+ border: solid 1px #444444;
+ background-color: #FFFFFF;
+ }
+
+ .NavigationBar {
+ background-image: url("assets/background.png");
+ height: 55px;
+ IBeadLayout: ClassReference("org.apache.flex.html.beads.layouts.HorizontalLayout");
+ }
+
+ .TabBar {
+ background-color: #DEDEDE;
+ height: 55px;
+ vertical-align: middle;
+ line-height: 55px;
+ }
+
+ .BackButton:hover {
+ background-image: url('assets/arrow_left_24.png');
+ }
+
+ .BackButton:active {
+ background-image: url('assets/arrow_left_24.png');
+ }
+
+ .BackButton {
+ background-image: url('assets/arrow_left_24.png');
+ }
+
+ .AssetsInner {
+ padding-top: 5px;
+ background-color: #FFFFFF;
+ }
+
+ views|AssetsView {
+ width: 480px;
+ height: 640px;
+ }
+
+ views|WatchListView {
+ width: 480px;
+ height: 640px;
+ IBeadController:ClassReference('controller.WatchListController');
+ background-color: #FFFFFF;
+ }
+
+ .WatchListInner {
+ height: 480px;
+ width: 480px;
+ }
+
+ .WatchListDataGrid {
+ height: 480px;
+ width: 480px;
+ }
+
+ .WatchListInputArea {
+ background-color: #FFFFFF;
+ width: 480px;
+ height: 25px;
+ padding-top: 5px;
+ padding-bottom: 2px;
+ }
+
+ views|StockView {
+ width: 480px;
+ height: 640px;
+ }
+
+ views|AlertsView {
+ width: 480px;
+ height: 640px;
+ IBeadController:ClassReference('controller.AlertsViewController');
+ }
+
+ .redCell {
+ color: #FF0000;
+ }
+
+ .greenCell {
+ color: #00FF00;
+ }
+
+ .ViewTitle {
+ font-size: 18pt;
+ font-weight: bold;
+ padding: 10pt;
+ }
+
+ .StockName {
+ font-size: 14pt;
+ font-weight: normal;
+ padding: 10pt;
+ }
+
+ .StockDetailArea {
+ padding: 10pt;
+ }
+
+ .StockLabel {
+ font-size: 18pt;
+ font-weight: normal;
+ color: #2255DD;
+ }
+
+ .StockRemoveButton {
+ background-color: #FF5522;
+ font-size: 16pt;
+ font-weight: bold;
+ color: #FFFFFF;
+ width: 200px;
+ height: 50px;
+ }
+
+ .StockRemoveButton:hover {
+ background-color: #DD3300;
+ }
+
+ .StockValue {
+ font-size: 18pt;
+ font-weight: normal;
+ color: #999999;
+ }
+
+ @media -flex-flash
+ {
+ .NavigationBar {
+ IBackgroundBead: ClassReference("org.apache.flex.html.beads.BackgroundImageBead");
+ }
+ }
+
+ </fx:Style>
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.mobile.IView;
+ import org.apache.flex.mobile.IViewManager;
+ import org.apache.flex.mobile.chrome.NavigationBar;
+
+ private function onInitComplete():void
+ {
+ }
+
+ private function onAssetsNext():void
+ {
+
+ }
+
+ private function tabbedViewChanged(event:org.apache.flex.events.Event):void
+ {
+ var manager:IViewManager = event.currentTarget as IViewManager;
+ trace("TabbedViewChanged for "+manager);
+ }
+
+ private function watchListStackChanged(event:org.apache.flex.events.Event):void
+ {
+ trace("watchlist stack changed");
+ var manager:StackedViewManager = event.currentTarget as StackedViewManager;
+
+ var currentView:IView = manager.selectedView;
+ backButton.visible = manager.views.length > 1;
+ }
+
+ private function goBack(event:org.apache.flex.events.Event):void
+ {
+ if (navController.selectedIndex == 1) {
+ watchListStack.pop();
+ }
+ }
+ ]]>
+ </fx:Script>
+
+ <basic:beads>
+ <basic:ViewBaseDataBinding />
+ </basic:beads>
+
+ <basic:TabbedViewManager id="navController" width="480" height="640" x="0" y="0" viewChanged="tabbedViewChanged(event)">
+ <basic:navigationBarItems>
+ <basic:TextButton id="backButton" width="45" height="45" className="BackButton" visible="false" click="goBack(event)">
+ <basic:beads>
+ <apache:ImageButtonView />
+ </basic:beads>
+ </basic:TextButton>
+ <basic:Image source="assets/logo.png" width="218" height="55" />
+ </basic:navigationBarItems>
+ <basic:views>
+ <basic:StackedViewManager title="Assets">
+ <basic:views>
+ <views:AssetsView id="assetsView" title="Assets" next="onAssetsNext()" />
+ </basic:views>
+ </basic:StackedViewManager>
+
+ <basic:StackedViewManager id="watchListStack" title="Watch List" viewChanged="watchListStackChanged(event)">
+ <basic:views>
+ <views:WatchListView id="watchListView" dataModel="{applicationModel}"/>
+ </basic:views>
+ </basic:StackedViewManager>
+
+ <views:AlertsView id="alertsView" title="Alerts" dataModel="{applicationModel}" />
+ </basic:views>
+ </basic:TabbedViewManager>
+
+</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/StockDataJSONItemConverter.as b/examples/flexjs/MobileTrader/src/StockDataJSONItemConverter.as
new file mode 100755
index 0000000..5c21c26
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/StockDataJSONItemConverter.as
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+ import org.apache.flex.collections.converters.JSONItemConverter;
+
+ public class StockDataJSONItemConverter extends JSONItemConverter
+ {
+ public function StockDataJSONItemConverter()
+ {
+ super();
+ }
+
+ override public function convertItem(data:String):Object
+ {
+ var obj:Object = super.convertItem(data);
+ if (obj["query"]["count"] == 0)
+ return "No Data";
+
+ obj = obj["query"]["results"]["quote"];
+ return obj;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/assets/arrow_left_24.png
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/assets/arrow_left_24.png b/examples/flexjs/MobileTrader/src/assets/arrow_left_24.png
new file mode 100755
index 0000000..a3019ba
Binary files /dev/null and b/examples/flexjs/MobileTrader/src/assets/arrow_left_24.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/assets/background.png
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/assets/background.png b/examples/flexjs/MobileTrader/src/assets/background.png
new file mode 100755
index 0000000..87bbd59
Binary files /dev/null and b/examples/flexjs/MobileTrader/src/assets/background.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/assets/logo.png
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/assets/logo.png b/examples/flexjs/MobileTrader/src/assets/logo.png
new file mode 100755
index 0000000..0fb0f21
Binary files /dev/null and b/examples/flexjs/MobileTrader/src/assets/logo.png differ
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/controller/AlertsViewController.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/controller/AlertsViewController.as b/examples/flexjs/MobileTrader/src/controller/AlertsViewController.as
new file mode 100644
index 0000000..716264d
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/controller/AlertsViewController.as
@@ -0,0 +1,139 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package controller
+{
+ import models.Alert;
+ import models.ProductsModel;
+ import models.Stock;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.utils.Timer;
+
+ import views.AlertsView;
+
+ public class AlertsViewController extends EventDispatcher implements IBeadController
+ {
+ public function AlertsViewController()
+ {
+ super();
+
+ timer = new Timer(updateInterval, 0);
+ timer.addEventListener("timer", timerHandler);
+ }
+
+ public var updateInterval:Number = 5000;
+
+ protected var timer:Timer;
+
+ private var _strand:IStrand;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var view:AlertsView = value as AlertsView;
+ view.addEventListener("alertSet", handleAlertSet);
+ }
+
+ private var _model:IBeadModel;
+ public function set model(value:IBeadModel):void
+ {
+ _model = value;
+ }
+ public function get model():IBeadModel
+ {
+ return _model;
+ }
+
+ private function handleAlertSet(event:Event):void
+ {
+ var view:AlertsView = _strand as AlertsView;
+
+ var sym:String = view.symbolField.text.toUpperCase();
+ var value:Number = Number(view.valueField.text);
+
+ var alert:Alert = new Alert();
+ alert.symbol = sym;
+ alert.value = value;
+ alert.greaterThan = view.higherCheck.selected;
+
+ // add this stock to the watch list in case it isn't there already
+ alert.stock = (model as ProductsModel).addStock(sym);
+
+ // set up the alert for the stock
+ (model as ProductsModel).addAlert(alert);
+
+ view.symbolField.text = "";
+ view.valueField.text = "";
+
+ subscribe();
+ }
+
+ public function subscribe():void
+ {
+ if (!timer.running)
+ {
+ timer.start();
+ }
+ }
+
+ public function unsubscribe():void
+ {
+ if (timer.running)
+ {
+ timer.stop();
+ }
+ }
+
+ /**
+ * When the timer goes off, verify all of the alerts against each stocks' last
+ * price.
+ */
+ protected function timerHandler(event:*):void
+ {
+ var alerts:Array = (model as ProductsModel).alerts;
+
+ if (alerts.length == 0) return;
+
+ for (var i:int=0; i < alerts.length; i++)
+ {
+ var alert:Alert = alerts[i] as Alert;
+ alert.message = "";
+
+ if (alert.greaterThan) {
+ if (alert.stock.last >= alert.value) {
+ alert.message = "Now @"+alert.stock.last;
+ }
+ }
+ else {
+ if (alert.stock.last <= alert.value) {
+ alert.message = "Now @"+alert.stock.last;
+ }
+ }
+ }
+
+ var newEvent:Event = new Event("alertsUpdate");
+ model.dispatchEvent(newEvent);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/controller/WatchListController.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/controller/WatchListController.as b/examples/flexjs/MobileTrader/src/controller/WatchListController.as
new file mode 100644
index 0000000..367b24f
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/controller/WatchListController.as
@@ -0,0 +1,137 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package controller
+{
+ import models.ProductsModel;
+ import models.Stock;
+
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.utils.Timer;
+
+ import views.StockView;
+ import views.WatchListView;
+
+ public class WatchListController extends EventDispatcher implements IBeadController
+ {
+ public function WatchListController()
+ {
+ super();
+
+ timer = new Timer(updateInterval, 0);
+ timer.addEventListener("timer", timerHandler);
+ }
+
+ public var updateInterval:Number = 5000;
+
+ protected var timer:Timer;
+
+ private var index:Number = 0;
+ private var selectedStock:Stock;
+ private var _strand:IStrand;
+
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var view:WatchListView = value as WatchListView;
+ view.addEventListener("addSymbol", handleAddSymbol);
+ view.addEventListener("stockSelected", handleGridSelection);
+ }
+
+ private var _model:IBeadModel;
+ public function set model(value:IBeadModel):void
+ {
+ _model = value;
+ }
+ public function get model():IBeadModel
+ {
+ return _model;
+ }
+
+ private function handleAddSymbol(event:Event):void
+ {
+ var view:WatchListView = _strand as WatchListView;
+ var symbol:String = view.symbolName.text.toUpperCase();
+
+ view.symbolName.text = "";
+
+ (model as ProductsModel).addStock(symbol);
+
+ subscribe();
+ }
+
+ private function handleGridSelection(event:Event):void
+ {
+ var view:WatchListView = _strand as WatchListView;
+ selectedStock = (model as ProductsModel).watchList[view.selectedStockIndex] as Stock;
+ trace("Selected stock "+selectedStock.symbol);
+
+ var stockView:StockView = view.showStockDetails(selectedStock);
+ stockView.addEventListener("removeFromList", handleRemoveFromList);
+ }
+
+ public function handleRemoveFromList(event:Event):void
+ {
+ (model as ProductsModel).removeStock(selectedStock);
+
+ var view:WatchListView = _strand as WatchListView;
+ view.popView();
+ }
+
+ public function subscribe():void
+ {
+ if (!timer.running)
+ {
+ timer.start();
+ }
+ }
+
+ public function unsubscribe():void
+ {
+ if (timer.running)
+ {
+ timer.stop();
+ }
+ }
+
+ /**
+ * Each time the handler goes off a different stock in the list
+ * is updated. This keeps the app from sending too many requests
+ * all at once.
+ */
+ protected function timerHandler(event:*):void
+ {
+ var stockList:Array = (model as ProductsModel).watchList;
+
+ if (stockList.length == 0) return;
+
+ if (index >= stockList.length) index = 0;
+
+ (model as ProductsModel).updateStockData(stockList[index] as Stock);
+ index++;
+
+ var newEvent:Event = new Event("update");
+ model.dispatchEvent(newEvent);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/models/Alert.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/models/Alert.as b/examples/flexjs/MobileTrader/src/models/Alert.as
new file mode 100644
index 0000000..7b9dc8b
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/models/Alert.as
@@ -0,0 +1,94 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package models
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ public class Alert extends EventDispatcher
+ {
+ public function Alert()
+ {
+ super();
+ message = "";
+ }
+
+ private var _symbol:String;
+ private var _value:Number;
+ private var _greaterThan:Boolean;
+ private var _message:String;
+ private var _stock:Stock;
+
+ [Binding("symbolChanged")]
+ public function get symbol():String
+ {
+ return _symbol;
+ }
+ public function set symbol(value:String):void
+ {
+ _symbol = value;
+ dispatchEvent(new Event("symbolChanged"));
+ }
+
+ [Binding("messageChanged")]
+ public function get message():String
+ {
+ return _message;
+ }
+ public function set message(value:String):void
+ {
+ _message = value;
+ dispatchEvent(new Event("messageChanged"));
+ }
+
+ [Binding("valueChanged")]
+ public function get value():Number
+ {
+ return _value;
+ }
+ public function set value(newValue:Number):void
+ {
+ _value = newValue;
+ dispatchEvent(new Event("valueChanged"));
+ }
+
+ [Binding("greaterThanChanged")]
+ public function get greaterThan():Boolean
+ {
+ return _greaterThan;
+ }
+ public function set greaterThan(value:Boolean):void
+ {
+ _greaterThan = value;
+ dispatchEvent(new Event("greaterThanChanged"));
+ }
+
+ [Binding("stockChanged")]
+ public function get stock():Stock
+ {
+ return _stock;
+ }
+ public function set stock(value:Stock):void
+ {
+ _stock = value;
+ dispatchEvent(new Event("stockChanged"));
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/models/AssetsModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/models/AssetsModel.as b/examples/flexjs/MobileTrader/src/models/AssetsModel.as
new file mode 100755
index 0000000..8824bc5
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/models/AssetsModel.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package models
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.EventDispatcher;
+
+ public class AssetsModel extends EventDispatcher implements IBeadModel
+ {
+ public function AssetsModel()
+ {
+ super();
+ }
+ private var _assetsData:Array = [
+ {label:"Net Worth:", value:161984, netChange:-2.37},
+ {label:"Last Month:", value:165915, netChange:10.98},
+ {label:"6 Months Ago:", value:145962, netChange:16.56},
+ {label:"Last Year:", value:138972, netChange:8.36}
+ ];
+ public function get assetsData():Array
+ {
+ return _assetsData;
+ }
+
+ public function set strand(value:IStrand):void
+ {
+ // not used
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/models/ProductsModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/models/ProductsModel.as b/examples/flexjs/MobileTrader/src/models/ProductsModel.as
new file mode 100755
index 0000000..7fb7a22
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/models/ProductsModel.as
@@ -0,0 +1,160 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package models
+{
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.net.HTTPService;
+ import org.apache.flex.collections.parsers.JSONInputParser;
+ import org.apache.flex.collections.LazyCollection;
+
+ public class ProductsModel extends EventDispatcher implements IBeadModel
+ {
+ public function ProductsModel()
+ {
+ super();
+
+ service = new HTTPService();
+ collection = new LazyCollection;
+ collection.inputParser = new JSONInputParser();
+ collection.itemConverter = new StockDataJSONItemConverter();
+ }
+
+ private var service:HTTPService;
+ private var collection:LazyCollection;
+ private var queryBegin:String = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22";
+ private var queryEnd:String = "%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json";
+
+ private var _strand:IStrand;
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ service.addBead(collection);
+ _strand.addBead(service);
+ }
+
+ private var _tabList:Array = ["Assets", "Watch", "Alerts"];
+ public function get tabList():Array
+ {
+ return _tabList;
+ }
+
+ private var _labelFields:Array = [ "id", "title", "detail" ];
+ public function get labelFields():Array
+ {
+ return _labelFields;
+ }
+
+ private var _watchList:Array = [];
+
+ public function get watchList():Array
+ {
+ return _watchList;
+ }
+
+ private var _alerts:Array = [];
+
+ public function get alerts():Array
+ {
+ return _alerts;
+ }
+
+ public function addAlert(value:Alert):void
+ {
+ for (var i:int =0; i < _alerts.length; i++)
+ {
+ var alert:Alert = _alerts[i] as Alert;
+ if (alert.symbol == value.symbol) {
+ _alerts[i] = value;
+ return;
+ }
+ }
+
+ _alerts.push(value);
+ dispatchEvent(new Event("alertsUpdate"));
+ }
+
+ public function addStock(symbol:String):Stock
+ {
+ for (var i:int=0; i < _watchList.length; i++)
+ {
+ var stock:Stock = _watchList[i];
+ if (stock.symbol == symbol) return stock;
+ }
+
+ stock = new Stock(symbol);
+
+ _watchList.push(stock);
+ dispatchEvent(new Event("update"));
+
+ updateStockData(stock);
+ return stock;
+ }
+
+ public function updateStockData(value:Stock):void
+ {
+ var sym:String = value.symbol;
+ service.url = queryBegin + sym + queryEnd;
+ service.send();
+ service.addEventListener("complete", completeHandler);
+ }
+
+ public function removeStock(stock:Stock):void
+ {
+ for (var i:int=0; i < alerts.length; i++)
+ {
+ var alert:Alert = alerts[i] as Alert;
+ if (stock.symbol == alert.symbol) {
+ alerts.splice(i,1);
+ break;
+ }
+ }
+
+ for (i=0; i < _watchList.length; i++)
+ {
+ var s:Stock = _watchList[i] as Stock;
+ if (stock.symbol == s.symbol) {
+ _watchList.splice(i,1);
+ break;
+ }
+ }
+
+ dispatchEvent(new Event("alertsUpdate"));
+ dispatchEvent(new Event("update"));
+ }
+
+ private function completeHandler(event:Event):void
+ {
+ var responseData:Object = collection.getItemAt(0);
+
+ var sym:String = responseData["Symbol"];
+ for (var i:int=0; i < _watchList.length; i++)
+ {
+ var stock:Stock = _watchList[i];
+ if (stock.symbol == sym) {
+ stock.updateFromData(responseData);
+ break;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/models/Stock.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/models/Stock.as b/examples/flexjs/MobileTrader/src/models/Stock.as
new file mode 100755
index 0000000..9e53f47
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/models/Stock.as
@@ -0,0 +1,148 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package models
+{
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.EventDispatcher;
+
+ public class Stock extends EventDispatcher
+ {
+ public var history:Array;
+
+ public function Stock(symbol:String=null, last:Number=0)
+ {
+ this.symbol = symbol;
+ this.last = last;
+ this.low = last;
+ this.high = last;
+ this.open = last;
+ this.change = 0;
+ this.name = "";
+ }
+
+ public function updateFromData(obj:Object):void
+ {
+ name = obj["Name"];
+ low = obj["DaysLow"];
+ high = obj["DaysHigh"];
+ open = obj["Open"];
+ change = obj["Change"];
+ symbol = obj["Symbol"];
+ last = obj["LastTradePriceOnly"];
+ }
+
+ private var _symbol:String;
+ private var _name:String;
+ private var _low:Number;
+ private var _high:Number;
+ private var _open:Number;
+ private var _last:Number;
+ private var _change:Number;
+ private var _date:Date;
+
+ [Bindable("symbolChanged")]
+ public function get symbol():String
+ {
+ return _symbol;
+ }
+ public function set symbol(value:String):void
+ {
+ _symbol = value;
+ dispatchEvent(new Event("symbolChanged"));
+ }
+
+ [Bindable("nameChanged")]
+ public function get name():String
+ {
+ return _name;
+ }
+ public function set name(value:String):void
+ {
+ _name = value;
+ dispatchEvent(new Event("nameChanged"));
+ }
+
+ [Bindable("lowChanged")]
+ public function get low():Number
+ {
+ return _low;
+ }
+ public function set low(value:Number):void
+ {
+ _low = value;
+ dispatchEvent(new Event("lowChanged"));
+ }
+
+ [Bindable("highChanged")]
+ public function get high():Number
+ {
+ return _high;
+ }
+ public function set high(value:Number):void
+ {
+ _high = value;
+ dispatchEvent(new Event("highChanged"));
+ }
+
+ [Bindable("openChanged")]
+ public function get open():Number
+ {
+ return _open;
+ }
+ public function set open(value:Number):void
+ {
+ _open = value;
+ dispatchEvent(new Event("openChanged"));
+ }
+
+ [Bindable("lastChanged")]
+ public function get last():Number
+ {
+ return _last;
+ }
+ public function set last(value:Number):void
+ {
+ _last = value;
+ dispatchEvent(new Event("lastChanged"));
+ }
+
+ [Bindable("changeChanged")]
+ public function get change():Number
+ {
+ return _change;
+ }
+ public function set change(value:Number):void
+ {
+ _change = value;
+ dispatchEvent(new Event("changeChanged"));
+ }
+
+ [Bindable("dateChanged")]
+ public function get date():Date
+ {
+ return _date;
+ }
+ public function set date(value:Date):void
+ {
+ _date = value;
+ dispatchEvent(new Event("dateChanged"));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as b/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as
new file mode 100644
index 0000000..e683020
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/renderers/AlertRenderer.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package renderers
+{
+ import org.apache.flex.html.supportClasses.StringItemRenderer;
+
+ public class AlertRenderer extends StringItemRenderer
+ {
+ public function AlertRenderer()
+ {
+ super();
+ }
+
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+
+ if (labelField == "greaterThan") {
+ if (Boolean(value[labelField])) {
+ text = "when over "+value["value"];
+ }
+ else {
+ text = "when under "+value["value"];
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as b/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as
new file mode 100755
index 0000000..afba26f
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/renderers/StockRenderer.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package renderers
+{
+ import org.apache.flex.html.supportClasses.StringItemRenderer;
+
+ public class StockRenderer extends StringItemRenderer
+ {
+ public function StockRenderer()
+ {
+ super();
+ }
+
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+
+ var n1:Number = Number(value[labelField]);
+ if (!isNaN(n1)) {
+ n1 = Math.round(n1*100)/100.0;
+
+ // something to keep in mind when using FlexJS for cross-platform
+ // use: make sure that public properties are used versus protected
+ // functions or properties. in most cases, internal vars and functions
+ // will be platform-specific whereas public properties and function
+ // should be cross-platform.
+ text = String(n1);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/views/AlertsView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/AlertsView.mxml b/examples/flexjs/MobileTrader/src/views/AlertsView.mxml
new file mode 100755
index 0000000..196f827
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/views/AlertsView.mxml
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<basic:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ title="Alerts"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:local="*"
+ className="AlertsView" xmlns:renderers="renderers.*">
+
+ <fx:Metadata>
+ [Event("next")]
+ </fx:Metadata>
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.core.IBeadModel;
+ import org.apache.flex.core.IBeadController;
+ import org.apache.flex.events.Event;
+ import controller.AlertsViewController;
+
+ public function set dataModel(value:IBeadModel):void
+ {
+ var cm:IBeadController = controller;
+ (cm as AlertsViewController).model = value;
+ }
+ public function get dataModel():IBeadModel
+ {
+ var cm:IBeadController = controller;
+ return (cm as AlertsViewController).model;
+ }
+
+ private function onAlertSet():void
+ {
+ dispatchEvent(new org.apache.flex.events.Event("alertSet"));
+ }
+ ]]>
+ </fx:Script>
+
+ <basic:Container x="4" y="10" >
+ <basic:beads>
+ <basic:HorizontalLayout />
+ </basic:beads>
+ <basic:Label text="Symbol:" />
+ <basic:TextInput id="symbolField" />
+ <basic:Label text="Value:" />
+ <basic:TextInput id="valueField" />
+ <basic:CheckBox text="Higher?" id="higherCheck" />
+ <basic:TextButton text="Set" click="onAlertSet()" />
+ </basic:Container>
+
+ <basic:DataGrid x="0" y="40" width="480" height="200">
+ <basic:beads>
+ <basic:SimpleBinding
+ eventName="alertsUpdate"
+ sourceID="dataModel"
+ sourcePropertyName="alerts"
+ destinationPropertyName="dataProvider" />
+ </basic:beads>
+ <basic:columns>
+ <basic:DataGridColumn label="Symbol" dataField="symbol">
+ <basic:itemRenderer>
+ <fx:Component>
+ <basic:StringItemRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:DataGridColumn>
+ <basic:DataGridColumn label="Alert" dataField="greaterThan">
+ <basic:itemRenderer>
+ <fx:Component>
+ <renderers:AlertRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:DataGridColumn>
+ <basic:DataGridColumn label="Message" dataField="message">
+ <basic:itemRenderer>
+ <fx:Component>
+ <basic:StringItemRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:DataGridColumn>
+ </basic:columns>
+ </basic:DataGrid>
+
+</basic:View>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/views/AssetsView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/AssetsView.mxml b/examples/flexjs/MobileTrader/src/views/AssetsView.mxml
new file mode 100755
index 0000000..edf3916
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/views/AssetsView.mxml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<basic:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ title="Assets"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:models="models.*"
+ xmlns:local="*"
+ className="AssetsView">
+ <fx:Script>
+ <![CDATA[
+
+ ]]>
+ </fx:Script>
+
+ <fx:Metadata>
+ [Event("next")]
+ </fx:Metadata>
+
+ <basic:beads>
+ <basic:BasicLayout />
+ </basic:beads>
+
+ <basic:model>
+ <models:AssetsModel />
+ </basic:model>
+
+ <basic:Container className="AssetsInner" width="480">
+ <basic:beads>
+ <basic:VerticalLayout />
+ </basic:beads>
+ <basic:style>
+ <basic:SimpleCSSStyles top="0" left="0" right="0" />
+ </basic:style>
+
+ <basic:Label text="Summary" />
+
+ <basic:DataGrid height="200" width="480">
+ <basic:style>
+ <basic:SimpleCSSStyles top="0" left="0" right="0" />
+ </basic:style>
+ <basic:beads>
+ <basic:ConstantBinding
+ sourceID="model"
+ sourcePropertyName="assetsData"
+ destinationPropertyName="dataProvider" />
+ </basic:beads>
+ <basic:columns>
+ <basic:DataGridColumn label="Type" dataField="label" />
+ <basic:DataGridColumn label="Value" dataField="value" />
+ <basic:DataGridColumn label="Change" dataField="netChange" />
+ </basic:columns>
+ </basic:DataGrid>
+
+ <basic:Label text="Performance History" />
+
+ <!--<basic:BarChart id="barChart" width="320" height="250">
+ <basic:beads>
+ <basic:ConstantBinding
+ sourceID="model"
+ sourcePropertyName="assetsData"
+ destinationPropertyName="dataProvider" />
+ <basic:XAxisBead labelField="title" />
+ </basic:beads>
+ <basic:series>
+ <basic:BarChartSeries yField="value"
+ fillColor="0xFF964D">
+ <basic:itemRenderer>
+ <fx:Component>
+ <basic:BoxItemRenderer />
+ </fx:Component>
+ </basic:itemRenderer>
+ </basic:BarChartSeries>
+ </basic:series>
+ </basic:BarChart>-->
+
+ </basic:Container>
+</basic:View>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d33fe63c/examples/flexjs/MobileTrader/src/views/SearchView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileTrader/src/views/SearchView.mxml b/examples/flexjs/MobileTrader/src/views/SearchView.mxml
new file mode 100755
index 0000000..6b834d7
--- /dev/null
+++ b/examples/flexjs/MobileTrader/src/views/SearchView.mxml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<basic:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:apache="org.apache.flex.html.beads.*"
+ xmlns:local="*"
+ className="StockView">
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.mobile.StackedViewManager;
+ private function onBackClick() : void
+ {
+ (viewManager as StackedViewManager).pop();
+ }
+ ]]>
+ </fx:Script>
+
+ <basic:Label text="Search View" x="20" y="100" />
+</basic:View>