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.EditMenu.Images;
9 import gr.grnet.pithos.web.client.GSS;
10 import gr.grnet.pithos.web.client.rest.resource.FileResource;
11 import gr.grnet.pithos.web.client.rest.resource.GroupUserResource;
12 import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
14 import java.util.List;
16 import com.google.gwt.core.client.GWT;
17 import com.google.gwt.user.client.Command;
18 import com.google.gwt.user.client.ui.PopupPanel;
22 * Delete selected object command
25 public class DeleteCommand implements Command{
26 private PopupPanel containerPanel;
27 final Images newImages;
30 * @param _containerPanel
31 * @param _newImages the images of all the possible delete dialogs
33 public DeleteCommand( PopupPanel _containerPanel, final Images _newImages ){
34 containerPanel = _containerPanel;
39 public void execute() {
40 containerPanel.hide();
44 * Display the delete dialog, according to the selected object.
48 void displayDelete() {
49 Object selection = GSS.get().getCurrentSelection();
50 if (selection == null)
52 GWT.log("selection: " + selection.toString(), null);
53 if (selection instanceof RestResourceWrapper) {
54 DeleteFolderDialog dlg = new DeleteFolderDialog(newImages);
56 } else if (selection instanceof FileResource || selection instanceof List) {
57 DeleteFileDialog dlg = new DeleteFileDialog(newImages);
59 } else if (selection instanceof GroupUserResource) {
60 // TODO implement user deletion