root / src / gr / grnet / pithos / web / client / commands / CreateGroupCommand.java @ 3ebb88f4
History | View | Annotate | Download (2.7 kB)
1 | d5c6298f | Christos Stathis | /*
|
---|---|---|---|
2 | d5c6298f | Christos Stathis | * Copyright 2011 GRNET S.A. All rights reserved.
|
3 | d5c6298f | Christos Stathis | *
|
4 | d5c6298f | Christos Stathis | * Redistribution and use in source and binary forms, with or
|
5 | d5c6298f | Christos Stathis | * without modification, are permitted provided that the following
|
6 | d5c6298f | Christos Stathis | * conditions are met:
|
7 | d5c6298f | Christos Stathis | *
|
8 | d5c6298f | Christos Stathis | * 1. Redistributions of source code must retain the above
|
9 | d5c6298f | Christos Stathis | * copyright notice, this list of conditions and the following
|
10 | d5c6298f | Christos Stathis | * disclaimer.
|
11 | d5c6298f | Christos Stathis | *
|
12 | d5c6298f | Christos Stathis | * 2. Redistributions in binary form must reproduce the above
|
13 | d5c6298f | Christos Stathis | * copyright notice, this list of conditions and the following
|
14 | d5c6298f | Christos Stathis | * disclaimer in the documentation and/or other materials
|
15 | d5c6298f | Christos Stathis | * provided with the distribution.
|
16 | d5c6298f | Christos Stathis | *
|
17 | d5c6298f | Christos Stathis | * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
|
18 | d5c6298f | Christos Stathis | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19 | d5c6298f | Christos Stathis | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
20 | d5c6298f | Christos Stathis | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
|
21 | d5c6298f | Christos Stathis | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22 | d5c6298f | Christos Stathis | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23 | d5c6298f | Christos Stathis | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
24 | d5c6298f | Christos Stathis | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
25 | d5c6298f | Christos Stathis | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
26 | d5c6298f | Christos Stathis | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
27 | d5c6298f | Christos Stathis | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 | d5c6298f | Christos Stathis | * POSSIBILITY OF SUCH DAMAGE.
|
29 | d5c6298f | Christos Stathis | *
|
30 | d5c6298f | Christos Stathis | * The views and conclusions contained in the software and
|
31 | d5c6298f | Christos Stathis | * documentation are those of the authors and should not be
|
32 | d5c6298f | Christos Stathis | * interpreted as representing official policies, either expressed
|
33 | d5c6298f | Christos Stathis | * or implied, of GRNET S.A.
|
34 | d5c6298f | Christos Stathis | */
|
35 | 4baffab1 | Christos Stathis | package gr.grnet.pithos.web.client.commands; |
36 | d5c6298f | Christos Stathis | |
37 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.Pithos; |
38 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.foldertree.Resource; |
39 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.grouptree.Group; |
40 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.rest.PostRequest; |
41 | 4baffab1 | Christos Stathis | import gr.grnet.pithos.web.client.rest.RestException; |
42 | d5c6298f | Christos Stathis | |
43 | 4baffab1 | Christos Stathis | import com.google.gwt.core.client.GWT; |
44 | 4baffab1 | Christos Stathis | import com.google.gwt.core.client.Scheduler; |
45 | 4baffab1 | Christos Stathis | import com.google.gwt.user.client.Command; |
46 | 4baffab1 | Christos Stathis | import com.google.gwt.user.client.Window; |
47 | 4baffab1 | Christos Stathis | import com.google.gwt.user.client.ui.PopupPanel; |
48 | d5c6298f | Christos Stathis | |
49 | 4baffab1 | Christos Stathis | /**
|
50 | 4baffab1 | Christos Stathis | * Display the 'new folder' dialog for creating a new folder.
|
51 | 4baffab1 | Christos Stathis | *
|
52 | 4baffab1 | Christos Stathis | */
|
53 | 4baffab1 | Christos Stathis | public class CreateGroupCommand implements Command { |
54 | 4baffab1 | Christos Stathis | private PopupPanel containerPanel;
|
55 | d5c6298f | Christos Stathis | |
56 | 4baffab1 | Christos Stathis | Pithos app; |
57 | d5c6298f | Christos Stathis | |
58 | 4baffab1 | Christos Stathis | /**
|
59 | 4baffab1 | Christos Stathis | * @param aContainerPanel
|
60 | 4baffab1 | Christos Stathis | */
|
61 | 4baffab1 | Christos Stathis | public CreateGroupCommand(Pithos _app, PopupPanel aContainerPanel){
|
62 | 4baffab1 | Christos Stathis | app = _app; |
63 | 4baffab1 | Christos Stathis | containerPanel = aContainerPanel; |
64 | 4baffab1 | Christos Stathis | } |
65 | d5c6298f | Christos Stathis | |
66 | 4baffab1 | Christos Stathis | @Override
|
67 | 4baffab1 | Christos Stathis | public void execute() { |
68 | 4baffab1 | Christos Stathis | if (containerPanel != null) |
69 | 4baffab1 | Christos Stathis | containerPanel.hide(); |
70 | 4baffab1 | Christos Stathis | String groupname = Window.prompt("Enter group name:", ""); |
71 | 4baffab1 | Christos Stathis | if (groupname != null && groupname.length() > 0) { |
72 | 4baffab1 | Christos Stathis | app.addGroup(groupname); |
73 | 4baffab1 | Christos Stathis | } |
74 | 4baffab1 | Christos Stathis | } |
75 | d5c6298f | Christos Stathis | } |