FLEX-34458
CAUSE:
Because HierarchicalCollectionViewCursor uses both relative and absolute 
bookmarks in the various collections of the hierarchy, there needs to be 
special treatment for these two cases. Namely, while it works great with 
absolute bookmarks to call .movePrevious on the bookmark when something is 
deleted in the same collection before the selected item, it doesn't work well 
for the relative CursorBookmark.LAST currentChildBookmark value. Because 
HierarchicalCollectionViewCursor.collectionChangeHandler() did not make any 
difference between absolute and relative bookmarks, it used to call 
.movePrevious() on the bookmark even if it was the absolute value 
CursorBookmark.LAST.

SOLUTION:
In this situation we don't need to .movePrevious() when items above are 
deleted, because CursorBookmark.LAST will always point to the last item in the 
collection, no matter what changes happened to that collection.


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

Branch: refs/heads/develop
Commit: 2f1b76827763b32988b1a1ccc73e603d9d7d788a
Parents: 979c7a8
Author: Mihai Chira <mih...@apache.org>
Authored: Fri Aug 8 15:54:05 2014 +0100
Committer: Mihai Chira <mih...@apache.org>
Committed: Fri Aug 8 16:11:59 2014 +0100

----------------------------------------------------------------------
 .../src/mx/collections/HierarchicalCollectionViewCursor.as    | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/2f1b7682/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 ef89479..1f3244d 100644
--- 
a/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
+++ 
b/frameworks/projects/advancedgrids/src/mx/collections/HierarchicalCollectionViewCursor.as
@@ -1261,6 +1261,9 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
 
                     if (parentOfChangingNode == parentOfCurrentNode)
                     {
+                        if(currentChildBookmark == CursorBookmark.LAST)
+                            break;
+
                         if (changingNodeAndSiblings != null)
                         {
                             changingCollectionCursor = 
changingNodeAndSiblings.createCursor();
@@ -1285,6 +1288,10 @@ public class HierarchicalCollectionViewCursor extends 
EventDispatcher
                                 changingNodeCollectionBookmarkIndex = 
parentOfChangingNodeIndex + 1;
                                 changingCollectionCursor = 
changingNodeAndSiblings.createCursor();
                                 bookmarkInChangingCollection = 
parentBookmarkStack[changingNodeCollectionBookmarkIndex];
+
+                                if(bookmarkInChangingCollection == 
CursorBookmark.LAST)
+                                    break;
+
                                 try
                                 {
                                     
changingCollectionCursor.seek(bookmarkInChangingCollection);

Reply via email to