2 * Copyright 2008, 2009 Electronic Business Systems Ltd.
4 * This file is part of GSS.
6 * GSS is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GSS. If not, see <http://www.gnu.org/licenses/>.
19 package gr.ebs.gss.client.commands;
21 import gr.ebs.gss.client.DeleteFileDialog;
22 import gr.ebs.gss.client.DeleteFolderDialog;
23 import gr.ebs.gss.client.DeleteGroupDialog;
24 import gr.ebs.gss.client.EditMenu.Images;
25 import gr.ebs.gss.client.GSS;
26 import gr.ebs.gss.client.rest.resource.FileResource;
27 import gr.ebs.gss.client.rest.resource.FolderResource;
28 import gr.ebs.gss.client.rest.resource.GroupResource;
29 import gr.ebs.gss.client.rest.resource.GroupUserResource;
30 import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
32 import java.util.List;
34 import com.google.gwt.core.client.GWT;
35 import com.google.gwt.user.client.Command;
36 import com.google.gwt.user.client.ui.PopupPanel;
40 * Delete selected object command
44 public class DeleteCommand implements Command{
45 private PopupPanel containerPanel;
46 final Images newImages;
49 * @param _containerPanel
50 * @param _newImages the images of all the possible delete dialogs
52 public DeleteCommand( PopupPanel _containerPanel, final Images _newImages ){
53 containerPanel = _containerPanel;
58 public void execute() {
59 containerPanel.hide();
63 * Display the delete dialog, according to the selected object.
67 void displayDelete() {
68 Object selection = GSS.get().getCurrentSelection();
69 if (selection == null)
71 GWT.log("selection: " + selection.toString(), null);
72 if (selection instanceof RestResourceWrapper) {
73 DeleteFolderDialog dlg = new DeleteFolderDialog(newImages);
75 } else if (selection instanceof FileResource || selection instanceof List) {
76 DeleteFileDialog dlg = new DeleteFileDialog(newImages);
78 } else if (selection instanceof GroupUserResource) {
79 // TODO implement user deletion
80 } else if (selection instanceof GroupResource) {
81 DeleteGroupDialog dlg = new DeleteGroupDialog(newImages);