Improved Update facility
This commit is contained in:
parent
849dec5db3
commit
6458b89648
|
@ -83,6 +83,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,6 +190,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -295,6 +297,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -401,6 +404,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -459,6 +463,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,6 +486,13 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<dependent-module archiveName="metadata-profile-form-builder-widget-2.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-form-builder-widget/metadata-profile-form-builder-widget">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="geoportal-data-common-2.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -671,6 +683,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -777,6 +790,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -883,6 +897,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,550 +0,0 @@
|
||||||
//package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
|
||||||
//
|
|
||||||
//import java.util.ArrayList;
|
|
||||||
//import java.util.Collection;
|
|
||||||
//import java.util.HashMap;
|
|
||||||
//import java.util.List;
|
|
||||||
//import java.util.Map;
|
|
||||||
//
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
|
||||||
//import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
|
||||||
//import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
|
||||||
//import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
|
||||||
//import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.ModalConfirm;
|
|
||||||
//import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.DataTypeWrapper;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
|
|
||||||
//import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
|
||||||
//
|
|
||||||
//import com.github.gwtbootstrap.client.ui.Button;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.ControlGroup;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.Controls;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.Label;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.ListBox;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|
||||||
//import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
|
||||||
//import com.google.gwt.core.client.GWT;
|
|
||||||
//import com.google.gwt.dom.client.Document;
|
|
||||||
//import com.google.gwt.dom.client.Style.Unit;
|
|
||||||
//import com.google.gwt.event.dom.client.ChangeEvent;
|
|
||||||
//import com.google.gwt.event.dom.client.ChangeHandler;
|
|
||||||
//import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
//import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
//import com.google.gwt.event.dom.client.DomEvent;
|
|
||||||
//import com.google.gwt.event.shared.HandlerManager;
|
|
||||||
//import com.google.gwt.uibinder.client.UiBinder;
|
|
||||||
//import com.google.gwt.uibinder.client.UiField;
|
|
||||||
//import com.google.gwt.user.client.Window;
|
|
||||||
//import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
//import com.google.gwt.user.client.ui.Composite;
|
|
||||||
//import com.google.gwt.user.client.ui.FlexTable;
|
|
||||||
//import com.google.gwt.user.client.ui.HTML;
|
|
||||||
//import com.google.gwt.user.client.ui.HTMLPanel;
|
|
||||||
//import com.google.gwt.user.client.ui.Widget;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * The Class UpdateFileset.
|
|
||||||
// *
|
|
||||||
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
// *
|
|
||||||
// * Sep 27, 2021
|
|
||||||
// */
|
|
||||||
//public class UpdateFileset extends Composite {
|
|
||||||
//
|
|
||||||
// private static final String SECTION_PIANTE = "piante";
|
|
||||||
//
|
|
||||||
// private static final String SECTION_POSIZIONAMENTO_SCAVO = "posizionamentoScavo";
|
|
||||||
//
|
|
||||||
// private static final String SECTION_RELAZIONE = "relazione";
|
|
||||||
//
|
|
||||||
// private static final String SECTION_IMMAGINI = "immagini";
|
|
||||||
//
|
|
||||||
// private static final String SECTION_ABSTRACT_RELAZIONE = "abstract_relazione";
|
|
||||||
//
|
|
||||||
// private static final String _FORM_WIDTH_FIELDS_SIZE = "730px";
|
|
||||||
//
|
|
||||||
// private static UpdateFilesetUiBinder uiBinder = GWT.create(UpdateFilesetUiBinder.class);
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * The Interface UpdateFilesetUiBinder.
|
|
||||||
// *
|
|
||||||
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
// *
|
|
||||||
// * Sep 27, 2021
|
|
||||||
// */
|
|
||||||
// interface UpdateFilesetUiBinder extends UiBinder<Widget, UpdateFileset> {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// ListBox listBoxPaths;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// ControlGroup cgSelectFile;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// Controls controlsContent;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// HTMLPanel uploadFileContainer;
|
|
||||||
//
|
|
||||||
// @UiField
|
|
||||||
// Button buttonUpdate;
|
|
||||||
//
|
|
||||||
// private List<String> listFileSetPaths;
|
|
||||||
//
|
|
||||||
// private boolean placeholderListBoxPaths = true;
|
|
||||||
//
|
|
||||||
// private BaseConcessioneDV selectedConcessione;
|
|
||||||
//
|
|
||||||
// private ConcessioneDV fullConcessione;
|
|
||||||
//
|
|
||||||
// private boolean placeholderListBoxIndex = true;
|
|
||||||
//
|
|
||||||
// private HandlerManager uiBus = new HandlerManager(null);
|
|
||||||
//
|
|
||||||
// private MetaDataField fieldUploadWidget;
|
|
||||||
//
|
|
||||||
// private Integer pathIndex = null;
|
|
||||||
//
|
|
||||||
// private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
|
|
||||||
//
|
|
||||||
// private Map<Integer, List<WorkspaceContentDV>> mapWSContentListBox = null;
|
|
||||||
//
|
|
||||||
// private HandlerManager editorManagerBus;
|
|
||||||
//
|
|
||||||
// private String profileID;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Instantiates a new update fileset.
|
|
||||||
// *
|
|
||||||
// * @param editorManagerBus the editor manager bus
|
|
||||||
// * @param selectedConcessione the selected concessione
|
|
||||||
// * @param recordType the record type
|
|
||||||
// * @param listFileSetPaths the list file set paths
|
|
||||||
// */
|
|
||||||
// public UpdateFileset(HandlerManager editorManagerBus, BaseConcessioneDV selectedConcessione, String profileID, List<String> listFileSetPaths) {
|
|
||||||
// initWidget(uiBinder.createAndBindUi(this));
|
|
||||||
// this.editorManagerBus = editorManagerBus;
|
|
||||||
// this.selectedConcessione = selectedConcessione;
|
|
||||||
// this.profileID = profileID;
|
|
||||||
// this.listFileSetPaths = listFileSetPaths;
|
|
||||||
// listBoxPaths.addItem("Select a section...");
|
|
||||||
// for (String path : listFileSetPaths) {
|
|
||||||
// listBoxPaths.addItem(path);
|
|
||||||
// }
|
|
||||||
// listBoxPaths.setWidth(_FORM_WIDTH_FIELDS_SIZE);
|
|
||||||
//
|
|
||||||
// // add handler on select
|
|
||||||
// listBoxPaths.addChangeHandler(new ChangeHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onChange(ChangeEvent event) {
|
|
||||||
// GWT.log("Profile type selection changed...");
|
|
||||||
// cgSelectFile.setVisible(false);
|
|
||||||
//
|
|
||||||
// if (placeholderListBoxPaths) {
|
|
||||||
// listBoxPaths.removeItem(0); // this is the placeholder, removing it once
|
|
||||||
// placeholderListBoxPaths = false;
|
|
||||||
// }
|
|
||||||
// showUploadFileGUI();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Window.alert("This part must be revisited");
|
|
||||||
//
|
|
||||||
//// GeoPortalDataEntryApp.geoportalDataEntryService.getRecord(selectedConcessione.getItemId(), recordType,
|
|
||||||
//// new AsyncCallback<ConcessioneDV>() {
|
|
||||||
////
|
|
||||||
//// @Override
|
|
||||||
//// public void onSuccess(ConcessioneDV theRecord) {
|
|
||||||
//// fullConcessione = theRecord;
|
|
||||||
//// }
|
|
||||||
////
|
|
||||||
//// @Override
|
|
||||||
//// public void onFailure(Throwable caught) {
|
|
||||||
//// Window.alert(caught.getMessage());
|
|
||||||
//// }
|
|
||||||
//// });
|
|
||||||
//
|
|
||||||
// buttonUpdate.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
//
|
|
||||||
// String errorMsg = checkValidUpload();
|
|
||||||
// if (errorMsg == null) {
|
|
||||||
// List<FileUploaded> listFilesUploaded = new ArrayList<FileUploaded>();
|
|
||||||
// List<MetaDataFieldSkeleton> listMetaDataFieldSkeleton = fieldUploadWidget.getListOfMetadataFields();
|
|
||||||
// for (MetaDataFieldSkeleton field : listMetaDataFieldSkeleton) {
|
|
||||||
// DialogUpload dUpload = (DialogUpload) field.getHolder();
|
|
||||||
// // adding it only if exists
|
|
||||||
// if (dUpload.getFileUploadingState() != null)
|
|
||||||
// listFilesUploaded.add(dUpload.getFileUploadingState().getFile());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// GenericDatasetBean gdb = new GenericDatasetBean();
|
|
||||||
// gdb.setFilesUploaded(listFilesUploaded);
|
|
||||||
// // adding it only if exists
|
|
||||||
//
|
|
||||||
// GWT.log("Section selected: " + listBoxPaths.getSelectedItemText());
|
|
||||||
// GWT.log("Content index selected: " + pathIndex);
|
|
||||||
// GWT.log("FileUploaded selected: " + gdb.getFilesUploaded());
|
|
||||||
//
|
|
||||||
// List<WorkspaceContentDV> listCurrentContent = new ArrayList<WorkspaceContentDV>();
|
|
||||||
// if (mapForCCUploading != null) {
|
|
||||||
// Collection<WorkspaceContentDV> currentContent = mapForCCUploading.values();
|
|
||||||
// if (currentContent != null)
|
|
||||||
// listCurrentContent.addAll(currentContent);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String htmlMsg = "Going to update the section " + listBoxPaths.getSelectedItemText() + ":";
|
|
||||||
// htmlMsg += "<ul>";
|
|
||||||
// htmlMsg += "<li>keeping " + listCurrentContent.size() + " current file/s </li>";
|
|
||||||
// htmlMsg += "<li>uploading " + listFilesUploaded.size() + " new file/s </li>";
|
|
||||||
// htmlMsg += "</ul>";
|
|
||||||
// htmlMsg += "<br>";
|
|
||||||
// htmlMsg += "This operation cannot be undone. Would you like to proceed?";
|
|
||||||
//
|
|
||||||
// GWT.log(htmlMsg);
|
|
||||||
//
|
|
||||||
// final ModalConfirm dialogConfirm = new ModalConfirm(null, "Update Confirm?", htmlMsg);
|
|
||||||
// dialogConfirm.getElement().getStyle().setZIndex(100000);
|
|
||||||
// dialogConfirm.getYesButton().addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
// dialogConfirm.hide();
|
|
||||||
// buttonUpdate.setEnabled(false);
|
|
||||||
//
|
|
||||||
// final DialogInform dialogInf = new DialogInform(null, "Updating Project...", "");
|
|
||||||
// dialogInf.setZIndex(100000);
|
|
||||||
// dialogInf.showLoader("Updating file/s for project: "+fullConcessione.getNome());
|
|
||||||
// //dialogInf.setWidth("400px");
|
|
||||||
//
|
|
||||||
// GeoportalDataEntryServiceAsync.Util.getInstance().updateSectionForRecord(
|
|
||||||
// fullConcessione.getItemId(), fullConcessione.getRecordType(),
|
|
||||||
// listBoxPaths.getSelectedItemText(), pathIndex, listCurrentContent, gdb,
|
|
||||||
// new AsyncCallback<ConcessioneDV>() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onFailure(Throwable caught) {
|
|
||||||
// dialogInf.hideLoader();
|
|
||||||
// dialogInf.setMsg(
|
|
||||||
// "Sorry error occurred during project update. Error reported: "
|
|
||||||
// + caught.getMessage());
|
|
||||||
// buttonUpdate.setEnabled(true);
|
|
||||||
// showUploadFileGUI();
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess(ConcessioneDV result) {
|
|
||||||
// dialogInf.hideLoader();
|
|
||||||
// dialogInf.setText("Project updated!");
|
|
||||||
// dialogInf.setMsg(result.getNome() + " updated correclty");
|
|
||||||
// dialogInf.center();
|
|
||||||
// fullConcessione = result;
|
|
||||||
// GWT.log("new concessione: "+fullConcessione);
|
|
||||||
// buttonUpdate.setEnabled(true);
|
|
||||||
// showUploadFileGUI();
|
|
||||||
//
|
|
||||||
// Window.alert("updateSectionForRecord must be revisited");
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// editorManagerBus.fireEvent(
|
|
||||||
// new OperationPerformedOnItemEvent<ConcessioneDV>(Arrays.asList(fullConcessione), ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
|
||||||
//
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// dialogInf.center();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// dialogConfirm.show();
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// Window.alert(errorMsg);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Show upload file GUI.
|
|
||||||
// */
|
|
||||||
// private void showUploadFileGUI() {
|
|
||||||
// uploadFileContainer.setVisible(true);
|
|
||||||
// buttonUpdate.setVisible(false);
|
|
||||||
// uploadFileContainer.clear();
|
|
||||||
// controlsContent.clear();
|
|
||||||
// placeholderListBoxIndex = true;
|
|
||||||
// fieldUploadWidget = null;
|
|
||||||
// pathIndex = null;
|
|
||||||
// mapForCCUploading = null;
|
|
||||||
// mapWSContentListBox = null;
|
|
||||||
//
|
|
||||||
//// listBoxIndex.clear();
|
|
||||||
// cgSelectFile.setVisible(true);
|
|
||||||
//
|
|
||||||
// ListBox listBoxContentIndex = new ListBox();
|
|
||||||
// listBoxContentIndex.setWidth(_FORM_WIDTH_FIELDS_SIZE);
|
|
||||||
// listBoxContentIndex.addItem("Select a content...");
|
|
||||||
// String section = null;
|
|
||||||
// Integer posizIndex = 0;
|
|
||||||
// if (listBoxPaths.getSelectedItemText().contains(SECTION_ABSTRACT_RELAZIONE)) {
|
|
||||||
// section = SECTION_ABSTRACT_RELAZIONE;
|
|
||||||
// AbstractRelazioneScavoDV ar = fullConcessione.getAbstractRelazioneScavo();
|
|
||||||
//
|
|
||||||
// if (ar == null) {
|
|
||||||
// showMessage(SECTION_ABSTRACT_RELAZIONE + " NOT AVAILABLE", LabelType.WARNING);
|
|
||||||
//// pathIndex = 0;
|
|
||||||
//// showNewFileUpload();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, ar.getTitolo(),
|
|
||||||
// ar.getListWsContent());
|
|
||||||
//
|
|
||||||
// } else if (listBoxPaths.getSelectedItemText().contains(SECTION_IMMAGINI)) {
|
|
||||||
// section = SECTION_IMMAGINI;
|
|
||||||
// List<UploadedImageDV> listImmagini = fullConcessione.getImmaginiRappresentative();
|
|
||||||
// if (listImmagini == null || listImmagini.isEmpty()) {
|
|
||||||
// showMessage(SECTION_IMMAGINI + " NOT AVAILABLE", LabelType.WARNING);
|
|
||||||
//// pathIndex = 0;
|
|
||||||
//// showNewFileUpload();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (UploadedImageDV uploadedImageDV : listImmagini) {
|
|
||||||
// fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, StringUtil.ellipsize(uploadedImageDV.getDidascalia(),30),
|
|
||||||
// uploadedImageDV.getListWsContent());
|
|
||||||
// posizIndex++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else if (listBoxPaths.getSelectedItemText().contains(SECTION_RELAZIONE)) {
|
|
||||||
// section = SECTION_RELAZIONE;
|
|
||||||
// RelazioneScavoDV relazioneScavo = fullConcessione.getRelazioneScavo();
|
|
||||||
// if (relazioneScavo == null) {
|
|
||||||
// showMessage(SECTION_RELAZIONE + " NOT AVAILABLE", LabelType.WARNING);
|
|
||||||
//// pathIndex = 0;
|
|
||||||
//// showNewFileUpload();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, relazioneScavo.getTitolo(),
|
|
||||||
// relazioneScavo.getListWsContent());
|
|
||||||
//
|
|
||||||
// } else if (listBoxPaths.getSelectedItemText().contains(SECTION_POSIZIONAMENTO_SCAVO)) {
|
|
||||||
// section = SECTION_POSIZIONAMENTO_SCAVO;
|
|
||||||
// LayerConcessioneDV posiz = fullConcessione.getPosizionamentoScavo();
|
|
||||||
// if (posiz == null) {
|
|
||||||
// showMessage(SECTION_POSIZIONAMENTO_SCAVO + " NOT AVAILABLE", LabelType.WARNING);
|
|
||||||
//// pathIndex = 0;
|
|
||||||
//// showNewFileUpload();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, posiz.getTitolo(),
|
|
||||||
// posiz.getListWsContent());
|
|
||||||
//
|
|
||||||
// } else if (listBoxPaths.getSelectedItemText().contains(SECTION_PIANTE)) {
|
|
||||||
// section = SECTION_PIANTE;
|
|
||||||
// List<LayerConcessioneDV> piante = fullConcessione.getPianteFineScavo();
|
|
||||||
// if (piante == null || piante.isEmpty()) {
|
|
||||||
// showMessage(SECTION_PIANTE + " NOT AVAILABLE", LabelType.WARNING);
|
|
||||||
//// pathIndex = 0;
|
|
||||||
//// showNewFileUpload();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (LayerConcessioneDV lcDV : piante) {
|
|
||||||
// fillListBoxToBeReplaced(listBoxContentIndex, SECTION_PIANTE, posizIndex, lcDV.getTitolo(),
|
|
||||||
// lcDV.getListWsContent());
|
|
||||||
// posizIndex++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// controlsContent.add(listBoxContentIndex);
|
|
||||||
//
|
|
||||||
// if (listBoxContentIndex.getItemCount() == 2) {
|
|
||||||
// // listBoxContentIndex.setSelectedIndex(1);
|
|
||||||
// listBoxContentIndex.setSelectedValue(listBoxContentIndex.getItemText(1));
|
|
||||||
//
|
|
||||||
// DomEvent.fireNativeEvent(Document.get().createChangeEvent(), listBoxContentIndex);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void fillListBoxToBeReplaced(ListBox listBoxContentIndex, String section, int posizIndex, String title,
|
|
||||||
// List<WorkspaceContentDV> listWSC) {
|
|
||||||
// GWT.log("fillListBoxToBeReplaced called, posizIndex: "+posizIndex+", listWSC: "+listWSC);
|
|
||||||
//
|
|
||||||
// if(mapWSContentListBox==null) {
|
|
||||||
// mapWSContentListBox = new HashMap<Integer, List<WorkspaceContentDV>>();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// listBoxContentIndex.addItem(title, posizIndex + "");
|
|
||||||
// mapWSContentListBox.put(posizIndex, listWSC);
|
|
||||||
//
|
|
||||||
// // adding handler once
|
|
||||||
// if (posizIndex == 0) {
|
|
||||||
//
|
|
||||||
// listBoxContentIndex.addChangeHandler(new ChangeHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onChange(ChangeEvent event) {
|
|
||||||
// GWT.log("listBoxContentIndex changed, value: "+listBoxContentIndex.getSelectedValue());
|
|
||||||
//
|
|
||||||
// if (placeholderListBoxIndex) {
|
|
||||||
// listBoxContentIndex.removeItem(0); // this is the placeholder, removing it once
|
|
||||||
// placeholderListBoxIndex = false;
|
|
||||||
// }
|
|
||||||
// int selectedIndex = listBoxContentIndex.getSelectedIndex();
|
|
||||||
// GWT.log("selected index: "+selectedIndex);
|
|
||||||
// List<WorkspaceContentDV> theListWC = mapWSContentListBox.get(selectedIndex);
|
|
||||||
//
|
|
||||||
// if (theListWC == null || theListWC.isEmpty()) {
|
|
||||||
// uploadFileContainer.clear();
|
|
||||||
// showMessage(section + " does not contain file!", LabelType.WARNING);
|
|
||||||
// pathIndex = posizIndex;
|
|
||||||
// showNewFileUpload();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// showFileBrowseInteraction(selectedIndex, mapWSContentListBox.get(selectedIndex));
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
////
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void showFileBrowseInteraction(int pathContentIndex, List<WorkspaceContentDV> listWSC) {
|
|
||||||
// uploadFileContainer.clear();
|
|
||||||
// pathIndex = pathContentIndex;
|
|
||||||
// GWT.log("showing pathContentIndex: "+pathContentIndex);
|
|
||||||
// GWT.log("showing ws content: "+listWSC);
|
|
||||||
//
|
|
||||||
// // map for current content uploading
|
|
||||||
// mapForCCUploading = new HashMap<Integer, WorkspaceContentDV>(listWSC.size());
|
|
||||||
// int index = 0;
|
|
||||||
// for (WorkspaceContentDV workspaceContentDV : listWSC) {
|
|
||||||
// workspaceContentDV.setCliendId(index);
|
|
||||||
// mapForCCUploading.put(index, workspaceContentDV);
|
|
||||||
// index++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (listWSC.size() > 0) {
|
|
||||||
// FlexTable table = new FlexTable();
|
|
||||||
// table.addStyleName("table-current-content");
|
|
||||||
// table.setHTML(0, 0, "<span style='color:rgb(155, 80, 78); font-weight:bold;'>Current content:</span>");
|
|
||||||
// table.setHTML(1, 0, "<span style='color:rgb(155, 80, 78);'>Filename</span>");
|
|
||||||
// table.setHTML(1, 1, "<span style='color:rgb(155, 80, 78);'>MimeType<span>");
|
|
||||||
// table.setHTML(1, 2, "<span style='color:rgb(155, 80, 78);'>Link</span>");
|
|
||||||
//
|
|
||||||
// int i = 2;
|
|
||||||
// for (final WorkspaceContentDV wsContent : listWSC) {
|
|
||||||
// table.setHTML(i, 0, wsContent.getName());
|
|
||||||
// table.setHTML(i, 1, wsContent.getMimetype());
|
|
||||||
// String link = "<a target=\"_blank\" href=" + wsContent.getLink() + ">View</a>";
|
|
||||||
// table.setHTML(i, 2, link);
|
|
||||||
//
|
|
||||||
// final int rowIndexToRem = i;
|
|
||||||
// Button buttonRemoveFile = new Button();
|
|
||||||
// buttonRemoveFile.setIcon(IconType.TRASH);
|
|
||||||
// buttonRemoveFile.setTitle("Remove this file");
|
|
||||||
// buttonRemoveFile.addClickHandler(new ClickHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onClick(ClickEvent event) {
|
|
||||||
// mapForCCUploading.remove(wsContent.getCliendId());
|
|
||||||
// table.getRowFormatter().getElement(rowIndexToRem).setAttribute("hidden", "hidden");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// table.setWidget(i, 3, buttonRemoveFile);
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// uploadFileContainer.add(table);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// showNewFileUpload();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// private void showNewFileUpload() {
|
|
||||||
//
|
|
||||||
// HTML label = new HTML();
|
|
||||||
// label.getElement().getStyle().setMarginTop(10, Unit.PX);
|
|
||||||
// label.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
|
||||||
// label.setHTML("<b>Add new file/s:</b>");
|
|
||||||
// uploadFileContainer.add(label);
|
|
||||||
// // mDU = new MultipleDilaogUpload();
|
|
||||||
//
|
|
||||||
// MetadataFieldWrapper uploadField = new MetadataFieldWrapper();
|
|
||||||
// uploadField.setFieldName("File");
|
|
||||||
// uploadField.setMandatory(false);
|
|
||||||
// uploadField.setType(DataTypeWrapper.File);
|
|
||||||
// uploadField.setMaxOccurs(1000);
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// fieldUploadWidget = new MetaDataField(uploadField, uiBus, OPERATION.NEW);
|
|
||||||
// uploadFileContainer.add(fieldUploadWidget);
|
|
||||||
//
|
|
||||||
// buttonUpdate.setVisible(true);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Test if profile data are valid.
|
|
||||||
// *
|
|
||||||
// * @return the string
|
|
||||||
// */
|
|
||||||
// private String checkValidUpload() {
|
|
||||||
//
|
|
||||||
// if (fieldUploadWidget == null)
|
|
||||||
// return "No file uploaded";
|
|
||||||
//
|
|
||||||
// for (MetaDataFieldSkeleton field : fieldUploadWidget.getListOfMetadataFields()) {
|
|
||||||
//
|
|
||||||
// field.removeError();
|
|
||||||
//
|
|
||||||
// String error = field.isFieldValueValid();
|
|
||||||
// if (error != null) {
|
|
||||||
// field.showError();
|
|
||||||
// String errorMsg = field.getFieldNameOriginal() + " is not valid. Suggestion: " + error;
|
|
||||||
// return errorMsg;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void showMessage(String txt, LabelType type) {
|
|
||||||
// Label l = new Label();
|
|
||||||
// l.setType(type);
|
|
||||||
// l.setText(txt);
|
|
||||||
// uploadFileContainer.add(l);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
|
@ -1,50 +0,0 @@
|
||||||
<!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:b="urn:import:com.github.gwtbootstrap.client.ui">
|
|
||||||
<ui:style>
|
|
||||||
.important {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-save-style {
|
|
||||||
margin-top: 10px;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.max-height-500 {
|
|
||||||
max-height: 450px;
|
|
||||||
}
|
|
||||||
</ui:style>
|
|
||||||
<g:HTMLPanel>
|
|
||||||
<g:ScrollPanel addStyleNames="{style.max-height-500}">
|
|
||||||
<b:Form type="INLINE">
|
|
||||||
<b:Fieldset addStyleNames="form-fieldset-edit">
|
|
||||||
<b:ControlGroup>
|
|
||||||
<b:ControlLabel>Section</b:ControlLabel>
|
|
||||||
<b:Controls>
|
|
||||||
<b:ListBox ui:field="listBoxPaths"></b:ListBox>
|
|
||||||
</b:Controls>
|
|
||||||
</b:ControlGroup>
|
|
||||||
<b:ControlGroup ui:field="cgSelectFile"
|
|
||||||
visible="false">
|
|
||||||
<b:ControlLabel>Manage the content of</b:ControlLabel>
|
|
||||||
<b:Controls ui:field="controlsContent">
|
|
||||||
<b:ListBox ui:field="listBoxIndex"
|
|
||||||
addStyleNames="{style.width-500}"></b:ListBox>
|
|
||||||
</b:Controls>
|
|
||||||
</b:ControlGroup>
|
|
||||||
<b:ControlGroup>
|
|
||||||
<g:ScrollPanel>
|
|
||||||
<g:HTMLPanel ui:field="uploadFileContainer"
|
|
||||||
addStyleNames="upload-file-container"></g:HTMLPanel>
|
|
||||||
</g:ScrollPanel>
|
|
||||||
</b:ControlGroup>
|
|
||||||
</b:Fieldset>
|
|
||||||
</b:Form>
|
|
||||||
</g:ScrollPanel>
|
|
||||||
<b:Button icon="SAVE" type="INFO"
|
|
||||||
addStyleNames="{style.button-save-style}" ui:field="buttonUpdate"
|
|
||||||
visible="false">UPDATE</b:Button>
|
|
||||||
</g:HTMLPanel>
|
|
||||||
</ui:UiBinder>
|
|
|
@ -30,6 +30,8 @@ import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.Modal;
|
import com.github.gwtbootstrap.client.ui.Modal;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.dom.client.NodeList;
|
||||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
@ -119,6 +121,9 @@ public class UpdateRecord extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
listBoxSections.addItem(PLACEHOLDER_LIST_BOX, PLACEHOLDER_LIST_BOX);
|
listBoxSections.addItem(PLACEHOLDER_LIST_BOX, PLACEHOLDER_LIST_BOX);
|
||||||
|
listBoxSections.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled",
|
||||||
|
"disabled");
|
||||||
|
listBoxSections.setSelectedValue(PLACEHOLDER_LIST_BOX);
|
||||||
|
|
||||||
int sectionArray = 0;
|
int sectionArray = 0;
|
||||||
|
|
||||||
|
@ -153,10 +158,19 @@ public class UpdateRecord extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(ChangeEvent event) {
|
public void onChange(ChangeEvent event) {
|
||||||
setUpdateButtonEnabled(false);
|
setUpdateButtonEnabled(false);
|
||||||
|
|
||||||
|
// -1 because the first element is the PLACEHOLDER "Select section..."
|
||||||
|
int selectedIndex = listBoxSections.getSelectedIndex() - 1;
|
||||||
|
/*NodeList<Element> elementOption = listBoxSections.getElement().getElementsByTagName("option");
|
||||||
|
for (int i=0; i<listBoxSections.getItemCount(); i++) {
|
||||||
|
if(i!=selectedIndex) {
|
||||||
|
elementOption.getItem(i).setAttribute("disabled",
|
||||||
|
"disabled");
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
MetaDataProfileBeanExt selectedBean = result.getTheProfileBeans()
|
MetaDataProfileBeanExt selectedBean = result.getTheProfileBeans()
|
||||||
.get(listBoxSections.getSelectedIndex() - 1); // -1 because the first element is
|
.get(selectedIndex);
|
||||||
// the PLACEHOLDER "Select
|
|
||||||
// section..."
|
|
||||||
GWT.log("Change handler fired " + selectedBean);
|
GWT.log("Change handler fired " + selectedBean);
|
||||||
controlsControlGroup.setVisible(true);
|
controlsControlGroup.setVisible(true);
|
||||||
scrollSectionContent.clear();
|
scrollSectionContent.clear();
|
||||||
|
@ -327,6 +341,14 @@ public class UpdateRecord extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
|
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
|
||||||
setUpdateButtonEnabled(true);
|
setUpdateButtonEnabled(true);
|
||||||
|
//Disabling option not selected
|
||||||
|
int selectedIndex = listBoxSections.getSelectedIndex();
|
||||||
|
NodeList<Element> elementOption = listBoxSections.getElement().getElementsByTagName("option");
|
||||||
|
for (int i = 0; i < listBoxSections.getItemCount(); i++) {
|
||||||
|
if (i != selectedIndex) {
|
||||||
|
elementOption.getItem(i).setAttribute("disabled", "disabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,6 +358,12 @@ public class UpdateRecord extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onFormDataEdit() {
|
public void onFormDataEdit() {
|
||||||
setUpdateButtonEnabled(false);
|
setUpdateButtonEnabled(false);
|
||||||
|
NodeList<Element> elementOption = listBoxSections.getElement().getElementsByTagName("option");
|
||||||
|
//i==0 is the PLACEHOLDER
|
||||||
|
for (int i = 1; i < listBoxSections.getItemCount(); i++) {
|
||||||
|
elementOption.getItem(i).removeAttribute("disabled");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,7 @@
|
||||||
<b:Label type="INFO">Select the section of the document you want
|
<b:Label type="INFO">Select the section of the document you want
|
||||||
to update...</b:Label>
|
to update...</b:Label>
|
||||||
<b:Controls>
|
<b:Controls>
|
||||||
<b:ListBox ui:field="listBoxSections"
|
<b:ListBox ui:field="listBoxSections"></b:ListBox>
|
||||||
addStyleNames="{style.margin-top-10}"></b:ListBox>
|
|
||||||
</b:Controls>
|
</b:Controls>
|
||||||
</b:ControlGroup>
|
</b:ControlGroup>
|
||||||
<b:ControlGroup ui:field="controlsControlGroup"
|
<b:ControlGroup ui:field="controlsControlGroup"
|
||||||
|
|
|
@ -113,6 +113,10 @@ h1 {
|
||||||
padding: 10px !important;
|
padding: 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-fieldset-edit select {
|
||||||
|
margin-top: 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
.gna-dataentry-form-fieldset fieldset {
|
.gna-dataentry-form-fieldset fieldset {
|
||||||
margin: 10px !important;
|
margin: 10px !important;
|
||||||
border: 1px groove #ddd !important;
|
border: 1px groove #ddd !important;
|
||||||
|
|
Loading…
Reference in New Issue