Statistics
| Branch: | Tag: | Revision:

root / src / gr / grnet / pithos / web / client / FileUploadDialog.java @ bdda6b2f

History | View | Annotate | Download (11.2 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;
36 a57faaf0 Christos Stathis
37 bdda6b2f Christos Stathis
import com.google.gwt.core.client.Scheduler;
38 bdda6b2f Christos Stathis
import com.google.gwt.http.client.Response;
39 bdda6b2f Christos Stathis
import gr.grnet.pithos.web.client.foldertree.File;
40 bdda6b2f Christos Stathis
import gr.grnet.pithos.web.client.foldertree.Folder;
41 bdda6b2f Christos Stathis
import gr.grnet.pithos.web.client.foldertree.Resource;
42 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.GetCommand;
43 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.PostCommand;
44 bdda6b2f Christos Stathis
import gr.grnet.pithos.web.client.rest.PutRequest;
45 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.RestCommand;
46 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.RestException;
47 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.FileResource;
48 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.FolderResource;
49 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
50 a57faaf0 Christos Stathis
import gr.grnet.pithos.web.client.rest.resource.UploadStatusResource;
51 a57faaf0 Christos Stathis
52 a57faaf0 Christos Stathis
import java.util.ArrayList;
53 a57faaf0 Christos Stathis
import java.util.List;
54 a57faaf0 Christos Stathis
55 a57faaf0 Christos Stathis
import com.google.gwt.core.client.GWT;
56 a57faaf0 Christos Stathis
import com.google.gwt.dom.client.NativeEvent;
57 a57faaf0 Christos Stathis
import com.google.gwt.event.dom.client.ClickEvent;
58 a57faaf0 Christos Stathis
import com.google.gwt.event.dom.client.ClickHandler;
59 a57faaf0 Christos Stathis
import com.google.gwt.event.dom.client.KeyCodes;
60 a57faaf0 Christos Stathis
import com.google.gwt.http.client.URL;
61 a57faaf0 Christos Stathis
import com.google.gwt.json.client.JSONObject;
62 a57faaf0 Christos Stathis
import com.google.gwt.json.client.JSONString;
63 a57faaf0 Christos Stathis
import com.google.gwt.user.client.DeferredCommand;
64 a57faaf0 Christos Stathis
import com.google.gwt.user.client.Event.NativePreviewEvent;
65 a57faaf0 Christos Stathis
import com.google.gwt.user.client.Timer;
66 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.Button;
67 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.DialogBox;
68 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.FileUpload;
69 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.FormPanel;
70 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
71 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
72 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
73 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.FormPanel.SubmitHandler;
74 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.Grid;
75 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.HTML;
76 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
77 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.Hidden;
78 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.HorizontalPanel;
79 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.Label;
80 a57faaf0 Christos Stathis
import com.google.gwt.user.client.ui.VerticalPanel;
81 bdda6b2f Christos Stathis
import javax.xml.transform.Templates;
82 a57faaf0 Christos Stathis
83 a57faaf0 Christos Stathis
/**
84 a57faaf0 Christos Stathis
 * The 'File upload' dialog box implementation.
85 a57faaf0 Christos Stathis
 */
86 bdda6b2f Christos Stathis
public class FileUploadDialog extends DialogBox {
87 a57faaf0 Christos Stathis
88 bdda6b2f Christos Stathis
    public static final boolean DONE = true;
89 a57faaf0 Christos Stathis
90 a57faaf0 Christos Stathis
        /**
91 a57faaf0 Christos Stathis
         * The Form element that performs the file upload.
92 a57faaf0 Christos Stathis
         */
93 a57faaf0 Christos Stathis
        private final FormPanel form = new FormPanel();
94 a57faaf0 Christos Stathis
95 a57faaf0 Christos Stathis
        private final FileUpload upload = new FileUpload();
96 a57faaf0 Christos Stathis
97 bdda6b2f Christos Stathis
        private final Label filenameLabel = new Label();
98 a57faaf0 Christos Stathis
99 bdda6b2f Christos Stathis
    private final Label foldernameLabel = new Label();
100 a57faaf0 Christos Stathis
101 bdda6b2f Christos Stathis
    private Button submit;
102 a57faaf0 Christos Stathis
103 bdda6b2f Christos Stathis
        protected Folder folder;
104 a57faaf0 Christos Stathis
105 bdda6b2f Christos Stathis
    protected GSS app;
106 a57faaf0 Christos Stathis
107 a57faaf0 Christos Stathis
        /**
108 a57faaf0 Christos Stathis
         * The widget's constructor.
109 a57faaf0 Christos Stathis
         */
110 a57faaf0 Christos Stathis
        public FileUploadDialog() {
111 a57faaf0 Christos Stathis
                // Set the dialog's caption.
112 a57faaf0 Christos Stathis
                setText("File upload");
113 a57faaf0 Christos Stathis
                setAnimationEnabled(true);
114 a57faaf0 Christos Stathis
                // Since we're going to add a FileUpload widget, we'll need to set the
115 a57faaf0 Christos Stathis
                // form to use the POST method, and multipart MIME encoding.
116 a57faaf0 Christos Stathis
                form.setEncoding(FormPanel.ENCODING_MULTIPART);
117 a57faaf0 Christos Stathis
                form.setMethod(FormPanel.METHOD_POST);
118 a57faaf0 Christos Stathis
119 a57faaf0 Christos Stathis
                // Create a panel to hold all of the form widgets.
120 a57faaf0 Christos Stathis
                VerticalPanel panel = new VerticalPanel();
121 a57faaf0 Christos Stathis
                form.setWidget(panel);
122 a57faaf0 Christos Stathis
                final HTML info = new HTML("You may select a file to upload. Install" +
123 a57faaf0 Christos Stathis
                                " <a href='http://gears.google.com/' target='_blank'>Google " +
124 a57faaf0 Christos Stathis
                                "Gears</a><br> for uploading multiple files simultaneously.");
125 a57faaf0 Christos Stathis
                info.addStyleName("pithos-uploadNote");
126 a57faaf0 Christos Stathis
                panel.add(info);
127 bdda6b2f Christos Stathis
128 bdda6b2f Christos Stathis
        final Hidden auth = new Hidden("X-Auth-Token", "");
129 bdda6b2f Christos Stathis
        panel.add(auth);
130 a57faaf0 Christos Stathis
                upload.setName("file");
131 a57faaf0 Christos Stathis
                filenameLabel.setText("");
132 a57faaf0 Christos Stathis
                filenameLabel.setVisible(false);
133 a57faaf0 Christos Stathis
                filenameLabel.setStyleName("props-labels");
134 bdda6b2f Christos Stathis
                HorizontalPanel fileUploadPanel = new HorizontalPanel();
135 bdda6b2f Christos Stathis
                fileUploadPanel.add(filenameLabel);
136 bdda6b2f Christos Stathis
                fileUploadPanel.add(upload);
137 a57faaf0 Christos Stathis
                Grid generalTable = new Grid(2, 2);
138 a57faaf0 Christos Stathis
                generalTable.setText(0, 0, "Folder");
139 bdda6b2f Christos Stathis
        generalTable.setWidget(0, 1, foldernameLabel);
140 a57faaf0 Christos Stathis
                generalTable.setText(1, 0, "File");
141 bdda6b2f Christos Stathis
                generalTable.setWidget(1, 1, fileUploadPanel);
142 a57faaf0 Christos Stathis
                generalTable.getCellFormatter().setStyleName(0, 0, "props-labels");
143 bdda6b2f Christos Stathis
        generalTable.getCellFormatter().setStyleName(0, 1, "props-values");
144 a57faaf0 Christos Stathis
                generalTable.getCellFormatter().setStyleName(1, 0, "props-labels");
145 a57faaf0 Christos Stathis
                generalTable.getCellFormatter().setStyleName(1, 1, "props-values");
146 a57faaf0 Christos Stathis
                generalTable.setCellSpacing(4);
147 a57faaf0 Christos Stathis
148 a57faaf0 Christos Stathis
                panel.add(generalTable);
149 a57faaf0 Christos Stathis
150 a57faaf0 Christos Stathis
                // Create a panel to hold the buttons.
151 a57faaf0 Christos Stathis
                HorizontalPanel buttons = new HorizontalPanel();
152 a57faaf0 Christos Stathis
153 a57faaf0 Christos Stathis
                // Create the 'upload' button, along with a listener that submits the
154 a57faaf0 Christos Stathis
                // form.
155 bdda6b2f Christos Stathis
                submit = new Button("Upload", new ClickHandler() {
156 a57faaf0 Christos Stathis
                        @Override
157 a57faaf0 Christos Stathis
                        public void onClick(ClickEvent event) {
158 a57faaf0 Christos Stathis
                                prepareAndSubmit();
159 a57faaf0 Christos Stathis
                        }
160 a57faaf0 Christos Stathis
                });
161 a57faaf0 Christos Stathis
                buttons.add(submit);
162 a57faaf0 Christos Stathis
                buttons.setCellHorizontalAlignment(submit, HasHorizontalAlignment.ALIGN_CENTER);
163 a57faaf0 Christos Stathis
                // Create the 'Cancel' button, along with a listener that hides the
164 a57faaf0 Christos Stathis
                // dialog when the button is clicked.
165 a57faaf0 Christos Stathis
                final Button cancel = new Button("Cancel", new ClickHandler() {
166 a57faaf0 Christos Stathis
                        @Override
167 a57faaf0 Christos Stathis
                        public void onClick(ClickEvent event) {
168 a57faaf0 Christos Stathis
                                hide();
169 a57faaf0 Christos Stathis
                        }
170 a57faaf0 Christos Stathis
                });
171 a57faaf0 Christos Stathis
                buttons.add(cancel);
172 a57faaf0 Christos Stathis
                buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
173 a57faaf0 Christos Stathis
                buttons.setSpacing(8);
174 a57faaf0 Christos Stathis
                buttons.addStyleName("pithos-DialogBox");
175 bdda6b2f Christos Stathis
        panel.add(buttons);
176 bdda6b2f Christos Stathis
        panel.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
177 a57faaf0 Christos Stathis
178 a57faaf0 Christos Stathis
                // Add an event handler to the form.
179 a57faaf0 Christos Stathis
                form.addSubmitHandler(new SubmitHandler() {
180 a57faaf0 Christos Stathis
181 a57faaf0 Christos Stathis
                        @Override
182 a57faaf0 Christos Stathis
                        public void onSubmit(SubmitEvent event) {
183 bdda6b2f Christos Stathis
                auth.setValue(app.getToken()); //This is done here because the app object is not available in the constructor
184 a57faaf0 Christos Stathis
                        }
185 a57faaf0 Christos Stathis
                });
186 a57faaf0 Christos Stathis
                form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
187 a57faaf0 Christos Stathis
188 a57faaf0 Christos Stathis
                        @Override
189 a57faaf0 Christos Stathis
                        public void onSubmitComplete(SubmitCompleteEvent event) {
190 a57faaf0 Christos Stathis
                                // When the form submission is successfully completed, this
191 a57faaf0 Christos Stathis
                                // event is fired. Assuming the service returned a response
192 a57faaf0 Christos Stathis
                                // of type text/html, we can get the result text here (see
193 a57faaf0 Christos Stathis
                                // the FormPanel documentation for further explanation).
194 a57faaf0 Christos Stathis
                                String results = event.getResults();
195 a57faaf0 Christos Stathis
196 a57faaf0 Christos Stathis
                                // Unfortunately the results are never empty, even in
197 a57faaf0 Christos Stathis
                                // the absense of errors, so we have to check for '<pre></pre>'.
198 bdda6b2f Christos Stathis
                                if (results != null && !results.equalsIgnoreCase("<pre></pre>")) {
199 a57faaf0 Christos Stathis
                                        GWT.log(results, null);
200 bdda6b2f Christos Stathis
                                        app.displayError(results);
201 a57faaf0 Christos Stathis
                                }
202 bdda6b2f Christos Stathis
                app.updateFolder(folder);
203 bdda6b2f Christos Stathis
                                hide();
204 a57faaf0 Christos Stathis
                        }
205 a57faaf0 Christos Stathis
                });
206 a57faaf0 Christos Stathis
207 a57faaf0 Christos Stathis
208 a57faaf0 Christos Stathis
                panel.addStyleName("pithos-DialogBox");
209 a57faaf0 Christos Stathis
                addStyleName("pithos-DialogBox");
210 a57faaf0 Christos Stathis
                setWidget(form);
211 a57faaf0 Christos Stathis
        }
