Minor optimization
authorChristos Stathis <chstath@ebs.gr>
Wed, 13 Jul 2011 08:40:52 +0000 (11:40 +0300)
committerChristos Stathis <chstath@ebs.gr>
Wed, 13 Jul 2011 08:40:52 +0000 (11:40 +0300)
src/gr/grnet/pithos/web/client/foldertree/Folder.java

index 5ece0e9..3c82360 100644 (file)
@@ -147,25 +147,21 @@ public class Folder extends Resource {
                         f.populate(this, o, container);
                         subfolders.add(f);
                     }
-                    else {
+                    else if (!(o.containsKey("x_object_meta_trash") && o.get("x_object_meta_trash").isString().stringValue().equals("true"))) {
                         File file = new File();
                         file.populate(this, o, container);
                         files.add(file);
                     }
                 }
             }
+            //This step is necessary to remove the trashed folders. Trashed folders are added initially because we need to
+            //avoid having in the list the virtual folders of the form {"subdir":"folder1"} which have no indication of thrash
             Iterator<Folder> iter = subfolders.iterator();
             while (iter.hasNext()) {
                 Folder f = iter.next();
                 if (f.isInTrash())
                     iter.remove();
             }
-            Iterator<File> it = files.iterator();
-            while (it.hasNext()) {
-                File f = it.next();
-                if (f.isInTrash())
-                    it.remove();
-            }
         }
     }