FLEX-34119 FLEX-34440 Renaming variables to make code more readable.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/3ce553b3 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/3ce553b3 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/3ce553b3 Branch: refs/heads/FLEX-34119 Commit: 3ce553b3db3b0d2e95f55b367317f91e99869e8f Parents: 7b55b01 Author: Mihai Chira <mih...@apache.org> Authored: Mon Jul 28 12:19:13 2014 +0100 Committer: Mihai Chira <mih...@apache.org> Committed: Mon Jul 28 12:19:13 2014 +0100 ---------------------------------------------------------------------- .../collections/HierarchicalCollectionView.as | 54 ++++++++++---------- .../HierarchicalCollectionViewCursor.as | 20 ++++---- 2 files changed, 38 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/3ce553b3/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as index f5dee09..6b41c62 100644 --- a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as +++ b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionView.as @@ -1542,8 +1542,8 @@ public class HierarchicalCollectionView extends EventDispatcher var n:int; var location:int; var uid:String; - var parent:Object; - var node:Object; + var parentOfChangingNode:Object; + var changingNode:Object; var items:Array; var convertedEvent:CollectionEvent; @@ -1570,14 +1570,14 @@ public class HierarchicalCollectionView extends EventDispatcher ce.kind); for (i = 0; i < n; i++) { - node = ce.items[i]; - if (node is XML) - startTrackUpdates(node); - parent = getParentItem(node); - if (parent != null) - getVisibleNodes(node, parent, convertedEvent.items); + changingNode = ce.items[i]; + if (changingNode is XML) + startTrackUpdates(changingNode); + parentOfChangingNode = getParentItem(changingNode); + if (parentOfChangingNode != null) + getVisibleNodes(changingNode, parentOfChangingNode, convertedEvent.items); } - convertedEvent.location = getVisibleLocationInSubCollection(parent, ce.location); + convertedEvent.location = getVisibleLocationInSubCollection(parentOfChangingNode, ce.location); dispatchEvent(convertedEvent); } else if (ce.kind == CollectionEventKind.REMOVE) @@ -1590,14 +1590,14 @@ public class HierarchicalCollectionView extends EventDispatcher ce.kind); for (i = 0; i < n; i++) { - node = ce.items[i]; - if (node is XML) - stopTrackUpdates(node); - parent = getParentItem(node); - if (parent != null) - getVisibleNodes(node, parent, convertedEvent.items); + changingNode = ce.items[i]; + if (changingNode is XML) + stopTrackUpdates(changingNode); + parentOfChangingNode = getParentItem(changingNode); + if (parentOfChangingNode != null) + getVisibleNodes(changingNode, parentOfChangingNode, convertedEvent.items); } - convertedEvent.location = getVisibleLocationInSubCollection(parent, ce.location); + convertedEvent.location = getVisibleLocationInSubCollection(parentOfChangingNode, ce.location); currentLength -= convertedEvent.items.length; dispatchEvent(convertedEvent); } @@ -1622,22 +1622,22 @@ public class HierarchicalCollectionView extends EventDispatcher for (i = 0; i < n; i++) { - node = ce.items[i].oldValue; - parent = getParentItem(node); + changingNode = ce.items[i].oldValue; + parentOfChangingNode = getParentItem(changingNode); - if (parent != null) + if (parentOfChangingNode != null) { - getVisibleNodes(node, parent, convertedEvent.items); + getVisibleNodes(changingNode, parentOfChangingNode, convertedEvent.items); // update the parent of the new item only // if the parent node is opened - if (_openNodes[UIDUtil.getUID(parent)] != null) + if (_openNodes[UIDUtil.getUID(parentOfChangingNode)] != null) { var newNode:Object = ce.items[i].newValue; uid = UIDUtil.getUID(newNode); - parentMap[uid] = parent; + parentMap[uid] = parentOfChangingNode; // delete the parent map for the old node - delete parentMap[UIDUtil.getUID(node)]; + delete parentMap[UIDUtil.getUID(changingNode)]; } } } @@ -1646,10 +1646,10 @@ public class HierarchicalCollectionView extends EventDispatcher var j:int = 0; for (i = 0; i < n; i++) { - node = ce.items[i].oldValue; - if (node is XML) - stopTrackUpdates(node); - while (convertedEvent.items[j] != node) + changingNode = ce.items[i].oldValue; + if (changingNode is XML) + stopTrackUpdates(changingNode); + while (convertedEvent.items[j] != changingNode) j++; convertedEvent.items.splice(j, 1); } http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/3ce553b3/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as index 1452676..df6ee81 100644 --- a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as +++ b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as @@ -1148,8 +1148,9 @@ public class HierarchicalCollectionViewCursor extends EventDispatcher var parentStack:Array = getParentStack(current); var isBefore:Boolean = false; var parentOfChangingNodeIndex:int; - var selectedAndChangingNodesHaveCommonAncestor:Boolean; + var isChangingNodeParentAncestorOfSelectedNode:Boolean; var bookmarkInChangingCollection:CursorBookmark; + var changingNodeCollectionBookmarkIndex:int; // remember the current parent parentOfCurrentNode = parentStack[parentStack.length - 1]; @@ -1196,14 +1197,14 @@ public class HierarchicalCollectionViewCursor extends EventDispatcher } else { parentOfChangingNodeIndex = parentStack.indexOf(parentOfChangingNode); - selectedAndChangingNodesHaveCommonAncestor = parentOfChangingNodeIndex != -1; - if (selectedAndChangingNodesHaveCommonAncestor) + isChangingNodeParentAncestorOfSelectedNode = parentOfChangingNodeIndex != -1; + if (isChangingNodeParentAncestorOfSelectedNode) { if (changingNodeAndSiblings != null) { - var changingNodeCollectionIndex:int = parentOfChangingNodeIndex + 1; + changingNodeCollectionBookmarkIndex = parentOfChangingNodeIndex + 1; changingCollectionCursor = changingNodeAndSiblings.createCursor(); - bookmarkInChangingCollection = parentBookmarkStack[changingNodeCollectionIndex]; + bookmarkInChangingCollection = parentBookmarkStack[changingNodeCollectionBookmarkIndex]; try { changingCollectionCursor.seek(bookmarkInChangingCollection); @@ -1212,7 +1213,7 @@ public class HierarchicalCollectionViewCursor extends EventDispatcher catch (e:ItemPendingError) { } - parentBookmarkStack[changingNodeCollectionIndex] = changingCollectionCursor.bookmark; + parentBookmarkStack[changingNodeCollectionBookmarkIndex] = changingCollectionCursor.bookmark; } } } @@ -1276,12 +1277,12 @@ public class HierarchicalCollectionViewCursor extends EventDispatcher } else { parentOfChangingNodeIndex = parentStack.indexOf(parentOfChangingNode); - selectedAndChangingNodesHaveCommonAncestor = parentOfChangingNodeIndex != -1; - if (selectedAndChangingNodesHaveCommonAncestor) + isChangingNodeParentAncestorOfSelectedNode = parentOfChangingNodeIndex != -1; + if (isChangingNodeParentAncestorOfSelectedNode) { if (changingNodeAndSiblings != null) { - var changingNodeCollectionBookmarkIndex:int = parentOfChangingNodeIndex + 1; + changingNodeCollectionBookmarkIndex = parentOfChangingNodeIndex + 1; changingCollectionCursor = changingNodeAndSiblings.createCursor(); bookmarkInChangingCollection = parentBookmarkStack[changingNodeCollectionBookmarkIndex]; try @@ -1297,6 +1298,7 @@ public class HierarchicalCollectionViewCursor extends EventDispatcher } } } + delete collection.parentMap[UIDUtil.getUID(changingNode)]; }