Statistics
| Branch: | Tag: | Revision:

root / src / gr / grnet / pithos / web / client / UploadAlert.java @ 2ef4bd13

History | View | Annotate | Download (3.9 kB)

1 3646552f Christos Stathis
/*
2 3646552f Christos Stathis
 * Copyright 2011-2012 GRNET S.A. All rights reserved.
3 3646552f Christos Stathis
 *
4 3646552f Christos Stathis
 * Redistribution and use in source and binary forms, with or
5 3646552f Christos Stathis
 * without modification, are permitted provided that the following
6 3646552f Christos Stathis
 * conditions are met:
7 3646552f Christos Stathis
 *
8 3646552f Christos Stathis
 *   1. Redistributions of source code must retain the above
9 3646552f Christos Stathis
 *      copyright notice, this list of conditions and the following
10 3646552f Christos Stathis
 *      disclaimer.
11 3646552f Christos Stathis
 *
12 3646552f Christos Stathis
 *   2. Redistributions in binary form must reproduce the above
13 3646552f Christos Stathis
 *      copyright notice, this list of conditions and the following
14 3646552f Christos Stathis
 *      disclaimer in the documentation and/or other materials
15 3646552f Christos Stathis
 *      provided with the distribution.
16 3646552f Christos Stathis
 *
17 3646552f Christos Stathis
 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
18 3646552f Christos Stathis
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 3646552f Christos Stathis
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 3646552f Christos Stathis
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
21 3646552f Christos Stathis
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 3646552f Christos Stathis
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 3646552f Christos Stathis
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 3646552f Christos Stathis
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 3646552f Christos Stathis
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 3646552f Christos Stathis
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 3646552f Christos Stathis
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 3646552f Christos Stathis
 * POSSIBILITY OF SUCH DAMAGE.
29 3646552f Christos Stathis
 *
30 3646552f Christos Stathis
 * The views and conclusions contained in the software and
31 3646552f Christos Stathis
 * documentation are those of the authors and should not be
32 3646552f Christos Stathis
 * interpreted as representing official policies, either expressed
33 3646552f Christos Stathis
 * or implied, of GRNET S.A.
34 3646552f Christos Stathis
 */
35 3646552f Christos Stathis
package gr.grnet.pithos.web.client;
36 3646552f Christos Stathis
37 3646552f Christos Stathis
import com.google.gwt.event.dom.client.ClickEvent;
38 3646552f Christos Stathis
import com.google.gwt.event.dom.client.ClickHandler;
39 3646552f Christos Stathis
import com.google.gwt.user.client.ui.Anchor;
40 3646552f Christos Stathis
import com.google.gwt.user.client.ui.FlowPanel;
41 3646552f Christos Stathis
import com.google.gwt.user.client.ui.HTML;
42 3646552f Christos Stathis
import com.google.gwt.user.client.ui.Image;
43 3646552f Christos Stathis
import com.google.gwt.user.client.ui.PopupPanel;
44 3646552f Christos Stathis
45 3646552f Christos Stathis
/**
46 3646552f Christos Stathis
 * The 'Folder Context' menu implementation.
47 3646552f Christos Stathis
 */
48 3646552f Christos Stathis
public class UploadAlert extends PopupPanel {
49 3646552f Christos Stathis
        
50 249fbc5b Christos Stathis
        private HTML label = new HTML();
51 249fbc5b Christos Stathis
        
52 3646552f Christos Stathis
        /**
53 3646552f Christos Stathis
         * The widget's constructor.
54 3646552f Christos Stathis
         */
55 249fbc5b Christos Stathis
        public UploadAlert(final Pithos app, int _numOfFiles) {
56 3646552f Christos Stathis
                // The popup's constructor's argument is a boolean specifying that it
57 3646552f Christos Stathis
                // auto-close itself when the user clicks outside of it.
58 3646552f Christos Stathis
                super(false);
59 3646552f Christos Stathis
                addStyleName(Pithos.resources.pithosCss().uploadAlert());
60 3646552f Christos Stathis
                FlowPanel content = new FlowPanel();
61 249fbc5b Christos Stathis
                setNumOfFiles(_numOfFiles);
62 249fbc5b Christos Stathis
                content.add(label);
63 3646552f Christos Stathis
                Anchor a = new Anchor("Click for details");
64 3646552f Christos Stathis
                a.addStyleName(Pithos.resources.pithosCss().uploadAlertLink());
65 3646552f Christos Stathis
                a.addClickHandler(new ClickHandler() {
66 3646552f Christos Stathis
                        
67 3646552f Christos Stathis
                        @Override
68 3646552f Christos Stathis
                        public void onClick(ClickEvent event) {
69 3646552f Christos Stathis
                        app.getFileUploadDialog().center();
70 3646552f Christos Stathis
                        }
71 3646552f Christos Stathis
                });
72 3646552f Christos Stathis
                content.add(a);
73 3646552f Christos Stathis
                Image close = new Image(Pithos.resources.closePopup());
74 3646552f Christos Stathis
                close.addClickHandler(new ClickHandler() {
75 3646552f Christos Stathis
                        
76 3646552f Christos Stathis
                        @Override
77 3646552f Christos Stathis
                        public void onClick(ClickEvent event) {
78 3646552f Christos Stathis
                                hide();
79 3646552f Christos Stathis
                        }
80 3646552f Christos Stathis
                });
81 3646552f Christos Stathis
                close.addStyleName(Pithos.resources.pithosCss().uploadAlertClose());
82 3646552f Christos Stathis
                content.add(close);
83 c4818b9d Christos Stathis
                
84 c4818b9d Christos Stathis
                FlowPanel progress = new FlowPanel();
85 c4818b9d Christos Stathis
                progress.addStyleName("plupload_progress");
86 c4818b9d Christos Stathis
                progress.addStyleName(Pithos.resources.pithosCss().uploadAlertProgress());
87 c4818b9d Christos Stathis
                FlowPanel progress_container = new FlowPanel();
88 c4818b9d Christos Stathis
                progress_container.addStyleName("plupload_progress_container");
89 c4818b9d Christos Stathis
                progress.add(progress_container);
90 c4818b9d Christos Stathis
                FlowPanel progress_bar = new FlowPanel();
91 c4818b9d Christos Stathis
                progress_bar.getElement().setId("upload_alert_progress_bar");
92 c4818b9d Christos Stathis
                progress_bar.addStyleName("plupload_progress_bar");
93 c4818b9d Christos Stathis
                progress_container.add(progress_bar);
94 c4818b9d Christos Stathis
                content.add(progress);
95 c4818b9d Christos Stathis
96 c4818b9d Christos Stathis
                HTML percent = new HTML();
97 c4818b9d Christos Stathis
                percent.getElement().setId("upload_alert_percent");
98 c4818b9d Christos Stathis
                percent.addStyleName(Pithos.resources.pithosCss().uploadAlertPercent());
99 c4818b9d Christos Stathis
                content.add(percent);
100 c4818b9d Christos Stathis
                
101 3646552f Christos Stathis
                add(content);
102 3646552f Christos Stathis
        }
103 249fbc5b Christos Stathis
        
104 249fbc5b Christos Stathis
        public void setNumOfFiles(int n) {
105 249fbc5b Christos Stathis
                label.setText(String.valueOf(n) + " " + (n > 1 ? "files are" : "file is") + " being uploaded");
106 249fbc5b Christos Stathis
        }
107 3646552f Christos Stathis
}