212 a57faaf0 Christos Stathis
213 a57faaf0 Christos Stathis
        @Override
214 a57faaf0 Christos Stathis
        protected void onPreviewNativeEvent(NativePreviewEvent preview) {
215 a57faaf0 Christos Stathis
                super.onPreviewNativeEvent(preview);
216 a57faaf0 Christos Stathis
217 a57faaf0 Christos Stathis
                NativeEvent evt = preview.getNativeEvent();
218 a57faaf0 Christos Stathis
                if (evt.getType().equals("keydown"))
219 a57faaf0 Christos Stathis
                        // Use the popup's key preview hooks to close the dialog when either
220 a57faaf0 Christos Stathis
                        // enter or escape is pressed.
221 a57faaf0 Christos Stathis
                        switch (evt.getKeyCode()) {
222 a57faaf0 Christos Stathis
                                case KeyCodes.KEY_ENTER:
223 a57faaf0 Christos Stathis
                                        prepareAndSubmit();
224 a57faaf0 Christos Stathis
                                        break;
225 a57faaf0 Christos Stathis
                                case KeyCodes.KEY_ESCAPE:
226 bdda6b2f Christos Stathis
                                        hide();
227 a57faaf0 Christos Stathis
                                        break;
228 a57faaf0 Christos Stathis
                        }
229 a57faaf0 Christos Stathis
        }
