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;
31 import java.util.List;
33 import com.google.gwt.core.client.GWT;
34 import com.google.gwt.user.client.Command;
35 import com.google.gwt.user.client.ui.PopupPanel;
39 * Delete selected object command
43 public class DeleteCommand implements Command{
44 private PopupPanel containerPanel;
45 final Images newImages;
48 * @param _containerPanel
49 * @param _newImages the images of all the possible delete dialogs
51 public DeleteCommand( PopupPanel _containerPanel, final Images _newImages ){
52 containerPanel = _containerPanel;
57 public void execute() {
58 containerPanel.hide();
62 * Display the delete dialog, according to the selected object.
66 void displayDelete() {
67 Object selection = GSS.get().getCurrentSelection();
68 if (selection == null)
70 GWT.log("selection: " + selection.toString(), null);
71 if (selection instanceof FolderResource) {
72 DeleteFolderDialog dlg = new DeleteFolderDialog(newImages);
74 } else if (selection instanceof FileResource || selection instanceof List) {
75 DeleteFileDialog dlg = new DeleteFileDialog(newImages);
77 } else if (selection instanceof GroupUserResource) {
78 // TODO implement user deletion
79 } else if (selection instanceof GroupResource) {
80 DeleteGroupDialog dlg = new DeleteGroupDialog(newImages);