Attach button disabled during progress upload

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@122571 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-01-27 16:49:48 +00:00
parent c7d0deca1b
commit 75fd148cea
1 changed files with 21 additions and 28 deletions

View File

@ -1,5 +1,4 @@
package org.gcube.portlets.user.shareupdates.client.view;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@ -26,7 +25,6 @@ import org.jsonmaker.gwt.client.Jsonizer;
import com.github.gwtbootstrap.client.ui.Button;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.BorderStyle;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.FontWeight;
@ -82,7 +80,7 @@ public class ShareUpdateForm extends Composite {
private static final String DELETE_LINK_PREVIEW = "The link preview will be removed. Would you like to continue?";
private static final String DELETE_ATTACHMENTS = "The attachment(s) will be removed. Would you like to continue?";
private static final String TOO_MUCH_ATTACHMENT_ALERT = "Sorry, but you cannot upload more than " + MAX_NUMBER_ATTACHMENTS + " attachments!";
private static final String WAIT_CURRENT_UPLOAD_FINISHING = "Please, wait the current upload to finish";
// image urls
public static final String loading = GWT.getModuleBaseURL() + "../images/avatarLoader.gif";
public static final String avatar_default = GWT.getModuleBaseURL() + "../images/Avatar_default.png";
@ -310,26 +308,21 @@ public class ShareUpdateForm extends Composite {
}
// check if an upload is happening
if(uploadProgress.isVisible()){
Window.alert(WAIT_CURRENT_UPLOAD_FINISHING);
return;
}
// proceed with the upload
FileUpload up = uploadProgress.initialize();
up.setVisible(false);
fileBrowse(up.getElement());
uploadProgress.setVisible(true);
attachButton.setEnabled(false);
// open the fileupload
up.click();
}
/**
* this simulates the click on the hidden native GWT FileUpload Button
* @param el
*/
public static native void fileBrowse(Element el) /*-{
el.click();
}-*/;
@UiHandler("submitButton")
void onClick(ClickEvent e) {