Statistics
| Branch: | Tag: | Revision:

root / src / gr / grnet / pithos / web / client / commands / NewFolderCommand.java @ 4123152d

History | View | Annotate | Download (3.4 kB)

1 a57faaf0 Christos Stathis
/*
2 63366925 Christos Stathis
 * Copyright 2011 GRNET S.A. All rights reserved.
3 63366925 Christos Stathis
 *
4 63366925 Christos Stathis
 * Redistribution and use in source and binary forms, with or
5 63366925 Christos Stathis
 * without modification, are permitted provided that the following
6 63366925 Christos Stathis
 * conditions are met:
7 63366925 Christos Stathis
 *
8 63366925 Christos Stathis
 *   1. Redistributions of source code must retain the above
9 63366925 Christos Stathis
 *      copyright notice, this list of conditions and the following
10 63366925 Christos Stathis
 *      disclaimer.
11 63366925 Christos Stathis
 *
12 63366925 Christos Stathis
 *   2. Redistributions in binary form must reproduce the above
13 63366925 Christos Stathis
 *      copyright notice, this list of conditions and the following
14 63366925 Christos Stathis
 *      disclaimer in the documentation and/or other materials
15 63366925 Christos Stathis
 *      provided with the distribution.
16 63366925 Christos Stathis
 *
17 63366925 Christos Stathis
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18 63366925 Christos Stathis
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 63366925 Christos Stathis
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 63366925 Christos Stathis
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21 63366925 Christos Stathis
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 63366925 Christos Stathis
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 63366925 Christos Stathis
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 63366925 Christos Stathis
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 63366925 Christos Stathis
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 63366925 Christos Stathis
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 63366925 Christos Stathis
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 63366925 Christos Stathis
 * POSSIBILITY OF SUCH DAMAGE.
29 63366925 Christos Stathis
 *
30 63366925 Christos Stathis
 * The views and conclusions contained in the software and
31 63366925 Christos Stathis
 * documentation are those of the authors and should not be
32 63366925 Christos Stathis
 * interpreted as representing official policies, either expressed
33 63366925 Christos Stathis
 * or implied, of GRNET S.A.
34 a57faaf0 Christos Stathis
 */
35 a57faaf0 Christos Stathis
package gr.grnet.pithos.web.client.commands;
36 a57faaf0 Christos Stathis
37 447407c8 Christos Stathis
import com.google.gwt.event.logical.shared.CloseEvent;
38 447407c8 Christos Stathis
import com.google.gwt.event.logical.shared.CloseHandler;
39 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.FileMenu.Images;
40 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.FolderPropertiesDialog;
41 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.GSS;
42 447407c8 Christos Stathis
import gr.grnet.pithos.web.client.foldertree.Folder;
43 447407c8 Christos Stathis
import gr.grnet.pithos.web.client.foldertree.FolderTreeView;
44 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.GetCommand;
45 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.MultipleGetCommand;
46 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.GroupResource;
47 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.GroupsResource;
48 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.RestResource;
49 a57faaf0 Christos Stathis
50 a57faaf0 Christos Stathis
import java.util.ArrayList;
51 a57faaf0 Christos Stathis
import java.util.List;
52 a57faaf0 Christos Stathis
53 a57faaf0 Christos Stathis
import com.google.gwt.core.client.GWT;
54 a57faaf0 Christos Stathis
import com.google.gwt.user.client.Command;
55 a57faaf0 Christos Stathis
import com.google.gwt.user.client.DeferredCommand;
56 a57faaf0 Christos Stathis
import com.google.gwt.user.client.IncrementalCommand;
57 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.PopupPanel;
58 a57faaf0 Christos Stathis
59 a57faaf0 Christos Stathis
/**
60 a57faaf0 Christos Stathis
 * Display the 'new folder' dialog for creating a new folder.
61 a57faaf0 Christos Stathis
 *
62 a57faaf0 Christos Stathis
 */
63 a57faaf0 Christos Stathis
public class NewFolderCommand implements Command{
64 a57faaf0 Christos Stathis
        private PopupPanel containerPanel;
65 447407c8 Christos Stathis
66 447407c8 Christos Stathis
    private Folder folder;
67 a57faaf0 Christos Stathis
        final Images images;
68 a57faaf0 Christos Stathis
69 a57faaf0 Christos Stathis
        private List<GroupResource> groups = null;
70 a57faaf0 Christos Stathis
71 a57faaf0 Christos Stathis
        /**
72 a57faaf0 Christos Stathis
         * @param aContainerPanel
73 a57faaf0 Christos Stathis
         * @param newImages the images of the new folder dialog
74 a57faaf0 Christos Stathis
         */
75 447407c8 Christos Stathis
        public NewFolderCommand(PopupPanel aContainerPanel, Folder folder, final Images newImages){
76 a57faaf0 Christos Stathis
                containerPanel = aContainerPanel;
77 a57faaf0 Christos Stathis
                images=newImages;
78 447407c8 Christos Stathis
        this.folder = folder;
79 a57faaf0 Christos Stathis
        }
80 a57faaf0 Christos Stathis
81 a57faaf0 Christos Stathis
        @Override
82 a57faaf0 Christos Stathis
        public void execute() {
83 fad48f0d Christos Stathis
        if (containerPanel != null)
84 fad48f0d Christos Stathis
                    containerPanel.hide();
85 447407c8 Christos Stathis
        displayNewFolderDialog();
86 a57faaf0 Christos Stathis
        }
87 a57faaf0 Christos Stathis
88 447407c8 Christos Stathis
        void displayNewFolderDialog() {
89 447407c8 Christos Stathis
        if (folder != null) {
90 b651e67f Christos Stathis
            FolderPropertiesDialog dlg = new FolderPropertiesDialog(GSS.get(), true, folder);
91 447407c8 Christos Stathis
            dlg.center();
92 447407c8 Christos Stathis
        }
93 a57faaf0 Christos Stathis
        }
94 a57faaf0 Christos Stathis
}