Author: ludovic
Date: 2008-02-15 17:24:37 +0100 (Fri, 15 Feb 2008)
New Revision: 7761

Modified:
   
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/widgets/moveasset/MoveAsset.java
Log:
CURRIKI-1691   Moving a file in a collection in the CB drops it one spot higher 
then selected

Modified: 
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/widgets/moveasset/MoveAsset.java
===================================================================
--- 
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/widgets/moveasset/MoveAsset.java
      2008-02-15 16:02:44 UTC (rev 7760)
+++ 
xwiki-products/curriki/trunk/gwt/src/main/java/org/curriki/gwt/client/widgets/moveasset/MoveAsset.java
      2008-02-15 16:24:37 UTC (rev 7761)
@@ -99,6 +99,7 @@
                         newPosition = ((AssetTreeItem)(parent.getChild(treePos 
+ 1))).getIndex();
                     }
                     */
+                    // Window.alert("New position: " + newPosition);
                     final String newParent = 
((AssetTreeItem)parent).getPageName();
                     final boolean isNewParentDifferent = 
!fromParent.equals(newParent);
                     moveAsset(newPosition, newParent, isNewParentDifferent);
@@ -116,9 +117,11 @@
 
                     int i = 0;
                     for (; i < index; i++){
-                        parent.addItem((TreeItem) items.get(i));
+                        AssetTreeItem subitem = (AssetTreeItem) items.get(i);
+                        parent.addItem(subitem);
                     }
-                    parent.addItem(new InsertHereTreeItem(index));
+                    int position = (int) ((AssetTreeItem) item).getIndex();
+                    parent.addItem(new InsertHereTreeItem(position));
                     AssetTreeItem assetTreeItem = (AssetTreeItem) items.get(i);
                     if 
(Constants.CATEGORY_COLLECTION.equals(assetTreeItem.getType())) {
                       assetTreeItem.addItem(new 
InsertHereTreeItem(assetTreeItem.getChildCount()));
@@ -126,7 +129,7 @@
                     }
                     parent.addItem(assetTreeItem);
 
-                    parent.addItem(new InsertHereTreeItem(index+1));
+                    parent.addItem(new InsertHereTreeItem(position+1));
                     for (i++; i < items.size(); i++){
                         parent.addItem((TreeItem) items.get(i));
                     }

_______________________________________________
notifications mailing list
notifications@xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to