Removed or commented out various things not related to v.2
[pithos-web-client] / src / gr / grnet / pithos / web / client / commands / DeleteUserOrGroupCommand.java
1 /*
2  *  Copyright (c) 2011 Greek Research and Technology Network
3  */
4 package gr.grnet.pithos.web.client.commands;
5
6 import gr.grnet.pithos.web.client.DeleteGroupDialog;
7 import gr.grnet.pithos.web.client.DeleteUserDialog;
8 import gr.grnet.pithos.web.client.GSS;
9 import gr.grnet.pithos.web.client.Groups.Images;
10 import gr.grnet.pithos.web.client.rest.resource.GroupResource;
11 import gr.grnet.pithos.web.client.rest.resource.GroupUserResource;
12
13 import com.google.gwt.user.client.Command;
14 import com.google.gwt.user.client.ui.PopupPanel;
15
16
17 public class DeleteUserOrGroupCommand implements Command{
18         private PopupPanel containerPanel;
19         final Images images;
20
21         /**
22          * @param aContainerPanel
23          * @param newImages the images of the new folder dialog
24          */
25         public DeleteUserOrGroupCommand(PopupPanel aContainerPanel, final Images newImages){
26                 containerPanel = aContainerPanel;
27                 images = newImages;
28         }
29
30         @Override
31         public void execute() {
32                 containerPanel.hide();
33                 if(GSS.get().getCurrentSelection() instanceof GroupResource)
34                         displayNewGroup();
35                 else if(GSS.get().getCurrentSelection() instanceof GroupUserResource)
36                         displayNewUser();
37                 else
38                         GSS.get().displayError("No user or group selected");
39         }
40
41         void displayNewGroup() {
42                 DeleteGroupDialog dlg = new DeleteGroupDialog(images);
43                 dlg.center();
44         }
45
46         void displayNewUser() {
47                 DeleteUserDialog dlg = new DeleteUserDialog(images);
48                 dlg.center();
49         }
50
51 }