root / src / gr / ebs / gss / client / commands / CutCommand.java @ 9ab5db6d
History | View | Annotate | Download (2.4 kB)
1 | 14ad7326 | pastith | /*
|
---|---|---|---|
2 | 14ad7326 | pastith | * Copyright 2008, 2009 Electronic Business Systems Ltd.
|
3 | 14ad7326 | pastith | *
|
4 | 14ad7326 | pastith | * This file is part of GSS.
|
5 | 14ad7326 | pastith | *
|
6 | 14ad7326 | pastith | * GSS is free software: you can redistribute it and/or modify
|
7 | 14ad7326 | pastith | * it under the terms of the GNU General Public License as published by
|
8 | 14ad7326 | pastith | * the Free Software Foundation, either version 3 of the License, or
|
9 | 14ad7326 | pastith | * (at your option) any later version.
|
10 | 14ad7326 | pastith | *
|
11 | 14ad7326 | pastith | * GSS is distributed in the hope that it will be useful,
|
12 | 14ad7326 | pastith | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 14ad7326 | pastith | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | 14ad7326 | pastith | * GNU General Public License for more details.
|
15 | 14ad7326 | pastith | *
|
16 | 14ad7326 | pastith | * You should have received a copy of the GNU General Public License
|
17 | 14ad7326 | pastith | * along with GSS. If not, see <http://www.gnu.org/licenses/>.
|
18 | 14ad7326 | pastith | */
|
19 | 14ad7326 | pastith | package gr.ebs.gss.client.commands; |
20 | 14ad7326 | pastith | |
21 | 14ad7326 | pastith | import gr.ebs.gss.client.GSS; |
22 | 14ad7326 | pastith | import gr.ebs.gss.client.clipboard.Clipboard; |
23 | 14ad7326 | pastith | import gr.ebs.gss.client.clipboard.ClipboardItem; |
24 | a52ea5e4 | pastith | import gr.ebs.gss.client.rest.resource.FileResource; |
25 | a52ea5e4 | pastith | import gr.ebs.gss.client.rest.resource.FolderResource; |
26 | a52ea5e4 | pastith | import gr.ebs.gss.client.rest.resource.GroupUserResource; |
27 | 14ad7326 | pastith | |
28 | 14ad7326 | pastith | import java.util.List; |
29 | 14ad7326 | pastith | |
30 | 14ad7326 | pastith | import com.google.gwt.core.client.GWT; |
31 | 14ad7326 | pastith | import com.google.gwt.user.client.Command; |
32 | 14ad7326 | pastith | import com.google.gwt.user.client.ui.PopupPanel; |
33 | 14ad7326 | pastith | |
34 | 14ad7326 | pastith | |
35 | 14ad7326 | pastith | /**
|
36 | 14ad7326 | pastith | * Command for cutting a file, folder or user to GSS Clipboard
|
37 | 14ad7326 | pastith | * @author kman
|
38 | 14ad7326 | pastith | *
|
39 | 14ad7326 | pastith | */
|
40 | 14ad7326 | pastith | public class CutCommand implements Command{ |
41 | 14ad7326 | pastith | private PopupPanel containerPanel;
|
42 | 14ad7326 | pastith | |
43 | 14ad7326 | pastith | public CutCommand( PopupPanel _containerPanel ){
|
44 | 14ad7326 | pastith | containerPanel = _containerPanel; |
45 | 14ad7326 | pastith | } |
46 | 023f6f1e | Panagiotis Astithas | |
47 | 023f6f1e | Panagiotis Astithas | @Override
|
48 | 14ad7326 | pastith | public void execute() { |
49 | 14ad7326 | pastith | containerPanel.hide(); |
50 | 14ad7326 | pastith | Object selection = GSS.get().getCurrentSelection();
|
51 | 14ad7326 | pastith | if (selection == null) |
52 | 14ad7326 | pastith | return;
|
53 | 14ad7326 | pastith | GWT.log("selection: " + selection.toString(), null); |
54 | a52ea5e4 | pastith | if (selection instanceof FolderResource) { |
55 | a52ea5e4 | pastith | ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (FolderResource) selection); |
56 | 14ad7326 | pastith | GSS.get().getClipboard().setItem(clipboardItem); |
57 | a52ea5e4 | pastith | } else if (selection instanceof FileResource) { |
58 | a52ea5e4 | pastith | ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (FileResource) selection); |
59 | 14ad7326 | pastith | GSS.get().getClipboard().setItem(clipboardItem); |
60 | a52ea5e4 | pastith | } else if (selection instanceof GroupUserResource) { |
61 | a52ea5e4 | pastith | ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (GroupUserResource) selection); |
62 | 14ad7326 | pastith | GSS.get().getClipboard().setItem(clipboardItem); |
63 | 14ad7326 | pastith | } |
64 | 14ad7326 | pastith | else if (selection instanceof List){ |
65 | a52ea5e4 | pastith | ClipboardItem clipboardItem = new ClipboardItem(Clipboard.CUT, (List<FileResource>) selection); |
66 | 14ad7326 | pastith | GSS.get().getClipboard().setItem(clipboardItem); |
67 | 14ad7326 | pastith | } |
68 | 14ad7326 | pastith | } |
69 | 14ad7326 | pastith | |
70 | 14ad7326 | pastith | } |