Repository: flex-asjs Updated Branches: refs/heads/develop 7d53480c5 -> 1ccd1f8bd
Fixed MobileTrader example for js-release version by creating real objects for the Assets chart. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/1ccd1f8b Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/1ccd1f8b Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/1ccd1f8b Branch: refs/heads/develop Commit: 1ccd1f8bd9f5ef92b1c8cd583592ab69d6c2567c Parents: 7d53480 Author: Peter Ent <[email protected]> Authored: Fri Jan 8 10:17:14 2016 -0500 Committer: Peter Ent <[email protected]> Committed: Fri Jan 8 10:17:14 2016 -0500 ---------------------------------------------------------------------- .../flexjs/MobileTrader/src/models/Asset.as | 77 ++++++++++++++++++++ .../MobileTrader/src/models/AssetsModel.as | 18 ++--- 2 files changed, 86 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1ccd1f8b/examples/flexjs/MobileTrader/src/models/Asset.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MobileTrader/src/models/Asset.as b/examples/flexjs/MobileTrader/src/models/Asset.as new file mode 100644 index 0000000..869ba72 --- /dev/null +++ b/examples/flexjs/MobileTrader/src/models/Asset.as @@ -0,0 +1,77 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 Asset extends EventDispatcher + { + private var _label:String; + private var _value:Number; + private var _netChange:Number; + + public function Asset(newLabel:String, newValue:Number, newNetChange:Number) + { + _label = newLabel; + _value = newValue; + _netChange = newNetChange; + } + + [Bindable("labelChanged")] + public function get label():String + { + return _label; + } + public function set label(value:String):void + { + if (value != _label) { + _label = value; + dispatchEvent(new Event("labelChanged")); + } + } + + [Bindable("valueChanged")] + public function get value():Number + { + return _value; + } + public function set value(newValue:Number):void + { + if (_value != newValue) { + _value = newValue; + dispatchEvent(new Event("valueChanged")); + } + } + + [Bindable("netChangeChanged")] + public function get netChange():Number + { + return _netChange; + } + public function set netChange(value:Number):void + { + if (_netChange != value) { + _netChange = value; + dispatchEvent(new Event("netChangeChanged")); + } + } + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1ccd1f8b/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 index 674adfe..3d72137 100755 --- a/examples/flexjs/MobileTrader/src/models/AssetsModel.as +++ b/examples/flexjs/MobileTrader/src/models/AssetsModel.as @@ -22,7 +22,7 @@ package models import org.apache.flex.core.IStrand; import org.apache.flex.events.EventDispatcher; import org.apache.flex.collections.ArrayList; - + public class AssetsModel extends EventDispatcher implements IBeadModel { public function AssetsModel() @@ -32,26 +32,26 @@ package models _assetsData.source = source; } private var source: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} + new Asset("NetWorth:", 161984, 2.36), + new Asset("Last Month:", 165915, 10.98), + new Asset("6 Months Ago:", 145962, 16.56), + new Asset("Last Year:", 138972, 8.36) ]; private var _assetsData:ArrayList; - + public function get assetsData():ArrayList { return _assetsData; } - + public function get assetsDataAsArray():Array { return source; } - + public function set strand(value:IStrand):void { // not used } } -} \ No newline at end of file +}
