root / web_client / src / gr / grnet / pithos / web / client / commands / PropertiesCommand.java @ f55cf326
History | View | Annotate | Download (3.9 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 | ab1eb3f8 | Christos Stathis | import gr.grnet.pithos.web.client.FileMenu; |
38 | ab1eb3f8 | Christos Stathis | import gr.grnet.pithos.web.client.FilePropertiesDialog; |
39 | ab1eb3f8 | Christos Stathis | import gr.grnet.pithos.web.client.FilesPropertiesDialog; |
40 | ab1eb3f8 | Christos Stathis | import gr.grnet.pithos.web.client.FolderPropertiesDialog; |
41 | f55cf326 | Christos Stathis | import gr.grnet.pithos.web.client.Pithos; |
42 | 50326f36 | Christos Stathis | import gr.grnet.pithos.web.client.foldertree.File; |
43 | 50326f36 | Christos Stathis | import gr.grnet.pithos.web.client.foldertree.Folder; |
44 | ab1eb3f8 | Christos Stathis | import gr.grnet.pithos.web.client.rest.resource.FileResource; |
45 | ab1eb3f8 | Christos Stathis | import gr.grnet.pithos.web.client.rest.resource.GroupResource; |
46 | ab1eb3f8 | Christos Stathis | |
47 | ab1eb3f8 | Christos Stathis | import java.util.List; |
48 | ab1eb3f8 | Christos Stathis | |
49 | ab1eb3f8 | Christos Stathis | import com.google.gwt.user.client.Command; |
50 | ab1eb3f8 | Christos Stathis | import com.google.gwt.user.client.ui.PopupPanel; |
51 | ab1eb3f8 | Christos Stathis | |
52 | ab1eb3f8 | Christos Stathis | /**
|
53 | ab1eb3f8 | Christos Stathis | * The command that displays the appropriate Properties dialog, according to the
|
54 | ab1eb3f8 | Christos Stathis | * selected object in the application.
|
55 | ab1eb3f8 | Christos Stathis | *
|
56 | ab1eb3f8 | Christos Stathis | */
|
57 | ab1eb3f8 | Christos Stathis | public class PropertiesCommand implements Command { |
58 | ab1eb3f8 | Christos Stathis | |
59 | ab1eb3f8 | Christos Stathis | final FileMenu.Images newImages;
|
60 | ab1eb3f8 | Christos Stathis | |
61 | ab1eb3f8 | Christos Stathis | private PopupPanel containerPanel;
|
62 | ab1eb3f8 | Christos Stathis | |
63 | ab1eb3f8 | Christos Stathis | private List<GroupResource> groups = null; |
64 | ab1eb3f8 | Christos Stathis | |
65 | ab1eb3f8 | Christos Stathis | private List<FileResource> versions = null; |
66 | ab1eb3f8 | Christos Stathis | |
67 | ab1eb3f8 | Christos Stathis | private int tabToShow = 0; |
68 | ab1eb3f8 | Christos Stathis | |
69 | ab1eb3f8 | Christos Stathis | private String userName; |
70 | ab1eb3f8 | Christos Stathis | |
71 | 50326f36 | Christos Stathis | private Object resource; |
72 | 50326f36 | Christos Stathis | |
73 | f55cf326 | Christos Stathis | private Pithos app;
|
74 | 50326f36 | Christos Stathis | |
75 | ab1eb3f8 | Christos Stathis | /**
|
76 | ab1eb3f8 | Christos Stathis | * @param _containerPanel
|
77 | ab1eb3f8 | Christos Stathis | * @param _newImages the images of all the possible delete dialogs
|
78 | ab1eb3f8 | Christos Stathis | * @param _tab the tab to switch to
|
79 | ab1eb3f8 | Christos Stathis | */
|
80 | f55cf326 | Christos Stathis | public PropertiesCommand(Pithos _app, PopupPanel _containerPanel, Object _resource, final FileMenu.Images _newImages, int _tab) { |
81 | ab1eb3f8 | Christos Stathis | containerPanel = _containerPanel; |
82 | ab1eb3f8 | Christos Stathis | newImages = _newImages; |
83 | ab1eb3f8 | Christos Stathis | tabToShow = _tab; |
84 | 50326f36 | Christos Stathis | resource = _resource; |
85 | 50326f36 | Christos Stathis | app = _app; |
86 | ab1eb3f8 | Christos Stathis | } |
87 | ab1eb3f8 | Christos Stathis | |
88 | ab1eb3f8 | Christos Stathis | @Override
|
89 | ab1eb3f8 | Christos Stathis | public void execute() { |
90 | 50326f36 | Christos Stathis | if (containerPanel != null) |
91 | 50326f36 | Christos Stathis | containerPanel.hide(); |
92 | 50326f36 | Christos Stathis | |
93 | 50326f36 | Christos Stathis | if (resource instanceof Folder) { |
94 | 50326f36 | Christos Stathis | Folder folder = (Folder) resource; |
95 | 50326f36 | Christos Stathis | FolderPropertiesDialog dlg = new FolderPropertiesDialog(app, false, folder); |
96 | 50326f36 | Christos Stathis | dlg.selectTab(tabToShow); |
97 | 50326f36 | Christos Stathis | dlg.center(); |
98 | 50326f36 | Christos Stathis | } |
99 | 50326f36 | Christos Stathis | else if (resource instanceof List) { |
100 | 50326f36 | Christos Stathis | List<File> files = (List<File>) resource; |
101 | 50326f36 | Christos Stathis | if (files.size() > 1) { |
102 | feeaebc3 | Christos Stathis | FilesPropertiesDialog dlg = new FilesPropertiesDialog(app, files);
|
103 | feeaebc3 | Christos Stathis | dlg.selectTab(tabToShow); |
104 | feeaebc3 | Christos Stathis | dlg.center(); |
105 | 50326f36 | Christos Stathis | } |
106 | 50326f36 | Christos Stathis | else {
|
107 | 50326f36 | Christos Stathis | FilePropertiesDialog dlg = new FilePropertiesDialog(app, files.get(0)); |
108 | 50326f36 | Christos Stathis | dlg.selectTab(tabToShow); |
109 | 50326f36 | Christos Stathis | dlg.center(); |
110 | 50326f36 | Christos Stathis | } |
111 | 50326f36 | Christos Stathis | } |
112 | ab1eb3f8 | Christos Stathis | } |
113 | ab1eb3f8 | Christos Stathis | } |