Revision 6b4a2499
b/web_client/src/gr/grnet/pithos/web/client/Clipboard.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2011 GRNET S.A. All rights reserved. |
|
3 |
* |
|
4 |
* Redistribution and use in source and binary forms, with or |
|
5 |
* without modification, are permitted provided that the following |
|
6 |
* conditions are met: |
|
7 |
* |
|
8 |
* 1. Redistributions of source code must retain the above |
|
9 |
* copyright notice, this list of conditions and the following |
|
10 |
* disclaimer. |
|
11 |
* |
|
12 |
* 2. Redistributions in binary form must reproduce the above |
|
13 |
* copyright notice, this list of conditions and the following |
|
14 |
* disclaimer in the documentation and/or other materials |
|
15 |
* provided with the distribution. |
|
16 |
* |
|
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
28 |
* POSSIBILITY OF SUCH DAMAGE. |
|
29 |
* |
|
30 |
* The views and conclusions contained in the software and |
|
31 |
* documentation are those of the authors and should not be |
|
32 |
* interpreted as representing official policies, either expressed |
|
33 |
* or implied, of GRNET S.A. |
|
34 |
*/ |
|
35 |
package gr.grnet.pithos.web.client; |
|
36 |
|
|
37 |
import gr.grnet.pithos.web.client.foldertree.File; |
|
38 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
|
39 |
import java.util.List; |
|
40 |
|
|
41 |
public class Clipboard { |
|
42 |
public final static int CUT=1; |
|
43 |
public final static int COPY=2; |
|
44 |
|
|
45 |
private int operation; |
|
46 |
|
|
47 |
private List<File> files; |
|
48 |
|
|
49 |
private Folder folder; |
|
50 |
|
|
51 |
/** |
|
52 |
* Retrieve the item. |
|
53 |
* |
|
54 |
* @return the item |
|
55 |
*/ |
|
56 |
public Object getItem() { |
|
57 |
if (folder != null) |
|
58 |
return folder; |
|
59 |
if (files != null) |
|
60 |
return files; |
|
61 |
return null; |
|
62 |
} |
|
63 |
|
|
64 |
public void setItem(int _operation, Folder _folder) { |
|
65 |
operation = _operation; |
|
66 |
folder = _folder; |
|
67 |
files = null; |
|
68 |
} |
|
69 |
|
|
70 |
public void setItem(int _operation, List<File> _files) { |
|
71 |
operation = _operation; |
|
72 |
files = _files; |
|
73 |
folder = null; |
|
74 |
} |
|
75 |
|
|
76 |
public int getOperation() { |
|
77 |
return operation; |
|
78 |
} |
|
79 |
|
|
80 |
public void clear() { |
|
81 |
folder = null; |
|
82 |
files = null; |
|
83 |
} |
|
84 |
} |
b/web_client/src/gr/grnet/pithos/web/client/EditMenu.java | ||
---|---|---|
39 | 39 |
import gr.grnet.pithos.web.client.commands.DeleteCommand; |
40 | 40 |
import gr.grnet.pithos.web.client.commands.PasteCommand; |
41 | 41 |
import gr.grnet.pithos.web.client.commands.ToTrashCommand; |
42 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
|
42 | 43 |
import gr.grnet.pithos.web.client.rest.resource.FileResource; |
43 | 44 |
|
44 | 45 |
import gr.grnet.pithos.web.client.rest.resource.GroupUserResource; |
... | ... | |
195 | 196 |
copyLabel = "Copy Files"; |
196 | 197 |
} |
197 | 198 |
if(GSS.get().getClipboard().getItem() != null) |
198 |
if(GSS.get().getClipboard().getItem().getFile() != null) |
|
199 |
pasteLabel = "Paste File"; |
|
200 |
else if(GSS.get().getClipboard().getItem().getFiles() != null) |
|
201 |
pasteLabel = "Paste Files"; |
|
202 |
else if(GSS.get().getClipboard().getItem().getRestResourceWrapper() != null) |
|
199 |
if(GSS.get().getClipboard().getItem() instanceof List) { |
|
200 |
if (((List) GSS.get().getClipboard().getItem()).size() > 1) |
|
201 |
pasteLabel = "Paste Files"; |
|
202 |
else |
|
203 |
pasteLabel = "Paste File"; |
|
204 |
} |
|
205 |
else if(GSS.get().getClipboard().getItem() instanceof Folder) |
|
203 | 206 |
pasteLabel = "Paste Folder"; |
204 |
MenuItem cutItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.cut()).getHTML() + " "+cutLabel+"</span>", true, new CutCommand(this));
|
|
207 |
MenuItem cutItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.cut()).getHTML() + " "+cutLabel+"</span>", true, new CutCommand(GSS.get(), this, null));
|
|
205 | 208 |
cutItem.getElement().setId("topMenu.edit.cut"); |
206 | 209 |
contextMenu.addItem(cutItem).setVisible(cutcopyVisible); |
207 | 210 |
|
208 |
MenuItem copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.copy()).getHTML() + " "+copyLabel+"</span>", true, new CopyCommand(this));
|
|
211 |
MenuItem copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.copy()).getHTML() + " "+copyLabel+"</span>", true, new CopyCommand(GSS.get(), this, null));
|
|
209 | 212 |
copyItem.getElement().setId("topMenu.edit.copy"); |
210 | 213 |
contextMenu.addItem(copyItem).setVisible(cutcopyVisible); |
211 | 214 |
|
212 |
MenuItem pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " "+pasteLabel+"</span>", true, new PasteCommand(this));
|
|
215 |
MenuItem pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " "+pasteLabel+"</span>", true, new PasteCommand(GSS.get(), this, null));
|
|
213 | 216 |
pasteItem.getElement().setId("topMenu.edit.paste"); |
214 | 217 |
if (GSS.get().getClipboard().getItem() != null) |
215 |
if(GSS.get().isUserListVisible() && GSS.get().getClipboard().getItem().getUser() == null){ |
|
216 |
contextMenu.addItem(pasteItem); |
|
217 |
} |
|
218 |
else if(!GSS.get().isUserListVisible() && GSS.get().getClipboard().getItem().getUser() != null){ |
|
219 |
//do not show paste |
|
220 |
} |
|
221 |
else if (GSS.get().getTreeView().getSelection() instanceof RestResourceWrapper){ |
|
222 |
contextMenu.addItem(pasteItem); |
|
223 |
} |
|
218 |
contextMenu.addItem(pasteItem); |
|
224 | 219 |
MenuItem moveToTrashItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this)); |
225 | 220 |
moveToTrashItem.getElement().setId("topMenu.edit.moveToTrash"); |
226 | 221 |
contextMenu .addItem(moveToTrashItem) |
b/web_client/src/gr/grnet/pithos/web/client/FileContextMenu.java | ||
---|---|---|
137 | 137 |
images = newImages; |
138 | 138 |
MenuBar contextMenu = new MenuBar(true); |
139 | 139 |
|
140 |
pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this));
|
|
140 |
pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(images.paste()).getHTML() + " Paste</span>", true, new PasteCommand(GSS.get(), this, selectedFolder));
|
|
141 | 141 |
contextMenu.addItem(pasteItem); |
142 | 142 |
|
143 | 143 |
MenuItem upload = new MenuItem("<span>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this, selectedFolder)); |
... | ... | |
153 | 153 |
MenuItem delete = new MenuItem("<span>" + AbstractImagePrototype.create(images.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, null, images)); |
154 | 154 |
contextMenu.addItem(delete); |
155 | 155 |
} else { |
156 |
cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
|
|
156 |
cutItem = new MenuItem("<span id='fileContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(GSS.get(), this, selectedFiles));
|
|
157 | 157 |
contextMenu.addItem(cutItem); |
158 | 158 |
|
159 |
copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this));
|
|
159 |
copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(GSS.get(), this, selectedFiles));
|
|
160 | 160 |
contextMenu.addItem(copyItem); |
161 | 161 |
|
162 | 162 |
trashItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this)); |
b/web_client/src/gr/grnet/pithos/web/client/FolderContextMenu.java | ||
---|---|---|
99 | 99 |
contextMenu.addItem(newFolder); |
100 | 100 |
|
101 | 101 |
// do not show the copy & cut option for the user's root folder |
102 |
MenuItem cut = new MenuItem("<span id = 'folderContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
|
|
102 |
MenuItem cut = new MenuItem("<span id = 'folderContextMenu.cut'>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(GSS.get(), this, folder));
|
|
103 | 103 |
contextMenu.addItem(cut); |
104 | 104 |
|
105 |
MenuItem copy = new MenuItem("<span id = 'folderContextMenu.copy'>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this));
|
|
105 |
MenuItem copy = new MenuItem("<span id = 'folderContextMenu.copy'>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(GSS.get(), this, folder));
|
|
106 | 106 |
contextMenu.addItem(copy); |
107 | 107 |
|
108 |
pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this));
|
|
108 |
pasteItem = new MenuItem("<span id = 'folderContextMenu.paste'>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(GSS.get(), this, folder));
|
|
109 | 109 |
contextMenu.addItem(pasteItem); |
110 | 110 |
|
111 | 111 |
// do not show delete options for the user's root folder |
b/web_client/src/gr/grnet/pithos/web/client/GSS.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
import com.google.gwt.core.client.Scheduler; |
38 | 38 |
import com.google.gwt.core.client.Scheduler.ScheduledCommand; |
39 |
import com.google.gwt.event.dom.client.ContextMenuEvent; |
|
40 |
import com.google.gwt.event.dom.client.ContextMenuHandler; |
|
41 |
import com.google.gwt.event.shared.GwtEvent; |
|
42 |
import com.google.gwt.event.shared.GwtEvent.Type; |
|
43 | 39 |
import com.google.gwt.view.client.SelectionChangeEvent; |
44 | 40 |
import com.google.gwt.view.client.SingleSelectionModel; |
45 |
import gr.grnet.pithos.web.client.clipboard.Clipboard; |
|
46 | 41 |
import gr.grnet.pithos.web.client.commands.GetUserCommand; |
47 | 42 |
import gr.grnet.pithos.web.client.foldertree.AccountResource; |
48 | 43 |
import gr.grnet.pithos.web.client.foldertree.File; |
... | ... | |
77 | 72 |
import com.google.gwt.resources.client.ClientBundle; |
78 | 73 |
import com.google.gwt.resources.client.ImageResource; |
79 | 74 |
import com.google.gwt.user.client.Cookies; |
80 |
import com.google.gwt.user.client.DOM; |
|
81 | 75 |
import com.google.gwt.user.client.Event; |
82 | 76 |
import com.google.gwt.user.client.History; |
83 | 77 |
import com.google.gwt.user.client.Window; |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2011 GRNET S.A. All rights reserved. |
|
3 |
* |
|
4 |
* Redistribution and use in source and binary forms, with or |
|
5 |
* without modification, are permitted provided that the following |
|
6 |
* conditions are met: |
|
7 |
* |
|
8 |
* 1. Redistributions of source code must retain the above |
|
9 |
* copyright notice, this list of conditions and the following |
|
10 |
* disclaimer. |
|
11 |
* |
|
12 |
* 2. Redistributions in binary form must reproduce the above |
|
13 |
* copyright notice, this list of conditions and the following |
|
14 |
* disclaimer in the documentation and/or other materials |
|
15 |
* provided with the distribution. |
|
16 |
* |
|
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
28 |
* POSSIBILITY OF SUCH DAMAGE. |
|
29 |
* |
|
30 |
* The views and conclusions contained in the software and |
|
31 |
* documentation are those of the authors and should not be |
|
32 |
* interpreted as representing official policies, either expressed |
|
33 |
* or implied, of GRNET S.A. |
|
34 |
*/ |
|
35 |
package gr.grnet.pithos.web.client.clipboard; |
|
36 |
|
|
37 |
|
|
38 |
public class Clipboard { |
|
39 |
public final static int CUT=1; |
|
40 |
public final static int COPY=2; |
|
41 |
private ClipboardItem item; |
|
42 |
|
|
43 |
/** |
|
44 |
* Retrieve the item. |
|
45 |
* |
|
46 |
* @return the item |
|
47 |
*/ |
|
48 |
public ClipboardItem getItem() { |
|
49 |
return item; |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* Modify the item. |
|
54 |
* |
|
55 |
* @param anItem the item to set |
|
56 |
*/ |
|
57 |
public void setItem(ClipboardItem anItem) { |
|
58 |
item = anItem; |
|
59 |
} |
|
60 |
|
|
61 |
public boolean hasFolderOrFileItem(){ |
|
62 |
if( item !=null ) |
|
63 |
return item.isFileOrFolder(); |
|
64 |
return false; |
|
65 |
} |
|
66 |
|
|
67 |
public boolean isEmpty(){ |
|
68 |
return item == null; |
|
69 |
} |
|
70 |
|
|
71 |
public void clear(){ |
|
72 |
item = null; |
|
73 |
} |
|
74 |
} |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2011 GRNET S.A. All rights reserved. |
|
3 |
* |
|
4 |
* Redistribution and use in source and binary forms, with or |
|
5 |
* without modification, are permitted provided that the following |
|
6 |
* conditions are met: |
|
7 |
* |
|
8 |
* 1. Redistributions of source code must retain the above |
|
9 |
* copyright notice, this list of conditions and the following |
|
10 |
* disclaimer. |
|
11 |
* |
|
12 |
* 2. Redistributions in binary form must reproduce the above |
|
13 |
* copyright notice, this list of conditions and the following |
|
14 |
* disclaimer in the documentation and/or other materials |
|
15 |
* provided with the distribution. |
|
16 |
* |
|
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
|
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
28 |
* POSSIBILITY OF SUCH DAMAGE. |
|
29 |
* |
|
30 |
* The views and conclusions contained in the software and |
|
31 |
* documentation are those of the authors and should not be |
|
32 |
* interpreted as representing official policies, either expressed |
|
33 |
* or implied, of GRNET S.A. |
|
34 |
*/ |
|
35 |
package gr.grnet.pithos.web.client.clipboard; |
|
36 |
|
|
37 |
import gr.grnet.pithos.web.client.rest.resource.FileResource; |
|
38 |
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper; |
|
39 |
import gr.grnet.pithos.web.client.rest.resource.GroupUserResource; |
|
40 |
|
|
41 |
import java.io.Serializable; |
|
42 |
import java.util.List; |
|
43 |
|
|
44 |
|
|
45 |
public class ClipboardItem implements Serializable{ |
|
46 |
private int operation; |
|
47 |
private FileResource file; |
|
48 |
private List<FileResource> files; |
|
49 |
private RestResourceWrapper folderResource; |
|
50 |
private GroupUserResource user; |
|
51 |
|
|
52 |
public ClipboardItem(int anOperation, List<FileResource> theFiles){ |
|
53 |
operation = anOperation; |
|
54 |
files = theFiles; |
|
55 |
} |
|
56 |
|
|
57 |
public ClipboardItem(int anOperation, FileResource aFile){ |
|
58 |
operation = anOperation; |
|
59 |
file = aFile; |
|
60 |
} |
|
61 |
|
|
62 |
public ClipboardItem(int anOperation, RestResourceWrapper folder){ |
|
63 |
operation = anOperation; |
|
64 |
folderResource = folder; |
|
65 |
} |
|
66 |
public ClipboardItem(int anOperation, GroupUserResource aUser){ |
|
67 |
operation = anOperation; |
|
68 |
user = aUser; |
|
69 |
} |
|
70 |
|
|
71 |
public ClipboardItem(GroupUserResource aUser){ |
|
72 |
operation = Clipboard.COPY; |
|
73 |
user = aUser; |
|
74 |
} |
|
75 |
|
|
76 |
public ClipboardItem(List<FileResource> theFiles){ |
|
77 |
operation = Clipboard.COPY; |
|
78 |
files = theFiles; |
|
79 |
} |
|
80 |
|
|
81 |
public ClipboardItem(FileResource aFile){ |
|
82 |
operation = Clipboard.COPY; |
|
83 |
file = aFile; |
|
84 |
} |
|
85 |
|
|
86 |
public ClipboardItem(RestResourceWrapper folder){ |
|
87 |
operation = Clipboard.COPY; |
|
88 |
folderResource = folder; |
|
89 |
} |
|
90 |
|
|
91 |
/** |
|
92 |
* Retrieve the user. |
|
93 |
* |
|
94 |
* @return the user |
|
95 |
*/ |
|
96 |
public GroupUserResource getUser() { |
|
97 |
return user; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Retrieve the operation. |
|
102 |
* |
|
103 |
* @return the operation |
|
104 |
*/ |
|
105 |
public int getOperation() { |
|
106 |
return operation; |
|
107 |
} |
|
108 |
|
|
109 |
/** |
|
110 |
* Retrieve the file. |
|
111 |
* |
|
112 |
* @return the file |
|
113 |
*/ |
|
114 |
public FileResource getFile() { |
|
115 |
return file; |
|
116 |
} |
|
117 |
|
|
118 |
/** |
|
119 |
* Retrieve the files. |
|
120 |
* |
|
121 |
* @return the files |
|
122 |
*/ |
|
123 |
public List<FileResource> getFiles() { |
|
124 |
return files; |
|
125 |
} |
|
126 |
|
|
127 |
/** |
|
128 |
* checks whether the clipboard item is a file or folder |
|
129 |
*/ |
|
130 |
public boolean isFileOrFolder(){ |
|
131 |
if(file !=null || files != null || folderResource != null) |
|
132 |
return true; |
|
133 |
return false; |
|
134 |
} |
|
135 |
|
|
136 |
/** |
|
137 |
* checks whether the clipboard item is a file (or files) |
|
138 |
*/ |
|
139 |
public boolean isFile() { |
|
140 |
if(file !=null || files != null) |
|
141 |
return true; |
|
142 |
return false; |
|
143 |
} |
|
144 |
|
|
145 |
public boolean isUser(){ |
|
146 |
if( user!=null ) |
|
147 |
return true; |
|
148 |
return false; |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* Retrieve the folderResource. |
|
153 |
* |
|
154 |
* @return the folderResource |
|
155 |
*/ |
|
156 |
public RestResourceWrapper getRestResourceWrapper() { |
|
157 |
return folderResource; |
|
158 |
} |
|
159 |
} |
b/web_client/src/gr/grnet/pithos/web/client/commands/CopyCommand.java | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
package gr.grnet.pithos.web.client.commands; |
36 | 36 |
|
37 |
import gr.grnet.pithos.web.client.Clipboard; |
|
37 | 38 |
import gr.grnet.pithos.web.client.GSS; |
38 |
import gr.grnet.pithos.web.client.clipboard.ClipboardItem; |
|
39 |
import gr.grnet.pithos.web.client.rest.resource.FileResource; |
|
40 |
import gr.grnet.pithos.web.client.rest.resource.GroupUserResource; |
|
41 |
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper; |
|
39 |
import gr.grnet.pithos.web.client.foldertree.File; |
|
40 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
|
42 | 41 |
|
43 | 42 |
import java.util.List; |
44 | 43 |
|
... | ... | |
50 | 49 |
* |
51 | 50 |
*/ |
52 | 51 |
public class CopyCommand implements Command{ |
52 |
private GSS app; |
|
53 | 53 |
private PopupPanel containerPanel; |
54 |
private Object resource; |
|
54 | 55 |
|
55 |
public CopyCommand(PopupPanel _containerPanel){ |
|
56 |
public CopyCommand(GSS _app, PopupPanel _containerPanel, Object _resource){ |
|
57 |
app = _app; |
|
56 | 58 |
containerPanel = _containerPanel; |
59 |
resource = _resource; |
|
57 | 60 |
} |
58 | 61 |
|
59 | 62 |
@Override |
60 | 63 |
public void execute() { |
61 | 64 |
containerPanel.hide(); |
62 |
Object selection = GSS.get().getCurrentSelection(); |
|
63 |
if (selection == null) |
|
64 |
return; |
|
65 | 65 |
|
66 |
if (selection instanceof RestResourceWrapper) { |
|
67 |
ClipboardItem clipboardItem = new ClipboardItem((RestResourceWrapper) selection); |
|
68 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
69 |
} else if (selection instanceof FileResource) { |
|
70 |
ClipboardItem clipboardItem = new ClipboardItem((FileResource) selection); |
|
71 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
72 |
} else if (selection instanceof GroupUserResource) { |
|
73 |
ClipboardItem clipboardItem = new ClipboardItem((GroupUserResource) selection); |
|
74 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
66 |
if (resource instanceof Folder) { |
|
67 |
app.getClipboard().setItem(Clipboard.COPY, (Folder) resource); |
|
68 |
} else if (resource instanceof List) { |
|
69 |
app.getClipboard().setItem(Clipboard.COPY, (List<File>) resource); |
|
75 | 70 |
} |
76 |
else if (selection instanceof List){ |
|
77 |
ClipboardItem clipboardItem = new ClipboardItem((List<FileResource>) selection); |
|
78 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
79 |
} |
|
80 |
|
|
81 | 71 |
} |
82 |
|
|
83 | 72 |
} |
b/web_client/src/gr/grnet/pithos/web/client/commands/CutCommand.java | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
package gr.grnet.pithos.web.client.commands; |
36 | 36 |
|
37 |
import gr.grnet.pithos.web.client.Clipboard; |
|
37 | 38 |
import gr.grnet.pithos.web.client.GSS; |
38 |
import gr.grnet.pithos.web.client.clipboard.Clipboard; |
|
39 |
import gr.grnet.pithos.web.client.clipboard.ClipboardItem; |
|
40 |
import gr.grnet.pithos.web.client.rest.resource.FileResource; |
|
41 |
import gr.grnet.pithos.web.client.rest.resource.GroupUserResource; |
|
42 |
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper; |
|
39 |
import gr.grnet.pithos.web.client.foldertree.File; |
|
43 | 40 |
|
41 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
|
44 | 42 |
import java.util.List; |
45 | 43 |
|
46 |
import com.google.gwt.core.client.GWT; |
|
47 | 44 |
import com.google.gwt.user.client.Command; |
48 | 45 |
import com.google.gwt.user.client.ui.PopupPanel; |
49 | 46 |
|
50 |
|
|
51 | 47 |
/** |
52 | 48 |
* Command for cutting a file, folder or user to GSS Clipboard |
53 | 49 |
* |
54 | 50 |
*/ |
55 |
public class CutCommand implements Command{ |
|
51 |
public class CutCommand implements Command { |
|
52 |
private GSS app; |
|
53 |
|
|
56 | 54 |
private PopupPanel containerPanel; |
57 | 55 |
|
58 |
public CutCommand( PopupPanel _containerPanel ){ |
|
56 |
private Object resource; |
|
57 |
|
|
58 |
public CutCommand(GSS _app, PopupPanel _containerPanel, Object _resource){ |
|
59 |
app = _app; |
|
59 | 60 |
containerPanel = _containerPanel; |
61 |
resource = _resource; |
|
60 | 62 |
} |
61 | 63 |
|
62 | 64 |
@Override |
63 | 65 |
public void execute() { |
64 | 66 |
containerPanel.hide(); |
65 |
Object selection = GSS.get().getCurrentSelection(); |
|
66 |
if (selection == null) |
|
67 |
return; |
|
68 |
GWT.log("selection: " + selection.toString(), null); |
|
69 |
if (selection instanceof RestResourceWrapper) { |
|
70 |
ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (RestResourceWrapper) selection); |
|
71 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
72 |
} else if (selection instanceof FileResource) { |
|
73 |
ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (FileResource) selection); |
|
74 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
75 |
} else if (selection instanceof GroupUserResource) { |
|
76 |
ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (GroupUserResource) selection); |
|
77 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
78 |
} |
|
79 |
else if (selection instanceof List){ |
|
80 |
ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (List<FileResource>) selection); |
|
81 |
GSS.get().getClipboard().setItem(clipboardItem); |
|
82 |
} |
|
83 |
} |
|
84 | 67 |
|
68 |
if (resource instanceof Folder) { |
|
69 |
app.getClipboard().setItem(Clipboard.CUT, (Folder) resource); |
|
70 |
} else if (resource instanceof List) { |
|
71 |
app.getClipboard().setItem(Clipboard.CUT, (List<File>) resource); |
|
72 |
} |
|
73 |
} |
|
85 | 74 |
} |
b/web_client/src/gr/grnet/pithos/web/client/commands/PasteCommand.java | ||
---|---|---|
34 | 34 |
*/ |
35 | 35 |
package gr.grnet.pithos.web.client.commands; |
36 | 36 |
|
37 |
import com.google.gwt.core.client.Scheduler; |
|
38 |
import gr.grnet.pithos.web.client.Clipboard; |
|
37 | 39 |
import gr.grnet.pithos.web.client.GSS; |
38 |
import gr.grnet.pithos.web.client.clipboard.Clipboard; |
|
39 |
import gr.grnet.pithos.web.client.clipboard.ClipboardItem; |
|
40 |
import gr.grnet.pithos.web.client.rest.PostCommand; |
|
40 |
import gr.grnet.pithos.web.client.foldertree.File; |
|
41 |
import gr.grnet.pithos.web.client.foldertree.Folder; |
|
42 |
import gr.grnet.pithos.web.client.foldertree.Resource; |
|
43 |
import gr.grnet.pithos.web.client.rest.PutRequest; |
|
41 | 44 |
import gr.grnet.pithos.web.client.rest.RestException; |
42 |
import gr.grnet.pithos.web.client.rest.resource.FileResource; |
|
43 |
import gr.grnet.pithos.web.client.rest.resource.FolderResource; |
|
44 |
import gr.grnet.pithos.web.client.rest.resource.GroupResource; |
|
45 |
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper; |
|
46 | 45 |
|
47 |
import java.util.ArrayList;
|
|
46 |
import java.util.Iterator;
|
|
48 | 47 |
import java.util.List; |
49 | 48 |
|
50 | 49 |
import com.google.gwt.core.client.GWT; |
51 |
import com.google.gwt.http.client.URL; |
|
52 | 50 |
import com.google.gwt.user.client.Command; |
53 |
import com.google.gwt.user.client.DeferredCommand; |
|
54 | 51 |
import com.google.gwt.user.client.ui.PopupPanel; |
55 | 52 |
|
56 | 53 |
public class PasteCommand implements Command { |
57 | 54 |
|
55 |
private GSS app; |
|
58 | 56 |
private PopupPanel containerPanel; |
57 |
private Folder folder; |
|
59 | 58 |
|
60 |
public PasteCommand(PopupPanel _containerPanel) { |
|
59 |
public PasteCommand(GSS _app, PopupPanel _containerPanel, Folder _folder) { |
|
60 |
app = _app; |
|
61 | 61 |
containerPanel = _containerPanel; |
62 |
folder = _folder; |
|
62 | 63 |
} |
63 | 64 |
|
64 | 65 |
@Override |
65 | 66 |
public void execute() { |
66 | 67 |
containerPanel.hide(); |
67 |
Object selection = GSS.get().getCurrentSelection(); |
|
68 |
FolderResource selectedFolder = null; |
|
69 |
if(selection != null && selection instanceof RestResourceWrapper) |
|
70 |
selectedFolder = ((RestResourceWrapper)selection).getResource(); |
|
71 |
//TODO:CELLTREE |
|
72 |
/* |
|
73 |
else if(GSS.get().getFolders().getCurrent() != null && ((DnDTreeItem)GSS.get().getFolders().getCurrent()).getFolderResource() != null) |
|
74 |
selectedFolder = ((DnDTreeItem)GSS.get().getFolders().getCurrent()).getFolderResource(); |
|
75 |
*/ |
|
76 |
if (selectedFolder != null) { |
|
77 |
final ClipboardItem citem = GSS.get().getClipboard().getItem(); |
|
78 |
if (citem != null && citem.getRestResourceWrapper() != null) { |
|
79 |
String target = selectedFolder.getUri(); |
|
80 |
target = target.endsWith("/") ? target : target + '/'; |
|
81 |
target = target + URL.encodeComponent(citem.getRestResourceWrapper().getResource().getName()); |
|
82 |
if (citem.getOperation() == Clipboard.COPY) { |
|
83 |
PostCommand cf = new PostCommand(citem.getRestResourceWrapper().getUri() + "?copy=" + target, "", 200) { |
|
84 |
|
|
85 |
@Override |
|
86 |
public void onComplete() { |
|
87 |
//TODO:CELLTREE |
|
88 |
//GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent()); |
|
89 |
GSS.get().getTreeView().updateNodeChildren(GSS.get().getTreeView().getSelection()); |
|
90 |
GSS.get().getStatusPanel().updateStats(); |
|
91 |
GSS.get().getClipboard().setItem(null); |
|
92 |
} |
|
93 |
|
|
94 |
@Override |
|
95 |
public void onError(Throwable t) { |
|
96 |
GWT.log("", t); |
|
97 |
if(t instanceof RestException){ |
|
98 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
|
99 |
if(statusCode == 405) |
|
100 |
GSS.get().displayError("You don't have the necessary permissions"); |
|
101 |
|
|
102 |
else if(statusCode == 409) |
|
103 |
GSS.get().displayError("A folder with the same name already exists"); |
|
104 |
else if(statusCode == 413) |
|
105 |
GSS.get().displayError("Your quota has been exceeded"); |
|
106 |
else |
|
107 |
GSS.get().displayError("Unable to copy folder:"+((RestException)t).getHttpStatusText()); |
|
108 |
} |
|
109 |
else |
|
110 |
GSS.get().displayError("System error copying folder:"+t.getMessage()); |
|
111 |
} |
|
112 |
}; |
|
113 |
DeferredCommand.addCommand(cf); |
|
114 |
} else if (citem.getOperation() == Clipboard.CUT) { |
|
115 |
PostCommand cf = new PostCommand(citem.getRestResourceWrapper().getUri() + "?move=" + target, "", 200) { |
|
116 |
|
|
117 |
@Override |
|
118 |
public void onComplete() { |
|
119 |
//TODO:CELLTREE |
|
120 |
/* |
|
121 |
List<TreeItem> items = GSS.get().getFolders().getItemsOfTreeForPath(citem.getFolderResource().getUri()); |
|
122 |
for (TreeItem item : items) |
|
123 |
if (item.getParentItem() != null && !item.equals(GSS.get().getFolders().getCurrent())) |
|
124 |
GSS.get().getFolders().updateFolder((DnDTreeItem) item.getParentItem()); |
|
125 |
GSS.get().getFolders().updateFolder((DnDTreeItem) GSS.get().getFolders().getCurrent()); |
|
126 |
*/ |
|
127 |
GSS.get().getTreeView().updateNodeChildren(GSS.get().getTreeView().getSelection()); |
|
128 |
GSS.get().getTreeView().updateNodeChildrenForRemove(citem.getRestResourceWrapper().getResource().getParentURI()); |
|
129 |
GSS.get().getStatusPanel().updateStats(); |
|
130 |
GSS.get().getClipboard().setItem(null); |
|
131 |
} |
|
132 |
|
|
133 |
@Override |
|
134 |
public void onError(Throwable t) { |
|
135 |
GWT.log("", t); |
|
136 |
if(t instanceof RestException){ |
|
137 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
|
138 |
if(statusCode == 405) |
|
139 |
GSS.get().displayError("You don't have the necessary permissions"); |
|
140 |
else if(statusCode == 409) |
|
141 |
GSS.get().displayError("A folder with the same name already exists"); |
|
142 |
else if(statusCode == 413) |
|
143 |
GSS.get().displayError("Your quota has been exceeded"); |
|
144 |
else |
|
145 |
GSS.get().displayError("Unable to move folder:"+((RestException)t).getHttpStatusText()); |
|
146 |
} |
|
147 |
else |
|
148 |
GSS.get().displayError("System error moving folder:"+t.getMessage()); |
|
149 |
} |
|
150 |
}; |
|
151 |
DeferredCommand.addCommand(cf); |
|
152 |
} |
|
153 |
return; |
|
154 |
} else if (citem != null && citem.getFile() != null) { |
|
155 |
String target = selectedFolder.getUri(); |
|
156 |
target = target.endsWith("/") ? target : target + '/'; |
|
157 |
target = target + URL.encodeComponent(citem.getFile().getName()); |
|
158 |
if (citem.getOperation() == Clipboard.COPY) { |
|
159 |
PostCommand cf = new PostCommand(citem.getFile().getUri() + "?copy=" + target, "", 200) { |
|
160 |
|
|
161 |
@Override |
|
162 |
public void onComplete() { |
|
163 |
GSS.get().showFileList(true); |
|
164 |
GSS.get().getStatusPanel().updateStats(); |
|
165 |
GSS.get().getClipboard().setItem(null); |
|
166 |
} |
|
167 |
|
|
168 |
@Override |
|
169 |
public void onError(Throwable t) { |
|
170 |
GWT.log("", t); |
|
171 |
if(t instanceof RestException){ |
|
172 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
|
173 |
if(statusCode == 405) |
|
174 |
GSS.get().displayError("You don't have the necessary permissions"); |
|
175 |
else if(statusCode == 404) |
|
176 |
GSS.get().displayError("File not found"); |
|
177 |
else if(statusCode == 409) |
|
178 |
GSS.get().displayError("A file with the same name already exists"); |
|
179 |
else if(statusCode == 413) |
|
180 |
GSS.get().displayError("Your quota has been exceeded"); |
|
181 |
else |
|
182 |
GSS.get().displayError("Unable to copy file:"+((RestException)t).getHttpStatusText()); |
|
183 |
} |
|
184 |
else |
|
185 |
GSS.get().displayError("System error copying file:"+t.getMessage()); |
|
186 |
} |
|
187 |
}; |
|
188 |
DeferredCommand.addCommand(cf); |
|
189 |
} else if (citem.getOperation() == Clipboard.CUT) { |
|
190 |
PostCommand cf = new PostCommand(citem.getFile().getUri() + "?move=" + target, "", 200) { |
|
191 |
|
|
192 |
@Override |
|
193 |
public void onComplete() { |
|
194 |
GSS.get().showFileList(true); |
|
195 |
GSS.get().getStatusPanel().updateStats(); |
|
196 |
GSS.get().getClipboard().setItem(null); |
|
197 |
} |
|
198 |
|
|
199 |
@Override |
|
200 |
public void onError(Throwable t) { |
|
201 |
GWT.log("", t); |
|
202 |
if(t instanceof RestException){ |
|
203 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
|
204 |
if(statusCode == 405) |
|
205 |
GSS.get().displayError("You don't have the necessary permissions"); |
|
206 |
else if(statusCode == 404) |
|
207 |
GSS.get().displayError("File not found"); |
|
208 |
else if(statusCode == 409) |
|
209 |
GSS.get().displayError("A file with the same name already exists"); |
|
210 |
else if(statusCode == 413) |
|
211 |
GSS.get().displayError("Your quota has been exceeded"); |
|
212 |
else |
|
213 |
GSS.get().displayError("Unable to copy file:"+((RestException)t).getHttpStatusText()); |
|
214 |
} |
|
215 |
else |
|
216 |
GSS.get().displayError("System error copying file:"+t.getMessage()); |
|
217 |
} |
|
218 |
}; |
|
219 |
DeferredCommand.addCommand(cf); |
|
220 |
} |
|
221 |
return; |
|
222 |
} else if (citem != null && citem.getFiles() != null) { |
|
223 |
List<FileResource> res = citem.getFiles(); |
|
224 |
List<String> fileIds = new ArrayList<String>(); |
|
225 |
String target = selectedFolder.getUri(); |
|
226 |
target = target.endsWith("/") ? target : target + '/'; |
|
227 |
|
|
228 |
if (citem.getOperation() == Clipboard.COPY) { |
|
229 |
for (FileResource fileResource : res) { |
|
230 |
String fileTarget = target + fileResource.getName(); |
|
231 |
fileIds.add(fileResource.getUri() + "?copy=" + fileTarget); |
|
232 |
} |
|
233 |
int index = 0; |
|
234 |
executeCopyOrMove(index, fileIds); |
|
235 |
|
|
236 |
} else if (citem.getOperation() == Clipboard.CUT) { |
|
237 |
for (FileResource fileResource : res) { |
|
238 |
String fileTarget = target + fileResource.getName(); |
|
239 |
fileIds.add(fileResource.getUri() + "?move=" + fileTarget); |
|
240 |
} |
|
241 |
int index = 0; |
|
242 |
executeCopyOrMove(index, fileIds); |
|
243 |
} |
|
244 |
return; |
|
245 |
} |
|
246 |
} |
|
68 |
Object clipboardItem = app.getClipboard().getItem(); |
|
69 |
if (clipboardItem == null) |
|
70 |
return; |
|
71 |
int operation = app.getClipboard().getOperation(); |
|
72 |
if (clipboardItem instanceof Folder) { |
|
73 |
if (operation == Clipboard.COPY) { |
|
74 |
|
|
75 |
} |
|
76 |
else { |
|
77 |
|
|
78 |
} |
|
79 |
} |
|
80 |
else { |
|
81 |
List<File> tobeCopied = (List<File>) clipboardItem; |
|
82 |
Iterator<File> iter = tobeCopied.iterator(); |
|
83 |
if (operation == Clipboard.COPY) { |
|
84 |
copyFiles(iter); |
|
85 |
} |
|
86 |
else { |
|
87 |
moveFiles(iter); |
|
88 |
} |
|
89 |
} |
|
247 | 90 |
} |
248 | 91 |
|
249 |
private void executeCopyOrMove(final int index, final List<String> paths){ |
|
250 |
if(index >= paths.size()){ |
|
251 |
GSS.get().showFileList(true); |
|
252 |
GSS.get().getStatusPanel().updateStats(); |
|
253 |
GSS.get().getClipboard().setItem(null); |
|
254 |
return; |
|
255 |
} |
|
256 |
PostCommand cf = new PostCommand(paths.get(index), "", 200) { |
|
257 |
|
|
258 |
@Override |
|
259 |
public void onComplete() { |
|
260 |
executeCopyOrMove(index+1, paths); |
|
261 |
} |
|
262 |
|
|
263 |
@Override |
|
264 |
public void onError(Throwable t) { |
|
265 |
GWT.log("", t); |
|
266 |
if(t instanceof RestException){ |
|
267 |
int statusCode = ((RestException)t).getHttpStatusCode(); |
|
268 |
if(statusCode == 405) |
|
269 |
GSS.get().displayError("You don't have the necessary permissions"); |
|
270 |
else if(statusCode == 404) |
|
271 |
GSS.get().displayError("File not found"); |
|
272 |
else if(statusCode == 409) |
|
273 |
GSS.get().displayError("A file with the same name already exists"); |
|
274 |
else if(statusCode == 413) |
|
275 |
GSS.get().displayError("Your quota has been exceeded"); |
|
276 |
else |
|
277 |
GSS.get().displayError("Unable to copy file:"+((RestException)t).getHttpStatusText()); |
|
278 |
} |
|
279 |
else |
|
280 |
GSS.get().displayError("System error copying file:"+t.getMessage()); |
|
281 |
} |
|
282 |
}; |
|
283 |
DeferredCommand.addCommand(cf); |
|
284 |
} |
|
92 |
private void moveFiles(final Iterator<File> iter) { |
|
93 |
if (iter.hasNext()) { |
|
94 |
File file = iter.next(); |
|
95 |
String path = app.getApiPath() + app.getUsername() + folder.getUri() + "/" + file.getName(); |
|
96 |
PutRequest copyFile = new PutRequest(path) { |
|
97 |
@Override |
|
98 |
public void onSuccess(Resource result) { |
|
99 |
moveFiles(iter); |
|
100 |
} |
|
101 |
|
|
102 |
@Override |
|
103 |
public void onError(Throwable t) { |
|
104 |
GWT.log("", t); |
|
105 |
if (t instanceof RestException) { |
|
106 |
GSS.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText()); |
|
107 |
} |
|
108 |
else |
|
109 |
GSS.get().displayError("System error unable to copy file: "+t.getMessage()); |
|
110 |
} |
|
111 |
}; |
|
112 |
copyFile.setHeader("X-Auth-Token", app.getToken()); |
|
113 |
copyFile.setHeader("X-Move-From", file.getUri()); |
|
114 |
Scheduler.get().scheduleDeferred(copyFile); |
|
115 |
} |
|
116 |
else { |
|
117 |
app.getClipboard().clear(); |
|
118 |
app.updateFolder(folder); |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
private void copyFiles(final Iterator<File> iter) { |
|
123 |
if (iter.hasNext()) { |
|
124 |
File file = iter.next(); |
|
125 |
String path = app.getApiPath() + app.getUsername() + folder.getUri() + "/" + file.getName(); |
|
126 |
PutRequest copyFile = new PutRequest(path) { |
|
127 |
@Override |
|
128 |
public void onSuccess(Resource result) { |
|
129 |
copyFiles(iter); |
|
130 |
} |
|
131 |
|
|
132 |
@Override |
|
133 |
public void onError(Throwable t) { |
|
134 |
GWT.log("", t); |
|
135 |
if (t instanceof RestException) { |
|
136 |
GSS.get().displayError("Unable to copy file: " + ((RestException) t).getHttpStatusText()); |
|
137 |
} |
|
138 |
else |
|
139 |
GSS.get().displayError("System error unable to copy file: "+t.getMessage()); |
|
140 |
} |
|
141 |
}; |
|
142 |
copyFile.setHeader("X-Auth-Token", app.getToken()); |
|
143 |
copyFile.setHeader("X-Copy-From", file.getUri()); |
|
144 |
Scheduler.get().scheduleDeferred(copyFile); |
|
145 |
} |
|
146 |
else { |
|
147 |
app.getClipboard().clear(); |
|
148 |
app.updateFolder(folder); |
|
149 |
} |
|
150 |
} |
|
285 | 151 |
} |
Also available in: Unified diff