Empty trash feature (still buggy
[pithos-web-client] / src / gr / grnet / pithos / web / client / foldertree / FolderTreeView.java
index cf959a6..733779c 100644 (file)
@@ -36,7 +36,6 @@
 package gr.grnet.pithos.web.client.foldertree;
 
 import com.google.gwt.core.client.GWT;
-import com.google.gwt.resources.client.ClientBundle;
 import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.resources.client.ImageResource.ImageOptions;
 import com.google.gwt.safehtml.client.SafeHtmlTemplates;
@@ -44,6 +43,7 @@ import com.google.gwt.safehtml.shared.SafeHtml;
 import com.google.gwt.user.cellview.client.CellTree;
 import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
 import com.google.gwt.user.cellview.client.TreeNode;
+import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.Tree;
 import gr.grnet.pithos.web.client.FolderContextMenu;
@@ -57,58 +57,62 @@ public class FolderTreeView extends Composite {
 
     private void updateChildren(TreeNode node, Folder folder) {
         for (int i=0; i<node.getChildCount(); i++) {
-            if (node.isChildOpen(i)) {
-                if (folder.equals(node.getChildValue(i))) {
-                    node.setChildOpen(i, false, true);
-                    node.setChildOpen(i, true, true);
-                }
-                else {
+            if (folder.equals(node.getChildValue(i))) {
+                node.setChildOpen(i, false, true);
+                node.setChildOpen(i, true, true);
+            }
+            else {
+                if (node.isChildOpen(i)) {
                     TreeNode n = node.setChildOpen(i, true);
                     updateChildren(n, folder);
                 }
             }
-        }
+       }
     }
 
     static interface BasicResources extends CellTree.Resources {
 
-        @ImageOptions(flipRtl = true)
+        @Override
+               @ImageOptions(flipRtl = true)
         @Source("gr/grnet/pithos/web/client/cellTreeClosedItem.gif")
         ImageResource cellTreeClosedItem();
 
-        @ImageOptions(flipRtl = true)
+        @Override
+               @ImageOptions(flipRtl = true)
         @Source("gr/grnet/pithos/web/client/cellTreeLoadingBasic.gif")
         ImageResource cellTreeLoading();
 
-        @ImageOptions(flipRtl = true)
+        @Override
+               @ImageOptions(flipRtl = true)
         @Source("gr/grnet/pithos/web/client/cellTreeOpenItem.gif")
         ImageResource cellTreeOpenItem();
 
-        @Source({"gr/grnet/pithos/web/client/GssCellTreeBasic.css"})
+        @Override
+               @Source({"gr/grnet/pithos/web/client/GssCellTreeBasic.css"})
         CellTree.Style cellTreeStyle();
     }
 
-    public static interface Images extends ClientBundle,Tree.Resources, FolderContextMenu.Images {
+    public static interface Images extends Tree.Resources, FolderContextMenu.Images {
 
         @Source("gr/grnet/pithos/resources/folder_home.png")
         ImageResource home();
 
-        @Source("gr/grnet/pithos/resources/folder_yellow.png")
+        @Source("gr/grnet/pithos/resources/2folder22.png")
         public ImageResource folderYellow();
 
         @Source("gr/grnet/pithos/resources/mimetypes/document.png")
         ImageResource document();
 
-        @Source("gr/grnet/pithos/resources/internet.png")
+        @Source("gr/grnet/pithos/resources/othersshared.png")
         ImageResource othersShared();
 
-        @Source("gr/grnet/pithos/resources/edit_user.png")
+        @Source("gr/grnet/pithos/resources/myshared22.png")
         ImageResource myShared();
 
         @Source("gr/grnet/pithos/resources/folder_user.png")
         ImageResource sharedFolder();
 
-        @Source("gr/grnet/pithos/resources/trashcan_empty.png")
+        @Source("gr/grnet/pithos/resources/trash.png")
         ImageResource trash();
     }
 
@@ -142,7 +146,7 @@ public class FolderTreeView extends Composite {
        return model.getSelection();
     }
 
-    public void updateFolder(Folder folder, boolean showfiles) {
-        model.updateFolder(folder, showfiles);
+    public void updateFolder(Folder folder, boolean showfiles, Command callback) {
+        model.updateFolder(folder, showfiles, callback);
     }
 }