230 a57faaf0 Christos Stathis
231 a57faaf0 Christos Stathis
        /**
232 a57faaf0 Christos Stathis
         * Make any last minute checks and start the upload.
233 a57faaf0 Christos Stathis
         */
234 bdda6b2f Christos Stathis
        protected void prepareAndSubmit() {
235 bdda6b2f Christos Stathis
        if (upload.getFilename().length() == 0) {
236 bdda6b2f Christos Stathis
            app.displayError("You must select a file!");
237 bdda6b2f Christos Stathis
            return;
238 bdda6b2f Christos Stathis
        }
239 bdda6b2f Christos Stathis
        final String fname = getFilename(upload.getFilename());
240 bdda6b2f Christos Stathis
        String apath = app.getApiPath() + app.getUsername() + folder.getUri() + "/" + fname;
241 bdda6b2f Christos Stathis
        form.setAction(apath);
242 bdda6b2f Christos Stathis
        submit.setEnabled(false);
243 bdda6b2f Christos Stathis
        upload.setVisible(false);
244 bdda6b2f Christos Stathis
        filenameLabel.setText(fname);
245 bdda6b2f Christos Stathis
        filenameLabel.setVisible(true);
246 bdda6b2f Christos Stathis
247 a57faaf0 Christos Stathis
                if (getFileForName(fname) == null) {
248 bdda6b2f Christos Stathis
                        doUpload(apath);
249 a57faaf0 Christos Stathis
                }
250 a57faaf0 Christos Stathis
                else {
251 a57faaf0 Christos Stathis
                        // We are going to update an existing file, so show a confirmation dialog.
252 a57faaf0 Christos Stathis
                        ConfirmationDialog confirm = new ConfirmationDialog("Are you sure " +
253 a57faaf0 Christos Stathis
                                        "you want to update " + fname + "?", "Update") {
254 a57faaf0 Christos Stathis
255 a57faaf0 Christos Stathis
                                @Override
256 a57faaf0 Christos Stathis
                                public void cancel() {
257 a57faaf0 Christos Stathis
                                        FileUploadDialog.this.hide();
258 a57faaf0 Christos Stathis
                                }
259 a57faaf0 Christos Stathis
260 a57faaf0 Christos Stathis
                                @Override
261 a57faaf0 Christos Stathis
                                public void confirm() {
262 a57faaf0 Christos Stathis
                                        form.submit();
263 a57faaf0 Christos Stathis
                                }
264 a57faaf0 Christos Stathis
265 a57faaf0 Christos Stathis
                        };
266 a57faaf0 Christos Stathis
                        confirm.center();
267 a57faaf0 Christos Stathis
                }
268 a57faaf0 Christos Stathis
        }
