When a file is dropped while another is uploading the alert is updated to show the...
[pithos-web-client] / src / gr / grnet / pithos / web / client / UploadAlert.java
index 5cffa45..5616a77 100644 (file)
@@ -47,18 +47,20 @@ import com.google.gwt.user.client.ui.PopupPanel;
  */
 public class UploadAlert extends PopupPanel {
        
+       private HTML label = new HTML();
+       
        /**
         * The widget's constructor.
         */
-       public UploadAlert(final Pithos app, int numOfFiles) {
+       public UploadAlert(final Pithos app, int _numOfFiles) {
                // The popup's constructor's argument is a boolean specifying that it
                // auto-close itself when the user clicks outside of it.
                super(false);
                setAnimationEnabled(true);
                addStyleName(Pithos.resources.pithosCss().uploadAlert());
                FlowPanel content = new FlowPanel();
-               String label = String.valueOf(numOfFiles) + " " + (numOfFiles > 1 ? "files are" : "file is") + " being uploaded";
-               content.add(new HTML(label));
+               setNumOfFiles(_numOfFiles);
+               content.add(label);
                Anchor a = new Anchor("Click for details");
                a.addStyleName(Pithos.resources.pithosCss().uploadAlertLink());
                a.addClickHandler(new ClickHandler() {
@@ -79,6 +81,28 @@ public class UploadAlert extends PopupPanel {
                });
                close.addStyleName(Pithos.resources.pithosCss().uploadAlertClose());
                content.add(close);
+               
+               FlowPanel progress = new FlowPanel();
+               progress.addStyleName("plupload_progress");
+               progress.addStyleName(Pithos.resources.pithosCss().uploadAlertProgress());
+               FlowPanel progress_container = new FlowPanel();
+               progress_container.addStyleName("plupload_progress_container");
+               progress.add(progress_container);
+               FlowPanel progress_bar = new FlowPanel();
+               progress_bar.getElement().setId("upload_alert_progress_bar");
+               progress_bar.addStyleName("plupload_progress_bar");
+               progress_container.add(progress_bar);
+               content.add(progress);
+
+               HTML percent = new HTML();
+               percent.getElement().setId("upload_alert_percent");
+               percent.addStyleName(Pithos.resources.pithosCss().uploadAlertPercent());
+               content.add(percent);
+               
                add(content);
        }
+       
+       public void setNumOfFiles(int n) {
+               label.setText(String.valueOf(n) + " " + (n > 1 ? "files are" : "file is") + " being uploaded");
+       }
 }