Use display name to add a user to a group
[pithos-web-client] / src / gr / grnet / pithos / web / client / commands / RefreshCommand.java
index 1a969fd..01f6acd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 GRNET S.A. All rights reserved.
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
  */
 package gr.grnet.pithos.web.client.commands;
 
-import gr.grnet.pithos.web.client.FileMenu;
 import gr.grnet.pithos.web.client.Pithos;
-import gr.grnet.pithos.web.client.rest.resource.FileResource;
-import gr.grnet.pithos.web.client.rest.resource.GroupUserResource;
-
-import java.util.List;
+import gr.grnet.pithos.web.client.foldertree.Folder;
 
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.ui.PopupPanel;
@@ -47,34 +43,34 @@ import com.google.gwt.user.client.ui.PopupPanel;
 
 public class RefreshCommand implements Command {
 
-       final FileMenu.Images newImages;
-
        private PopupPanel containerPanel;
 
+    Pithos app;
+
+    private Folder folder;
+    
        /**
         * @param _containerPanel
-        * @param _newImages the images of all the possible delete dialogs
         */
-       public RefreshCommand(PopupPanel _containerPanel, final FileMenu.Images _newImages) {
+       public RefreshCommand(Pithos _app, PopupPanel _containerPanel, Folder _folder) {
+        app = _app;
                containerPanel = _containerPanel;
-               newImages = _newImages;
+               folder = _folder;
        }
 
        @Override
        public void execute() {
-               containerPanel.hide();
-               if (Pithos.get().getCurrentSelection() instanceof FileResource || Pithos.get().getCurrentSelection() instanceof List)
-                       Pithos.get().showFileList(true);
-               else if (Pithos.get().getCurrentSelection() instanceof GroupUserResource)
-                       return;
-               else{
-                       //TODO:CELLTREE
-                       //DnDTreeItem selectedTreeItem = (DnDTreeItem) Pithos.get().getFolders().getCurrent();
-                       //if(selectedTreeItem != null){
-                               //Pithos.get().getFolders().updateFolder(selectedTreeItem);
-                       Pithos.get().getTreeView().updateNode(Pithos.get().getTreeView().getSelection());
-                               Pithos.get().showFileList(true);
-                       //}
-               }
+               if (containerPanel != null)
+                       containerPanel.hide();
+               if (app.getSelectedTree().equals(app.getMySharedTreeView()))
+                       app.updateSharedFolder(folder, true);
+               else
+                       app.updateFolder(folder, true, new Command() {
+                               
+                               @Override
+                               public void execute() {
+                                       app.updateStatistics();
+                               }
+                       }, true);
        }
 }