You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2016/11/08 22:12:03 UTC

[3/3] git commit: [flex-asjs] [refs/heads/feature-autobuild/example-maven-dirs] - Merge branch 'develop' into feature-autobuild/example-maven-dirs

Merge branch 'develop' into feature-autobuild/example-maven-dirs


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/138a7b52
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/138a7b52
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/138a7b52

Branch: refs/heads/feature-autobuild/example-maven-dirs
Commit: 138a7b52b23a481d67b9abfacd102abf7e8dfec6
Parents: 9321215 0423210
Author: Carlos Rovira <ca...@apache.org>
Authored: Tue Nov 8 23:09:33 2016 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Tue Nov 8 23:09:33 2016 +0100

----------------------------------------------------------------------
 .../TeamPage/src/main/flex/models/MemberList.as | 24 +++++++++++++++++---
 .../flex/org/apache/flex/core/Application.as    |  2 --
 2 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/138a7b52/examples/flexjs/TeamPage/src/main/flex/models/MemberList.as
----------------------------------------------------------------------
diff --cc examples/flexjs/TeamPage/src/main/flex/models/MemberList.as
index 1b5c3e7,0000000..69d2220
mode 100644,000000..100644
--- a/examples/flexjs/TeamPage/src/main/flex/models/MemberList.as
+++ b/examples/flexjs/TeamPage/src/main/flex/models/MemberList.as
@@@ -1,82 -1,0 +1,100 @@@
 +////////////////////////////////////////////////////////////////////////////////
 +//
 +//  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.collections.LazyCollection;
 +	import org.apache.flex.core.Application;
 +	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.events.IEventDispatcher;
 +	import org.apache.flex.net.HTTPService;
 +
 +	[Event(name="membersChanged", type="org.apache.flex.events.Event")]
 +	public class MemberList extends EventDispatcher implements IBeadModel
 +	{
 +		public function MemberList(target:IEventDispatcher=null)
 +		{
 +			super(target);
 +		}
 +
- 		public var members:Array = null;
++		private var _members:Array = null;
++		public function get members():Array
++		{
++			return _members;
++		}
++		public function set members(value:Array):void
++		{
++			_members = value;
++		}
 +
 +		private var app:Application;
 +		private var service:HTTPService;
 +		private var collection:LazyCollection;
 +
 +		private var _strand:IStrand;
 +		public function set strand(value:IStrand):void
 +		{
 +			_strand = value;
 +
 +			app = value as Application;
 +			if (app) {
 +				app.addEventListener("viewChanged", viewChangeHandler);
 +			}
 +		}
 +
 +		private function viewChangeHandler(event:Event):void
 +		{
 +			service = app["service"] as HTTPService;
 +			collection = app["collection"] as LazyCollection;
 +
 +			loadMembers();
 +		}
 +
 +		public function loadMembers():void
 +		{
 +			service.url = "team.json";
 +			service.send();
++			service.addEventListener("httpStatus", handleStatusReturn);
 +			service.addEventListener("complete", handleLoadComplete);
++			service.addEventListener("ioError", handleError);
++		}
++
++		public function handleStatusReturn(event:org.apache.flex.events.Event):void
++		{
++			// tbd: should handle a bad status here
 +		}
 +
 +		public function handleLoadComplete(event:org.apache.flex.events.Event):void
 +		{
 +			members = [];
- 			trace("We got something back");
- 			trace("Collection: "+collection.length+" items");
 +			for (var i:int=0; i < collection.length; i++) {
 +				var item:Object = collection.getItemAt(i);
 +				members.push(item);
 +			}
 +			dispatchEvent( new Event("membersChanged") );
 +		}
++
++		public function handleError(event:org.apache.flex.events.Event):void
++		{
++			// tbd: should handle error here
++		}
 +	}
 +}