for (var j=0; j<files.length; j++)
files[j].url = path + "/" + files[j].name;
dlg.@gr.grnet.pithos.web.client.FileUploadDialog::setInProgress(Z)(true);
- up.start();
+ if (up.state == $wnd.plupload.STOPPED)
+ up.start();
app.@gr.grnet.pithos.web.client.Pithos::showUploadIndicator()();
if (!dlg.@gr.grnet.pithos.web.client.FileUploadDialog::isVisible()())
- app.@gr.grnet.pithos.web.client.Pithos::showUploadAlert(I)(files.length);
+ app.@gr.grnet.pithos.web.client.Pithos::showUploadAlert(I)(up.files.length);
},
FilesRemoved: function(up, files) {
}
}-*/;
- public void showUploadAlert(int numOfFiles) {
- uploadAlert = new UploadAlert(this, numOfFiles);
- uploadAlert.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
-
- @Override
- public void setPosition(int offsetWidth, int offsetHeight) {
- uploadAlert.setPopupPosition((Window.getClientWidth() - offsetWidth)/2, Window.getClientHeight() - offsetHeight);
- }
- });
+ public void showUploadAlert(int nOfFiles) {
+ if (uploadAlert == null)
+ uploadAlert = new UploadAlert(this, nOfFiles);
+ if (!uploadAlert.isShowing())
+ uploadAlert.setPopupPositionAndShow(new PopupPanel.PositionCallback() {
+
+ @Override
+ public void setPosition(int offsetWidth, int offsetHeight) {
+ uploadAlert.setPopupPosition((Window.getClientWidth() - offsetWidth)/2, Window.getClientHeight() - offsetHeight);
+ }
+ });
+ else
+ uploadAlert.setNumOfFiles(nOfFiles);
}
public void hideUploadAlert() {
*/
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() {
add(content);
}
+
+ public void setNumOfFiles(int n) {
+ label.setText(String.valueOf(n) + " " + (n > 1 ? "files are" : "file is") + " being uploaded");
+ }
}