MobileTrader nearly back to full function.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/159abcc9 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/159abcc9 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/159abcc9 Branch: refs/heads/develop Commit: 159abcc9cc728108863be1bc07d3175711a4fd00 Parents: a005b67 Author: Peter Ent <p...@apache.org> Authored: Sat Apr 15 08:32:58 2017 -0400 Committer: Peter Ent <p...@apache.org> Committed: Sat Apr 15 08:32:58 2017 -0400 ---------------------------------------------------------------------- examples/flexjs/MobileTrader/build.xml | 17 ++++- .../src/main/flex/MobileTrader.mxml | 3 + .../src/main/flex/MyInitialView.mxml | 8 ++- .../flex/controller/DataModelChangeNotifier.as | 71 ++++++++++++++++++++ .../src/main/flex/views/AlertsView.mxml | 2 +- .../src/main/flex/views/WatchListView.mxml | 2 +- 6 files changed, 99 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/159abcc9/examples/flexjs/MobileTrader/build.xml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/build.xml b/examples/flexjs/MobileTrader/build.xml index cb69a25..81fd570 100644 --- a/examples/flexjs/MobileTrader/build.xml +++ b/examples/flexjs/MobileTrader/build.xml @@ -48,7 +48,22 @@ </condition> <property name="extlib_arg" value="-external-library-path=${FALCONJX_HOME}/../externs/js/out/bin/js.swc"/> - <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}"> + <target name="main" depends="clean,build_example.compile,build_example.compilejs,copyassets" description="Clean build of ${example}"> + </target> + + <target name="copyassets"> + <mkdir dir="${basedir}/bin/js-debug/assets" /> + <copy todir="${basedir}/bin/js-debug/assets" > + <fileset dir="${basedir}/src/main/resources/assets"> + <include name="**" /> + </fileset> + </copy> + <mkdir dir="${basedir}/bin/js-release/assets" /> + <copy todir="${basedir}/bin/js-release/assets" > + <fileset dir="${basedir}/src/main/resources/assets"> + <include name="**" /> + </fileset> + </copy> </target> <target name="clean"> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/159abcc9/examples/flexjs/MobileTrader/src/main/flex/MobileTrader.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/main/flex/MobileTrader.mxml b/examples/flexjs/MobileTrader/src/main/flex/MobileTrader.mxml index c76531c..47acaeb 100755 --- a/examples/flexjs/MobileTrader/src/main/flex/MobileTrader.mxml +++ b/examples/flexjs/MobileTrader/src/main/flex/MobileTrader.mxml @@ -24,6 +24,9 @@ xmlns:js="library://ns.apache.org/flexjs/basic" xmlns:controller="controller.*" > + <js:beads> + <js:DeviceSizeBead /> + </js:beads> <js:valuesImpl> <js:SimpleCSSValuesImpl /> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/159abcc9/examples/flexjs/MobileTrader/src/main/flex/MyInitialView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/main/flex/MyInitialView.mxml b/examples/flexjs/MobileTrader/src/main/flex/MyInitialView.mxml index 70aea67..2357600 100755 --- a/examples/flexjs/MobileTrader/src/main/flex/MyInitialView.mxml +++ b/examples/flexjs/MobileTrader/src/main/flex/MyInitialView.mxml @@ -38,6 +38,11 @@ limitations under the License. background-color: #FFFFFF; } + .StringItemRenderer { + padding-left: 4px; + padding-top: 2px; + } + .NavigationBar { background-image: url("assets/background.png"); height: 55px; @@ -225,6 +230,7 @@ limitations under the License. private function onInitComplete():void { + } private function onAssetsNext():void @@ -260,7 +266,7 @@ limitations under the License. <js:ViewDataBinding /> </js:beads> - <js:TabbedViewManager id="navController" width="700" height="500" x="0" y="0" viewChanged="tabbedViewChanged(event)"> + <js:TabbedViewManager id="navController" width="100%" height="100%" x="0" y="0" viewChanged="tabbedViewChanged(event)"> <js:navigationBarItems> <js:TextButton id="backButton" width="45" height="45" className="BackButton" visible="false" click="goBack(event)"> <js:beads> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/159abcc9/examples/flexjs/MobileTrader/src/main/flex/controller/DataModelChangeNotifier.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/main/flex/controller/DataModelChangeNotifier.as b/examples/flexjs/MobileTrader/src/main/flex/controller/DataModelChangeNotifier.as new file mode 100644 index 0000000..a6e2e19 --- /dev/null +++ b/examples/flexjs/MobileTrader/src/main/flex/controller/DataModelChangeNotifier.as @@ -0,0 +1,71 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 org.apache.flex.core.IBead; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.events.CollectionEvent; + + public class DataModelChangeNotifier extends EventDispatcher implements IBead + { + public function DataModelChangeNotifier() + { + super(); + } + + private var _strand:IStrand; + private var _propertyName:String = "dataProvider"; + + public function get propertyName():String + { + return _propertyName; + } + public function set propertyName(value:String):void + { + _propertyName = value; + } + + public function set strand(value:IStrand):void + { + _strand = value; + + IEventDispatcher(_strand).addEventListener("initBindings", handleInitBindings); + } + + private function handleInitBindings(event:Event):void + { + var model:Object = _strand.getBeadByType(IBeadModel) as Object; + var property:IEventDispatcher = model[propertyName] as IEventDispatcher; + + property.addEventListener(CollectionEvent.ITEM_ADDED, handleModelChanges); + property.addEventListener(CollectionEvent.ITEM_REMOVED, handleModelChanges); + property.addEventListener(CollectionEvent.ITEM_UPDATED, handleModelChanges); + } + + private function handleModelChanges(event:CollectionEvent):void + { + var model:IEventDispatcher = _strand.getBeadByType(IBeadModel) as IEventDispatcher; + model.dispatchEvent(new Event("dataProviderChanged")); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/159abcc9/examples/flexjs/MobileTrader/src/main/flex/views/AlertsView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/main/flex/views/AlertsView.mxml b/examples/flexjs/MobileTrader/src/main/flex/views/AlertsView.mxml index 71ddff6..fbb96e0 100755 --- a/examples/flexjs/MobileTrader/src/main/flex/views/AlertsView.mxml +++ b/examples/flexjs/MobileTrader/src/main/flex/views/AlertsView.mxml @@ -73,7 +73,7 @@ limitations under the License. <js:DataGrid id="dataGrid" x="0" y="40" width="100%" className="AlertsDataGrid"> <js:beads> <js:DataGridPercentageView /> - <!--<controller:DataModelChangeNotifier />--> + <controller:DataModelChangeNotifier /> <js:SimpleBinding eventName="alertsUpdate" sourceID="dataModel" http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/159abcc9/examples/flexjs/MobileTrader/src/main/flex/views/WatchListView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/main/flex/views/WatchListView.mxml b/examples/flexjs/MobileTrader/src/main/flex/views/WatchListView.mxml index 3b84f34..f08da21 100755 --- a/examples/flexjs/MobileTrader/src/main/flex/views/WatchListView.mxml +++ b/examples/flexjs/MobileTrader/src/main/flex/views/WatchListView.mxml @@ -105,7 +105,7 @@ limitations under the License. <js:DataGrid id="dataGrid" width="100%" change="selectRow()" className="WatchListDataGrid"> <js:beads> - <!--<controller:DataModelChangeNotifier />--> + <controller:DataModelChangeNotifier /> <js:DataGridPercentageView /> <js:SimpleBinding eventName="update"