commit 3184056818b30b438d6d8a8b66fbd11ef838869d
Author: koutsoub <devnull@localhost>
Date:   Tue Feb 1 18:06:26 2011 +0200

    fix clipboard, cut, copy, paste

diff --git a/src/gr/ebs/gss/client/EditMenu.java b/src/gr/ebs/gss/client/EditMenu.java
index ea59d53..27657ce 100644
--- a/src/gr/ebs/gss/client/EditMenu.java
+++ b/src/gr/ebs/gss/client/EditMenu.java
@@ -185,7 +185,7 @@ public class EditMenu extends PopupPanel implements ClickHandler {
 				pasteLabel = "Paste File";
 			else if(GSS.get().getClipboard().getItem().getFiles() != null)
 				pasteLabel = "Paste Files";
-			else if(GSS.get().getClipboard().getItem().getFolderResource() != null)
+			else if(GSS.get().getClipboard().getItem().getRestResourceWrapper() != null)
 				pasteLabel = "Paste Folder";
 		contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.cut()).getHTML() + "&nbsp;"+cutLabel+"</span>", true, new CutCommand(this)).setVisible(cutcopyVisible);
 		contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.copy()).getHTML() + "&nbsp;"+copyLabel+"</span>", true, new CopyCommand(this)).setVisible(cutcopyVisible);
diff --git a/src/gr/ebs/gss/client/clipboard/ClipboardItem.java b/src/gr/ebs/gss/client/clipboard/ClipboardItem.java
index 70afba9..b32bb5b 100644
--- a/src/gr/ebs/gss/client/clipboard/ClipboardItem.java
+++ b/src/gr/ebs/gss/client/clipboard/ClipboardItem.java
@@ -19,7 +19,7 @@
 package gr.ebs.gss.client.clipboard;
 
 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 gr.ebs.gss.client.rest.resource.GroupUserResource;
 
 import java.io.Serializable;
