You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by mi...@apache.org on 2017/08/16 09:52:19 UTC

[3/3] git commit: [flex-sdk] [refs/heads/develop] - FLEX-18746 CAUSE: HierarchicalCollectionView.updateLength() was ignoring nodes without children, as it should. However, the function it called for the nodes with children, getChildren() unfortunately ha

FLEX-18746 CAUSE: HierarchicalCollectionView.updateLength() was ignoring nodes without children, as it should. However, the function it called for the nodes with children, getChildren() unfortunately had a necessary side-effect (which is a poor design choice, to be sure), which was to add an event listener to the children collection. So the empty collections of nodes were not listened to, which meant that once the node was open any children that were added to that node were not counted towards the length of the collection. And one way this inconsistency surfaced was through the expandItem() fatal.

SOLUTION: The best - and most time-consuming - solution to this is to find a way to extract the side-effect of getChildren() into a separate function and call it when needed. However, for the moment I have opted to simply allow getChildren() to be called even for empty nodes, which in turn adds the event listeners.

NOTES: all unit tests now pass.


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

Branch: refs/heads/develop
Commit: fcc25865f43a7f0760da5a5b1849a932349797d8
Parents: 5fb2fb6
Author: Mihai Chira <mi...@apache.org>
Authored: Wed Aug 16 11:51:05 2017 +0200
Committer: Mihai Chira <mi...@apache.org>
Committed: Wed Aug 16 11:51:05 2017 +0200

----------------------------------------------------------------------
 frameworks/projects/mx/src/mx/controls/Tree.as                | 2 +-
 .../src/mx/controls/treeClasses/HierarchicalCollectionView.as | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/fcc25865/frameworks/projects/mx/src/mx/controls/Tree.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/Tree.as b/frameworks/projects/mx/src/mx/controls/Tree.as
index 5f9215a..5bf874f 100644
--- a/frameworks/projects/mx/src/mx/controls/Tree.as
+++ b/frameworks/projects/mx/src/mx/controls/Tree.as
@@ -1783,7 +1783,7 @@ public class Tree extends List implements IIMESupport
             // is the item on screen?
             if (visibleData[uid])
             {
-                //find the rowindex of the row after the open thats opening/closing
+                //find the row index of the first row after the one that's opening/closing
                 var n:int = listItems.length;
                 for (rowIndex = 0; rowIndex < n; rowIndex++)
                 {

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/fcc25865/frameworks/projects/mx/src/mx/controls/treeClasses/HierarchicalCollectionView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/controls/treeClasses/HierarchicalCollectionView.as b/frameworks/projects/mx/src/mx/controls/treeClasses/HierarchicalCollectionView.as
index 5f357b0..59fe7e8 100644
--- a/frameworks/projects/mx/src/mx/controls/treeClasses/HierarchicalCollectionView.as
+++ b/frameworks/projects/mx/src/mx/controls/treeClasses/HierarchicalCollectionView.as
@@ -267,7 +267,7 @@ public class HierarchicalCollectionView extends EventDispatcher
 			var modelCursor:IViewCursor = treeData.createCursor();
 			if (modelCursor.beforeFirst)
 			{
-				// indicates that an IPE occured on the first item
+				// indicates that an IPE occurred on the first item
 				return treeData.length;
 			}
 			while (!modelCursor.afterLast)
@@ -315,8 +315,7 @@ public class HierarchicalCollectionView extends EventDispatcher
 			parentMap[uid] = parent;
 			if (node != null &&
 				openNodes[uid] &&
-				dataDescriptor.isBranch(node, treeData) &&
-				dataDescriptor.hasChildren(node, treeData))
+				dataDescriptor.isBranch(node, treeData))
 			{
 				childNodes = getChildren(node);
 				if (childNodes != null)
@@ -432,7 +431,7 @@ public class HierarchicalCollectionView extends EventDispatcher
     
     /**
 	 * @private
-	 * delegate getchildren in order to add event listeners for nested collections
+	 * delegate getChildren in order to add event listeners for nested collections
 	 */
 	private function getChildren(node:Object):ICollectionView
 	{