269 a57faaf0 Christos Stathis
270 bdda6b2f Christos Stathis
    private void doUpload(String path) {
271 bdda6b2f Christos Stathis
        PutRequest createFile = new PutRequest(path) {
272 bdda6b2f Christos Stathis
            @Override
273 bdda6b2f Christos Stathis
            public void onSuccess(Resource result) {
274 bdda6b2f Christos Stathis
                form.submit();
275 bdda6b2f Christos Stathis
            }
276 bdda6b2f Christos Stathis
277 bdda6b2f Christos Stathis
            @Override
278 bdda6b2f Christos Stathis
            public void onError(Throwable t) {
279 bdda6b2f Christos Stathis
                GWT.log("", t);
280 bdda6b2f Christos Stathis
                if (t instanceof RestException) {
281 bdda6b2f Christos Stathis
                    app.displayError("Unable to create file:" + ((RestException) t).getHttpStatusText());
282 bdda6b2f Christos Stathis
                }
283 bdda6b2f Christos Stathis
                else
284 bdda6b2f Christos Stathis
                    app.displayError("System error creating file:" + t.getMessage());
285 bdda6b2f Christos Stathis
            }
286 bdda6b2f Christos Stathis
        };
287 bdda6b2f Christos Stathis
        createFile.setHeader("X-Auth-Token", app.getToken());
288 bdda6b2f Christos Stathis
        createFile.setHeader("Content-Length", "0");
289 bdda6b2f Christos Stathis
        Scheduler.get().scheduleDeferred(createFile);
290 bdda6b2f Christos Stathis
    }
