Revision 6b4a2499 web_client/src/gr/grnet/pithos/web/client/commands/CutCommand.java
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 |
} |
Also available in: Unified diff