Ongoing on File Upload

This commit is contained in:
francesco 2020-10-02 17:14:21 +02:00
parent 26230f7e9f
commit 8486bf0089
4 changed files with 13 additions and 40 deletions

View File

@ -48,13 +48,9 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
* Sep 11, 2015
*/
private HTML LOADING = new HTML("Upload starting...");
protected String parentIdentifier = "";
protected VerticalPanel panel;
private HorizontalPanel hpBottom;
// private MonitorPanel monitorPanel;
protected String clientUploadKey;
private Anchor anchorMyUploads;
/**
* Instantiates a new dialog upload stream.
@ -67,7 +63,6 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
//setWidth("400px");
fileUpload = new FileUpload();
//fileUpload.getElement().setAttribute("multiple", "multiple");
this.addStyleName("fileInputUploader");
setAction(ConstantsMPFormBuilder.WORKSPACE_UPLOADER_SERVLET_STREAM__MODIFIED);
setEncoding(FormPanel.ENCODING_MULTIPART);
setMethod(FormPanel.METHOD_POST);
@ -92,27 +87,7 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
hp.getElement().getStyle().setMarginTop(5, Unit.PX);
hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
panel.add(hp);
// hpBottom = new HorizontalPanel();
// hpBottom.setWidth("100%");
//// hpBottom.getElement().getStyle().setMarginTop(5, Unit.PX);
// hpBottom.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
//
// //if(uploadType.equals(UPLOAD_TYPE.File)){
//// HTML msg = new HTML("<p>To select multiple files, press and hold down the Ctrl key, and then</p><p style='margin:-3px 0;'>click each item that you want to select</p>");
//// msg.getElement().getStyle().setFontSize(10, Unit.PX);
//// hpBottom.add(msg);
// //}
//
// HorizontalPanel hp2 = new HorizontalPanel();
// hp2.getElement().getStyle().setMarginTop(5, Unit.PX);
//// hp2.getElement().getStyle().setWidth(100, Unit.PCT);
// hp2.addStyleName("align-right-close");
//
// hpBottom.add(hp2);
// panel.add(hpBottom);
}
/**

View File

@ -18,7 +18,7 @@ public class FileUpload extends Composite {
public FileUpload() {
initWidget(uiBinder.createAndBindUi(this));
fileUploadPanel.add(new DialogUpload());
fileUploadPanel.add(new MultipleDilaogUpload());
}
}

View File

@ -1,11 +1,18 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel ui:field="fileUploadPanel">
<g:HTMLPanel>
<b:ControlGroup>
<b:ControlLabel>File:</b:ControlLabel>
<b:Controls>
<g:HTMLPanel ui:field="fileUploadPanel"></g:HTMLPanel>
</b:Controls>
</b:ControlGroup>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -59,7 +59,7 @@ public class MultipleDilaogUpload extends DialogUpload {
* @param parentId the parent id
* @return the list
*/
public void generateFakeUploaders(String filesSelected, String parentId) {
public void generateFakeUploaders(String filesSelected) {
if(filesSelected==null || filesSelected.isEmpty())
return;
@ -82,21 +82,13 @@ public class MultipleDilaogUpload extends DialogUpload {
fakeItem.setUploadStatus(UPLOAD_STATUS.WAIT);
WorkspaceUploadFile fakeFile = new WorkspaceUploadFile();
fakeFile.setFileName(files[i]);
fakeFile.setParentId(parentId);
fakeItem.setFile(fakeFile);
fakeUploaders.add(fakeItem);
}
GWT.log("fakeUploaders generated: "+fakeUploaders.toString());
// return fakeUploaders;
}
/*
* (non-Javadoc)
*
* @see org.gcube.portlets.widgets.workspaceuploader.client.uploader.
* DialogUploadStream#addHandlers()
*/
@Override
protected void addHandlers() {
@ -165,8 +157,7 @@ public class MultipleDilaogUpload extends DialogUpload {
@Override
public void onChange(ChangeEvent event) {
GWT.log("browse return...");
if (fileUpload.getFilename() == null
|| fileUpload.getFilename().isEmpty()) {
if (fileUpload.getFilename() == null || fileUpload.getFilename().isEmpty()) {
GWT.log("No file specified ");
//MultipleDilaogUpload.this.hide();
return;
@ -182,7 +173,7 @@ public class MultipleDilaogUpload extends DialogUpload {
return;
// GENERATE NEW UPLOADERS
generateFakeUploaders(filesSelected, parentIdentifier);
generateFakeUploaders(filesSelected);
GWT.log(fakeUploaders.toString());
createJsonKeyForFiles();
GWT.log(jsonKeys);