291 bdda6b2f Christos Stathis
292 bdda6b2f Christos Stathis
    /**
293 a57faaf0 Christos Stathis
         * Returns the file name from a potential full path argument. Apparently IE
294 a57faaf0 Christos Stathis
         * insists on sending the full path name of a file when uploading, forcing
295 a57faaf0 Christos Stathis
         * us to trim the extra path info. Since this is only observed on Windows we
296 a57faaf0 Christos Stathis
         * get to check for a single path separator value.
297 a57faaf0 Christos Stathis
         *
298 a57faaf0 Christos Stathis
         * @param name the potentially full path name of a file
299 a57faaf0 Christos Stathis
         * @return the file name without extra path information
300 a57faaf0 Christos Stathis
         */
301 a57faaf0 Christos Stathis
        protected String getFilename(String name) {
302 a57faaf0 Christos Stathis
                int pathSepIndex = name.lastIndexOf("\\");
303 a57faaf0 Christos Stathis
                if (pathSepIndex == -1) {
304 a57faaf0 Christos Stathis
                        pathSepIndex = name.lastIndexOf("/");
305 a57faaf0 Christos Stathis
                        if (pathSepIndex == -1)
306 a57faaf0 Christos Stathis
                                return name;
307 a57faaf0 Christos Stathis
                }
308 a57faaf0 Christos Stathis
                return name.substring(pathSepIndex + 1);
309 a57faaf0 Christos Stathis
        }
310 a57faaf0 Christos Stathis
311 bdda6b2f Christos Stathis
        protected File getFileForName(String name){
312 bdda6b2f Christos Stathis
                for (File f : folder.getFiles())
313 bdda6b2f Christos Stathis
                        if (!f.isInTrash() && f.getName().equals(name))
314 a57faaf0 Christos Stathis
                                return f;
315 a57faaf0 Christos Stathis
                return null;
316 a57faaf0 Christos Stathis
        }
317 a57faaf0 Christos Stathis
318 bdda6b2f Christos Stathis
    public void setApp(GSS app) {
319 bdda6b2f Christos Stathis
        this.app = app;
320 bdda6b2f Christos Stathis
    }
321 a57faaf0 Christos Stathis
322 bdda6b2f Christos Stathis
    public void setFolder(Folder folder) {
323 bdda6b2f Christos Stathis
        this.folder = folder;
324 bdda6b2f Christos Stathis
        foldernameLabel.setText(folder.getName());
325 bdda6b2f Christos Stathis
    }
326 a57faaf0 Christos Stathis
}