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/feature/browser-event] - Fixing SimpleDataProviderChangeNotifier which was broken after recent changes to DataProviderChangeNotifier
Date Mon, 31 Jul 2017 08:07:38 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/feature/browser-event e32fc222c -> fd2ba63a2


Fixing SimpleDataProviderChangeNotifier which was broken after recent
changes to DataProviderChangeNotifier


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

Branch: refs/heads/feature/browser-event
Commit: fd2ba63a27aa7bc67ab0cd29094a9ed2c90ec6c2
Parents: e32fc22
Author: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
Authored: Mon Jul 31 11:06:16 2017 +0300
Committer: DESKTOP-RH4S838\Yishay <yishayjobs@hotmail.com>
Committed: Mon Jul 31 11:06:16 2017 +0300

----------------------------------------------------------------------
 .../html/beads/DataProviderChangeNotifier.as    | 26 ++++++++++++++------
 .../beads/SimpleDataProviderChangeNotifier.as   |  3 ++-
 2 files changed, 20 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd2ba63a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
index 22155cb..9b2315f 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
@@ -54,16 +54,10 @@ package org.apache.flex.html.beads
 			{
 				if(object[propertyName] == dataProvider)
 					return;
-                dataProvider.removeEventListener("itemAdded", handleDataProviderChanges);
-                dataProvider.removeEventListener("itemRemoved", handleDataProviderChanges);
-                dataProvider.removeEventListener("itemUpdated", handleDataProviderChanges);
-                dataProvider.removeEventListener("collectionChanged", handleDataProviderChanges);
+				detachEventListeners();
 			}
 			dataProvider = object[propertyName] as ArrayList;
-            dataProvider.addEventListener("itemAdded", handleDataProviderChanges);
-            dataProvider.addEventListener("itemRemoved", handleDataProviderChanges);
-            dataProvider.addEventListener("itemUpdated", handleDataProviderChanges);
-            dataProvider.addEventListener("collectionChanged", handleDataProviderChanges);
+			attachEventListeners();
 		}
 
 		private function handleDataProviderChanges(event:Event):void
@@ -71,5 +65,21 @@ package org.apache.flex.html.beads
             var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as
ISelectionModel;
             selectionModel.dispatchEvent(new Event("dataProviderChanged"));
 		}
+		
+		protected function attachEventListeners():void
+		{
+			dataProvider.addEventListener("itemAdded", handleDataProviderChanges);
+			dataProvider.addEventListener("itemRemoved", handleDataProviderChanges);
+			dataProvider.addEventListener("itemUpdated", handleDataProviderChanges);
+			dataProvider.addEventListener("collectionChanged", handleDataProviderChanges);
+		}
+		
+		protected function detachEventListeners():void
+		{
+			dataProvider.removeEventListener("itemAdded", handleDataProviderChanges);
+			dataProvider.removeEventListener("itemRemoved", handleDataProviderChanges);
+			dataProvider.removeEventListener("itemUpdated", handleDataProviderChanges);
+			dataProvider.removeEventListener("collectionChanged", handleDataProviderChanges);
+		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd2ba63a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleDataProviderChangeNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleDataProviderChangeNotifier.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleDataProviderChangeNotifier.as
index 718f6bb..1d55c76 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleDataProviderChangeNotifier.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/SimpleDataProviderChangeNotifier.as
@@ -64,7 +64,8 @@ package org.apache.flex.html.beads
 					selectionModel.addEventListener("dataProviderChanged", setFirstDataProvider);
 			} else
 			{
-				super.destinationChangedHandler(event);
+				detachEventListeners();
+				attachEventListeners();
 			}
 		}
 		


Mime
View raw message