@@ -34,7 +34,7 @@ public class ClipboardItem implements Serializable{
 	private int operation;
 	private FileResource file;
 	private List<FileResource> files;
-	private FolderResource folderResource;
+	private RestResourceWrapper folderResource;
 	private GroupUserResource user;
 
 	public ClipboardItem(){}
@@ -49,7 +49,7 @@ public class ClipboardItem implements Serializable{
 		file = aFile;
 	}
 
-	public ClipboardItem(int anOperation, FolderResource folder){
+	public ClipboardItem(int anOperation, RestResourceWrapper folder){
 		operation = anOperation;
 		folderResource = folder;
 	}
@@ -73,7 +73,7 @@ public class ClipboardItem implements Serializable{
 		file = aFile;
 	}
 
-	public ClipboardItem(FolderResource folder){
+	public ClipboardItem(RestResourceWrapper folder){
 		operation = Clipboard.COPY;
 		folderResource = folder;
 	}
@@ -170,7 +170,7 @@ public class ClipboardItem implements Serializable{
 	 *
 	 * @return the folderResource
 	 */
-	public FolderResource getFolderResource() {
+	public RestResourceWrapper getRestResourceWrapper() {
 		return folderResource;
 	}
 
@@ -179,7 +179,7 @@ public class ClipboardItem implements Serializable{
 	 *
 	 * @param aFolder the folderResource to set
 	 */
-	public void setFolderResource(FolderResource aFolder) {
+	public void setRestResourceWrapper(RestResourceWrapper aFolder) {
 		folderResource = aFolder;
 	}
 }
diff --git a/src/gr/ebs/gss/client/commands/CopyCommand.java b/src/gr/ebs/gss/client/commands/CopyCommand.java
index 4b96455..e4e05fc 100644
--- a/src/gr/ebs/gss/client/commands/CopyCommand.java
+++ b/src/gr/ebs/gss/client/commands/CopyCommand.java
@@ -23,6 +23,7 @@ import gr.ebs.gss.client.clipboard.ClipboardItem;
 import gr.ebs.gss.client.rest.resource.FileResource;
 import gr.ebs.gss.client.rest.resource.FolderResource;
 import gr.ebs.gss.client.rest.resource.GroupUserResource;
+import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
 
 import java.util.List;
 
@@ -48,8 +49,8 @@ public class CopyCommand implements Command{
 		if (selection == null)
 			return;
 
-		if (selection instanceof FolderResource) {
-			ClipboardItem clipboardItem = new ClipboardItem((FolderResource) selection);
+		if (selection instanceof RestResourceWrapper) {
+			ClipboardItem clipboardItem = new ClipboardItem((RestResourceWrapper) selection);
 			GSS.get().getClipboard().setItem(clipboardItem);
 		} else if (selection instanceof FileResource) {
 			ClipboardItem clipboardItem = new ClipboardItem((FileResource) selection);
diff --git a/src/gr/ebs/gss/client/commands/CutCommand.java b/src/gr/ebs/gss/client/commands/CutCommand.java
index 7fc16e4..ff57283 100644
--- a/src/gr/ebs/gss/client/commands/CutCommand.java
+++ b/src/gr/ebs/gss/client/commands/CutCommand.java
@@ -24,6 +24,7 @@ import gr.ebs.gss.client.clipboard.ClipboardItem;
 import gr.ebs.gss.client.rest.resource.FileResource;
 import gr.ebs.gss.client.rest.resource.FolderResource;
 import gr.ebs.gss.client.rest.resource.GroupUserResource;
+import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
 
 import java.util.List;
 
@@ -51,8 +52,8 @@ public class CutCommand implements Command{
 		if (selection == null)
 			return;
 		GWT.log("selection: " + selection.toString(), null);
-		if (selection instanceof FolderResource) {
-			ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (FolderResource) selection);
+		if (selection instanceof RestResourceWrapper) {
+			ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (RestResourceWrapper) selection);
 			GSS.get().getClipboard().setItem(clipboardItem);
 		} else if (selection instanceof FileResource) {
 			ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (FileResource) selection);
diff --git a/src/gr/ebs/gss/client/commands/PasteCommand.java b/src/gr/ebs/gss/client/commands/PasteCommand.java
index 09375c5..3c46962 100644
--- a/src/gr/ebs/gss/client/commands/PasteCommand.java
+++ b/src/gr/ebs/gss/client/commands/PasteCommand.java
@@ -26,6 +26,7 @@ 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.GroupResource;
+import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -90,8 +91,8 @@ public class PasteCommand implements Command {
 			}
 		}
 		FolderResource selectedFolder = null;
-		if(selection != null && selection instanceof FolderResource)
-			selectedFolder = (FolderResource)selection;
+		if(selection != null && selection instanceof RestResourceWrapper)
+			selectedFolder = ((RestResourceWrapper)selection).getResource();
 		//TODO:CELLTREE
 		/*
 		else if(GSS.get().getFolders().getCurrent() != null && ((DnDTreeItem)GSS.get().getFolders().getCurrent()).getFolderResource() != null)
@@ -99,17 +100,18 @@ public class PasteCommand implements Command {
 		*/
 		if (selectedFolder != null) {
 			final ClipboardItem citem = GSS.get().getClipboard().getItem();
-			if (citem != null && citem.getFolderResource() != null) {
+			if (citem != null && citem.getRestResourceWrapper() != null) {
 				String target = selectedFolder.getUri();
 				target = target.endsWith("/") ? target : target + '/';
-				target = target + URL.encodeComponent(citem.getFolderResource().getName());
+				target = target + URL.encodeComponent(citem.getRestResourceWrapper().getResource().getName());
 				if (citem.getOperation() == Clipboard.COPY) {
-					PostCommand cf = new PostCommand(citem.getFolderResource().getUri() + "?copy=" + target, "", 200) {
+					PostCommand cf = new PostCommand(citem.getRestResourceWrapper().getUri() + "?copy=" + target, "", 200) {
 
 						@Override
 						public void onComplete() {
 							//TODO:CELLTREE
 							//GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent());
+							GSS.get().getTreeView().updateNodeChildren(GSS.get().getTreeView().getSelection());
 							GSS.get().getStatusPanel().updateStats();
 							GSS.get().getClipboard().setItem(null);
 						}
@@ -135,7 +137,7 @@ public class PasteCommand implements Command {
 					};
 					DeferredCommand.addCommand(cf);
 				} else if (citem.getOperation() == Clipboard.CUT) {
-					PostCommand cf = new PostCommand(citem.getFolderResource().getUri() + "?move=" + target, "", 200) {
+					PostCommand cf = new PostCommand(citem.getRestResourceWrapper().getUri() + "?move=" + target, "", 200) {
 
 						@Override
 						public void onComplete() {
@@ -147,6 +149,8 @@ public class PasteCommand implements Command {
 									GSS.get().getFolders().updateFolder((DnDTreeItem) item.getParentItem());
 							GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent());
 							*/
+							GSS.get().getTreeView().updateNodeChildren(GSS.get().getTreeView().getSelection());
+							GSS.get().getTreeView().updateNodeChildren(citem.getRestResourceWrapper().getResource().getParentURI());
 							GSS.get().getStatusPanel().updateStats();		
 							GSS.get().getClipboard().setItem(null);
 						}
