flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Fixed rollOver issues with List and DataGrid; now works consistently between Flash, js-debug, and js-release.
Date Wed, 06 Jan 2016 16:03:23 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 557f16ee7 -> 064b72116


Fixed rollOver issues with List and DataGrid; now works consistently between Flash, js-debug,
and js-release.


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

Branch: refs/heads/develop
Commit: 064b72116b958468793968526ff87b9372ad77fd
Parents: 557f16e
Author: Peter Ent <pent@apache.org>
Authored: Wed Jan 6 11:03:17 2016 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Wed Jan 6 11:03:17 2016 -0500

----------------------------------------------------------------------
 .../org/apache/flex/html/beads/DataGridView.as  | 33 ----------
 .../controllers/ItemRendererMouseController.as  | 13 +++-
 .../flex/html/supportClasses/DataGroup.as       | 66 ++++++++++++++++++++
 3 files changed, 76 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/064b7211/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as
index d1fbe61..74618b3 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/DataGridView.as
@@ -250,37 +250,6 @@ package org.apache.flex.html.beads
 		/**
 		 * @private
 		 */
-		private function handleColumnListRollOver(event:Event):void
-		{
-			var itemRenderer:ISelectableItemRenderer = event.target as ISelectableItemRenderer;
-			var list:List = event.currentTarget as List;
-			if (list == null) return;
-			for(var i:int=0; i < _lists.length; i++) {
-				if (list != _lists[i]) {
-					var otherList:List = _lists[i] as List;
-					otherList.rollOverIndex = itemRenderer.index;
-				}
-			}
-
-			IEventDispatcher(_strand).dispatchEvent(new Event('rollOver'));
-		}
-
-		/**
-		 * @private
-		 */
-		private function handleColumnListRollOut(event:Event):void
-		{
-			for(var i:int=0; i < _lists.length; i++) {
-				var otherList:List = _lists[i] as List;
-				otherList.rollOverIndex = -1;
-			}
-
-			IEventDispatcher(_strand).dispatchEvent(new Event('rollOver'));
-		}
-
-		/**
-		 * @private
-		 */
 		private function createLists():void
 		{
 			var sharedModel:IDataGridModel = _strand.getBeadByType(IBeadModel) as IDataGridModel;
@@ -299,8 +268,6 @@ package org.apache.flex.html.beads
 				list.itemRenderer = dataGridColumn.itemRenderer;
 				list.labelField = dataGridColumn.dataField;
 				list.addEventListener('change',handleColumnListChange);
-				list.addEventListener('rollover',handleColumnListRollOver);
-				list.addEventListener('rollout',handleColumnListRollOut);
 				list.addBead(presentationModel);
 
 				var colWidth:Number = dataGridColumn.columnWidth;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/064b7211/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
index 5e07458..6fcb681 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
@@ -101,7 +101,7 @@ COMPILE::JS {
 			if (target)
 			{
                 target.hovered = true;
-				target.dispatchEvent(new Event("rollover",true));
+				target.dispatchEvent(new Event("itemRendererRollOver",true));
 			}
 		}
 		
@@ -111,7 +111,7 @@ COMPILE::JS {
 			var target:ISelectableItemRenderer = event.target as ISelectableItemRenderer;
 			if (target) {
 				target.hovered = true;
-				target.dispatchEvent(new Event("rollover",true));
+				target.dispatchEvent(new Event("itemRendererRollOver",true));
 			}
 		}
 		
@@ -126,7 +126,7 @@ COMPILE::JS {
 			{
                 target.hovered = false;
                 target.down = false;
-				target.dispatchEvent(new Event("rollout",true));
+				target.dispatchEvent(new Event("itemRendererRollout",true));
 			}
 		}
 		
@@ -138,6 +138,7 @@ COMPILE::JS {
 			{
 				target.hovered = false;
 				target.down = false;
+				target.dispatchEvent(new Event("itemRendererRollout",true));
 			}
 		}
 
@@ -155,6 +156,9 @@ COMPILE::JS {
 			}
 		}
 		
+		/**
+		 * @private
+		 */
 		COMPILE::JS
 		protected function handleMouseDown(event:BrowserEvent):void
 		{
@@ -181,6 +185,9 @@ COMPILE::JS {
 			}			
 		}
 		
+		/**
+		 * @private
+		 */
 		COMPILE::JS
 		protected function handleMouseUp(event:BrowserEvent):void
 		{

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/064b7211/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataGroup.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataGroup.as
index f589695..c156a6f 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataGroup.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/supportClasses/DataGroup.as
@@ -21,7 +21,11 @@ package org.apache.flex.html.supportClasses
     import org.apache.flex.core.IContentView;
     import org.apache.flex.core.IItemRenderer;
     import org.apache.flex.core.IItemRendererParent;
+	import org.apache.flex.core.IRollOverModel;
+	import org.apache.flex.core.IStrand;
     import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.events.Event;
 
     /**
      *  The DataGroup class is the IItemRendererParent used internally
@@ -46,6 +50,68 @@ package org.apache.flex.html.supportClasses
 		{
 			super();
 		}
+		
+		/**
+		 * @private
+		 */
+		override public function addElement(c:Object, dispatchEvent:Boolean = true):void
+		{
+			super.addElement(c, dispatchEvent);
+			
+			var dispatcher:IEventDispatcher = c as IEventDispatcher;
+			dispatcher.addEventListener("itemRendererRollOver", handleRollOver);
+			dispatcher.addEventListener("itemRendererRollOut", handleRollOut);
+		}
+		
+		/**
+		 * @private
+		 */
+		override public function removeElement(c:Object, dispatchEvent:Boolean = true):void
+		{
+			var dispatcher:IEventDispatcher = c as IEventDispatcher;
+			dispatcher.removeEventListener("itemRendererRollOver", handleRollOver);
+			dispatcher.removeEventListener("itemRendererRollOut", handleRollOut);
+			
+			super.removeElement(c, dispatchEvent);
+		}
+		
+		/**
+		 * @private
+		 */
+		private function handleRollOver(event:Event):void
+		{
+			var strand:IStrand = parent as IStrand;
+			var rollModel:IRollOverModel = strand.getBeadByType(IRollOverModel) as IRollOverModel;
+			if (rollModel) {
+				var n:int = numElements;
+				for (var i:int=0; i < n; i++) {
+					var renderer:Object = getElementAt(i);
+					if (renderer == event.currentTarget) {
+						rollModel.rollOverIndex = i;
+						break;
+					}
+				}
+			}
+		}
+		
+		/**
+		 * @private
+		 */
+		private function handleRollOut(event:Event):void
+		{
+			var strand:IStrand = parent as IStrand;
+			var rollModel:IRollOverModel = strand.getBeadByType(IRollOverModel) as IRollOverModel;
+			if (rollModel) {
+				var n:int = numElements;
+				for (var i:int=0; i < n; i++) {
+					var renderer:Object = getElementAt(i);
+					if (renderer == event.currentTarget) {
+						rollModel.rollOverIndex = -1;
+						break;
+					}
+				}
+			}
+		}
 
         /**
          *  @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()


Mime
View raw message