429: Workspace: uploading big files
Task-Url: https://support.d4science.org/issues/429 Fixed css to msg multiple file upload Fixed bug on cancel upload git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@119654 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0d02c0b4d2
commit
12f2c82ced
|
@ -111,7 +111,7 @@ public class DialogUpload extends ClosableDialog implements HasWorskpaceUploadNo
|
|||
hpBottom.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
|
||||
if(uploadType.equals(UPLOAD_TYPE.File)){
|
||||
HTML msg = new HTML("To select multiple files, press and hold down the Ctrl key, and then click each item <br/> that you want to select");
|
||||
HTML msg = new HTML("<span>To select multiple files, press and hold down the Ctrl key,</span><span style='dispaly:block; margin-top:-5px'> and then click each item that you want to select</span>");
|
||||
msg.getElement().getStyle().setFontSize(10, Unit.PX);
|
||||
hpBottom.add(msg);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ public class UploaderProgressView {
|
|||
private HTML html = new HTML();
|
||||
private ProgressBar bar = new ProgressBar();
|
||||
private HandlerManager eventBus;
|
||||
private boolean cancel = false;
|
||||
private Image cancelImg = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new uploader progress view.
|
||||
|
@ -44,6 +46,9 @@ public class UploaderProgressView {
|
|||
*/
|
||||
public UploaderProgressView(WorkspaceUploaderItem uploader, final String fileName, HandlerManager eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
cancelImg = WorkspaceUploaderResources.getImageCancel();
|
||||
cancelImg.setTitle("Cancel upload");
|
||||
cancelImg.addStyleName("cancel-upload");
|
||||
|
||||
String text = "<div><img src='"+WorkspaceUploaderResources.getImageLoading().getUrl()+"'>";
|
||||
String msg = StringUtil.ellipsize("Uploading "+fileName, MAX_CHARS, 0);
|
||||
|
@ -66,7 +71,6 @@ public class UploaderProgressView {
|
|||
* @param uploader the uploader
|
||||
*/
|
||||
public void update(WorkspaceUploaderItem uploader){
|
||||
|
||||
String text;
|
||||
switch(uploader.getUploadStatus()){
|
||||
case COMPLETED:
|
||||
|
@ -76,11 +80,12 @@ public class UploaderProgressView {
|
|||
html.setHTML(text);
|
||||
html.setTitle(uploader.getStatusDescription());
|
||||
bar.update(uploader.getUploadProgress().getLastEvent().getReadPercentage());
|
||||
try{
|
||||
hp.remove(cancelImg);
|
||||
}catch (Exception e) {}
|
||||
try{
|
||||
vp.remove(bar);
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}catch (Exception e) {}
|
||||
break;
|
||||
case FAILED:
|
||||
text = "<div><img src='"+WorkspaceUploaderResources.getImageFailed().getUrl()+"'>";
|
||||
|
@ -92,14 +97,18 @@ public class UploaderProgressView {
|
|||
break;
|
||||
case IN_PROGRESS:
|
||||
text = "<div><img src='"+WorkspaceUploaderResources.getImageUpload().getUrl()+"'>";
|
||||
String msg = StringUtil.ellipsize(uploader.getUploadProgress().getLastEvent().getReadPercentage()+"% "+uploader.getFile().getFileName(), MAX_CHARS, 0);
|
||||
String msg = StringUtil.ellipsize(uploader.getFile().getFileName(), MAX_CHARS, 0);
|
||||
text+="<span style='margin-left:5px; vertical-align: top;'>"+msg+"</span>";
|
||||
text+="</div>";
|
||||
// GWT.log(text);
|
||||
html.setHTML(text);
|
||||
html.setTitle(uploader.getStatusDescription());
|
||||
if(uploader.getUploadProgress().getLastEvent().getReadPercentage()!=100)
|
||||
|
||||
if(uploader.getUploadProgress().getLastEvent().getReadPercentage()!=100 && !cancel){
|
||||
cancel = true;
|
||||
hp.add(handleCancelUpload(uploader));
|
||||
}
|
||||
|
||||
bar.update(uploader.getUploadProgress().getLastEvent().getReadPercentage());
|
||||
break;
|
||||
case WAIT:
|
||||
|
@ -135,10 +144,7 @@ public class UploaderProgressView {
|
|||
*/
|
||||
private Image handleCancelUpload(final WorkspaceUploaderItem uploader){
|
||||
|
||||
Image cancel = WorkspaceUploaderResources.getImageCancel();
|
||||
cancel.setTitle("Cancel upload");
|
||||
cancel.addStyleName("cancel-upload");
|
||||
cancel.addClickHandler(new ClickHandler() {
|
||||
cancelImg.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
@ -156,7 +162,7 @@ public class UploaderProgressView {
|
|||
}
|
||||
}
|
||||
});
|
||||
return cancel;
|
||||
return cancelImg;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue