correctly update children
[pithos] / src / gr / ebs / gss / client / commands / ToTrashCommand.java
index 689e7ce..de50a77 100644 (file)
@@ -24,6 +24,7 @@ import gr.ebs.gss.client.rest.PostCommand;
 import gr.ebs.gss.client.rest.RestException;
 import gr.ebs.gss.client.rest.resource.FileResource;
 import gr.ebs.gss.client.rest.resource.FolderResource;
+import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -32,7 +33,6 @@ import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.DeferredCommand;
 import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.TreeItem;
 
 /**
  *
@@ -55,8 +55,8 @@ public class ToTrashCommand implements Command{
                if (selection == null)
                        return;
                GWT.log("selection: " + selection.toString(), null);
-               if (selection instanceof FolderResource) {
-                       FolderResource fdto = (FolderResource) selection;
+               if (selection instanceof RestResourceWrapper) {
+                       FolderResource fdto = ((RestResourceWrapper) selection).getResource();
                        PostCommand tot = new PostCommand(fdto.getUri()+"?trash=","",200){
 
                                @Override
@@ -70,6 +70,10 @@ public class ToTrashCommand implements Command{
                                        }
                                        GSS.get().getFolders().update(GSS.get().getFolders().getTrashItem());
                                        */
+                                       FolderResource fres = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource();
+                                       GSS.get().getTreeView().updateNodeChildren(fres.getParentURI());
+                                       //GSS.get().getTreeView().updateNode(GSS.get().getTreeView().getTrash());
+                                       GSS.get().getTreeView().updateTrashNode();
                                        GSS.get().showFileList(true);
                                }