You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/08/10 17:45:22 UTC

[royale-asjs] 08/09: get tree working

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 3a28b0a54bb6469b0b1afdceaa0a2f60b61cf823
Author: Alex Harui <ah...@apache.org>
AuthorDate: Fri Aug 10 09:48:38 2018 -0700

    get tree working
---
 .../royale/mx/controls/treeClasses/HierarchicalCollectionView.as   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
index 66ffe55..77427fb 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/treeClasses/HierarchicalCollectionView.as
@@ -1070,7 +1070,7 @@ public class HierarchicalCollectionView extends EventDispatcher
         var offset:int = getItemIndex(node);
         //otherwise seek to offset and get the depth
         var bookmark:CursorBookmark = iterator.bookmark;
-        iterator.seek(bookmark, offset);
+        iterator.seek(CursorBookmark.FIRST, offset);
         var depth:int = getCurrentCursorDepth();
         //put the cursor back
         iterator.seek(bookmark, 0);
@@ -1131,6 +1131,7 @@ public class HierarchicalCollectionView extends EventDispatcher
     
     private function dispatchAddOrRemoveEvents(node:Object, index:int, type:String):int
     {
+        var adding:Boolean = (type == org.apache.royale.events.CollectionEvent.ITEM_ADDED);
         var children:ICollectionView = getChildren(node);
         var cursor:IViewCursor = children.createCursor();
         do
@@ -1140,6 +1141,10 @@ public class HierarchicalCollectionView extends EventDispatcher
             collectionEvent.item = item;
             collectionEvent.index = index++;
             dispatchEvent(collectionEvent);
+            if (adding)
+                currentLength++;
+            else
+                currentLength--;
             if (isOpen(item))
             {
                 index = dispatchAddOrRemoveEvents(node, index, type);