2 * Copyright (c) 2011 Greek Research and Technology Network
4 package gr.grnet.pithos.web.client.commands;
6 import gr.grnet.pithos.web.client.DeleteFileDialog;
7 import gr.grnet.pithos.web.client.DeleteFolderDialog;
8 import gr.grnet.pithos.web.client.DeleteGroupDialog;
9 import gr.grnet.pithos.web.client.EditMenu.Images;
10 import gr.grnet.pithos.web.client.GSS;
11 import gr.grnet.pithos.web.client.rest.resource.FileResource;
12 import gr.grnet.pithos.web.client.rest.resource.GroupResource;
13 import gr.grnet.pithos.web.client.rest.resource.GroupUserResource;
14 import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
16 import java.util.List;
18 import com.google.gwt.core.client.GWT;
19 import com.google.gwt.user.client.Command;
20 import com.google.gwt.user.client.ui.PopupPanel;
24 * Delete selected object command
27 public class DeleteCommand implements Command{
28 private PopupPanel containerPanel;
29 final Images newImages;
32 * @param _containerPanel
33 * @param _newImages the images of all the possible delete dialogs
35 public DeleteCommand( PopupPanel _containerPanel, final Images _newImages ){
36 containerPanel = _containerPanel;
41 public void execute() {
42 containerPanel.hide();
46 * Display the delete dialog, according to the selected object.
50 void displayDelete() {
51 Object selection = GSS.get().getCurrentSelection();
52 if (selection == null)
54 GWT.log("selection: " + selection.toString(), null);
55 if (selection instanceof RestResourceWrapper) {
56 DeleteFolderDialog dlg = new DeleteFolderDialog(newImages);
58 } else if (selection instanceof FileResource || selection instanceof List) {
59 DeleteFileDialog dlg = new DeleteFileDialog(newImages);
61 } else if (selection instanceof GroupUserResource) {
62 // TODO implement user deletion
63 } else if (selection instanceof GroupResource) {
64 DeleteGroupDialog dlg = new DeleteGroupDialog(newImages);