From a352933b68d3f0bbc69d7b747973fcabf12d424c Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 28 Mar 2023 16:13:21 +0200 Subject: [PATCH] managing the files already uploaded [#24515] --- .../form/generic/CreateMetadataForm.java | 28 ++++++---- .../form/generic/UploadedFilesBrowse.java | 51 ++++++++++--------- .../shared/GenericDatasetBean.java | 10 ++-- .../shared/upload/FileUploaded.java | 47 ----------------- .../shared/upload/FileUploadedRemote.java | 25 +++++++-- 5 files changed, 72 insertions(+), 89 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java index 6652b26..8884abc 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java @@ -267,6 +267,13 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe private OPERATION operationPerfom; + /** + * The Enum OPERATION. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Mar 15, 2023 + */ public enum OPERATION { NEW, UPDATE } @@ -318,7 +325,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe } /** - * Instantiates a new creates the dataset form. + * Instantiates a new creates the metadata form. * * @param profiles the profiles * @param eventBus the event bus @@ -326,7 +333,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe * @param listFileUploaded the list file uploaded */ public CreateMetadataForm(List profiles, HandlerManager eventBus, OPERATION operation, - List listFileUploaded) { + List listFileUploaded) { this(eventBus); this.operationPerfom = operation; showLoadingProfiles(true); @@ -345,8 +352,8 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe /** * Instantiates a new creates the dataset form. - * - * @param eventBus2 + * + * @param eventBus the event bus */ private CreateMetadataForm(HandlerManager eventBus) { initWidget(uiBinder.createAndBindUi(this)); @@ -407,7 +414,8 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe * @param profiles the profiles * @param listFileUploaded the list file uploaded */ - private void createDatasetFormBody(final List profiles, List listFileUploaded) { + private void createDatasetFormBody(final List profiles, + List listFileUploaded) { if (profiles == null) { setAlertBlock("An unknow error occurred while retrieving types, sorry", AlertType.ERROR, true); @@ -424,7 +432,8 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe * @param profiles the profiles * @param listFileUploaded the file uploaded */ - private void prepareMetadataList(final List profiles, List listFileUploaded) { + private void prepareMetadataList(final List profiles, + List listFileUploaded) { if (profiles != null && !profiles.isEmpty()) { GWT.log("Building form/s for profile/s: " + profiles); @@ -494,7 +503,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe * @param listFileUploaded the list file uploaded */ protected void addFields(String selectedItem, List listProfiles, - List listFileUploaded) { + List listFileUploaded) { for (MetaDataProfileBean bean : listProfiles) { if (bean.getType().equals(selectedItem)) { @@ -877,7 +886,8 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe if (resourcesTwinPanel != null) resourcesTwinPanel.freeze(bool); - // TRUE in UPDATE MODE - freeze manage of current content (means file already uploaded) + // TRUE in UPDATE MODE - freeze manage of current content (means file already + // uploaded) if (uploadedFileBrowse != null) { uploadedFileBrowse.enableManageOfContent(!bool); @@ -975,8 +985,6 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe /** * Notify valid form. - * - * @param genericDatasetBean the generic dataset bean */ private void notifyOnEditForm() { for (GenericFormEventsListener listener : listenersGenericFormEvents) { diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/UploadedFilesBrowse.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/UploadedFilesBrowse.java index 5cebe5f..2e3c864 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/UploadedFilesBrowse.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/UploadedFilesBrowse.java @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.List; import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded; +import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadedRemote; import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.constants.IconType; @@ -20,40 +21,39 @@ import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Widget; -public class UploadedFilesBrowse extends Composite { +public class UploadedFilesBrowse extends Composite { private static UploadedFilesBrowseUiBinder uiBinder = GWT.create(UploadedFilesBrowseUiBinder.class); interface UploadedFilesBrowseUiBinder extends UiBinder { } - private List listFileUploaded; - // private HashMap mapForCCUploading; + private List listFileUploaded; @UiField HTMLPanel uploadFileContainer; private FlexTable table = new FlexTable(); - + private List