Repository: flex-asjs Updated Branches: refs/heads/develop ed2503e4e -> e59094db8
Fixed URL to financial data source. Replaced local change notifier to standard data provider change notifier. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/e59094db Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/e59094db Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/e59094db Branch: refs/heads/develop Commit: e59094db8b63de57e6bbc65f3793579f7a721a7a Parents: ed2503e Author: Peter Ent <[email protected]> Authored: Mon May 1 15:39:56 2017 -0400 Committer: Peter Ent <[email protected]> Committed: Mon May 1 15:39:56 2017 -0400 ---------------------------------------------------------------------- .../flex/controller/DataModelChangeNotifier.as | 71 -------------------- .../src/main/flex/models/ProductsModel.as | 4 +- .../src/main/flex/views/AlertsView.mxml | 6 +- .../src/main/flex/views/WatchListView.mxml | 6 +- 4 files changed, 12 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e59094db/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 deleted file mode 100644 index a6e2e19..0000000 --- a/examples/flexjs/MobileTrader/src/main/flex/controller/DataModelChangeNotifier.as +++ /dev/null @@ -1,71 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package controller -{ - import 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/e59094db/examples/flexjs/MobileTrader/src/main/flex/models/ProductsModel.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/main/flex/models/ProductsModel.as b/examples/flexjs/MobileTrader/src/main/flex/models/ProductsModel.as index f4b2008..ccc238d 100755 --- a/examples/flexjs/MobileTrader/src/main/flex/models/ProductsModel.as +++ b/examples/flexjs/MobileTrader/src/main/flex/models/ProductsModel.as @@ -44,8 +44,8 @@ package models 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 queryBegin:String = "https://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=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&format=json"; private var _strand:IStrand; public function set strand(value:IStrand):void http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e59094db/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 fbb96e0..4a55de6 100755 --- a/examples/flexjs/MobileTrader/src/main/flex/views/AlertsView.mxml +++ b/examples/flexjs/MobileTrader/src/main/flex/views/AlertsView.mxml @@ -73,12 +73,16 @@ limitations under the License. <js:DataGrid id="dataGrid" x="0" y="40" width="100%" className="AlertsDataGrid"> <js:beads> <js:DataGridPercentageView /> - <controller:DataModelChangeNotifier /> <js:SimpleBinding eventName="alertsUpdate" sourceID="dataModel" sourcePropertyName="alerts" destinationPropertyName="dataProvider" /> + <js:DataProviderCollectionChangeNotifier + destinationPropertyName="dataProvider" + sourceID="dataModel" + propertyName="alerts" + changeEventName="itemUpdated" /> </js:beads> <js:columns> <js:DataGridColumn label="Symbol" dataField="symbol" columnWidth="50"> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e59094db/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 f08da21..6d5b004 100755 --- a/examples/flexjs/MobileTrader/src/main/flex/views/WatchListView.mxml +++ b/examples/flexjs/MobileTrader/src/main/flex/views/WatchListView.mxml @@ -105,13 +105,17 @@ limitations under the License. <js:DataGrid id="dataGrid" width="100%" change="selectRow()" className="WatchListDataGrid"> <js:beads> - <controller:DataModelChangeNotifier /> <js:DataGridPercentageView /> <js:SimpleBinding eventName="update" sourceID="dataModel" sourcePropertyName="watchList" destinationPropertyName="dataProvider" /> + <js:DataProviderCollectionChangeNotifier + destinationPropertyName="dataProvider" + sourceID="dataModel" + propertyName="watchList" + changeEventName="itemUpdated" /> </js:beads> <js:columns> <js:DataGridColumn label="Symbol" dataField="symbol" columnWidth="20">
