flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Use composition instead of inheritance to allow compound bead to use different sub beads
Date Tue, 11 Jul 2017 05:12:51 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 54d00a044 -> e93c11d7c


Use composition instead of inheritance to allow compound bead to use different
sub beads


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

Branch: refs/heads/develop
Commit: e93c11d7c000f41e24e489386ba11db99b9157f6
Parents: 54d00a0
Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
Authored: Tue Jul 11 08:11:43 2017 +0300
Committer: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
Committed: Tue Jul 11 08:11:43 2017 +0300

----------------------------------------------------------------------
 .../flex/file/beads/FileLoaderAndUploader.as    | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e93c11d7/frameworks/projects/Network/src/main/flex/org/apache/flex/file/beads/FileLoaderAndUploader.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/file/beads/FileLoaderAndUploader.as
b/frameworks/projects/Network/src/main/flex/org/apache/flex/file/beads/FileLoaderAndUploader.as
index 2b66552..6f29f5b 100644
--- a/frameworks/projects/Network/src/main/flex/org/apache/flex/file/beads/FileLoaderAndUploader.as
+++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/file/beads/FileLoaderAndUploader.as
@@ -17,8 +17,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.file.beads
 {
+	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.events.Event;
+	import org.apache.flex.file.FileProxy;
 
 	/**
 	 *  The FileLoaderAndUploader is a compound bead that allows you
@@ -31,10 +33,12 @@ package org.apache.flex.file.beads
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.9
 	 */
-	public class FileLoaderAndUploader extends FileUploader
+	public class FileLoaderAndUploader implements IBead
 	{
 		private var _loader:FileLoader;
+		private var _uploader:FileUploader;
 		private var _url:String;
+		private var _strand:IStrand;
 		public function FileLoaderAndUploader()
 		{
 			super();
@@ -48,15 +52,16 @@ package org.apache.flex.file.beads
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.9
 		 */
-		override public function set strand(value:IStrand):void
+		public function set strand(value:IStrand):void
 		{
-			super.strand = value;
+			_strand = value;
 			_loader = value.getBeadByType(FileLoader) as FileLoader;
 			if (!_loader)
 			{
 				_loader = new FileLoader();
 				value.addBead(_loader);
 			}
+			_uploader = value.getBeadByType(FileUploader) as FileUploader;
 		}
 		
 		/**
@@ -68,17 +73,17 @@ package org.apache.flex.file.beads
 		 *  @productversion FlexJS 0.9
 		 */
 		
-		override public function upload(url:String):void
+		public function upload(url:String):void
 		{
-			var fileModel:FileModel = host.model as FileModel;
+			var fileModel:FileModel = (_strand as FileProxy).model as FileModel;
 			if (!fileModel.blob)
 			{
 				_url = url;
-				host.model.addEventListener("blobChanged", blobChangedHandler);
+				(_strand as FileProxy).model.addEventListener("blobChanged", blobChangedHandler);
 				_loader.load();
 			} else
 			{
-				super.upload(url);
+				_uploader.upload(url);
 			}
 		}
 		
@@ -87,8 +92,8 @@ package org.apache.flex.file.beads
 		 */
 		private function blobChangedHandler(e:Event):void
 		{
-			host.model.removeEventListener('blobChanged', blobChangedHandler);
-			super.upload(_url);
+			(_strand as FileProxy).model.removeEventListener('blobChanged', blobChangedHandler);
+			_uploader.upload(_url);
 		}
 		
 	}


Mime
View raw message