Statistics
| Branch: | Tag: | Revision:

root / web_client / src / gr / grnet / pithos / web / client / commands / NewFolderCommand.java @ d94eb987

History | View | Annotate | Download (2.7 kB)

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