#21990 completed edit mode for registerFileSet

This commit is contained in:
Francesco Mangiacrapa 2021-10-06 16:01:39 +02:00
parent 3bda56a55c
commit 9690b09cb1
8 changed files with 188 additions and 90 deletions

View File

@ -8,44 +8,44 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
#### Enhancements #### Enhancements
[#20435] Client integration with MongoConcessioni - [#20435] Client integration with MongoConcessioni
Moved to maven-portal-bom 3.6.3 - Moved to maven-portal-bom 3.6.3
[#21856] Implemented new user feedback - [#21856] Implemented new user feedback
[#21890] Passed to mongoID - [#21890] Passed to mongoID
[#20599] Get List of Records - [#20599] Get List of Records
[#22002] Integrated with ValidationReport and status - [#22002] Integrated with ValidationReport and status
[#21990] Provide the (first version of) edit mode - [#21990] Provide the (first version of) edit mode
[#22040] Revisited the "Abstract Relazione di Scavo" - [#22040] Revisited the "Abstract Relazione di Scavo"
## [v1.2.0] - 2020-12-18 ## [v1.2.0] - 2020-12-18
#### Enhancements #### Enhancements
[#20357] new requirements - [#20357] new requirements
## [v1.1.0] - 2020-12-1 ## [v1.1.0] - 2020-12-1
#### Enhancements #### Enhancements
[#20210] Updating required for data entry facility after the first feedback by domain experts - [#20210] Updating required for data entry facility after the first feedback by domain experts
## [v1.0.2] - 2020-11-09 ## [v1.0.2] - 2020-11-09
#### Bug fixes #### Bug fixes
[#20092] Repeatible form: validate the card after the create event is fired - [#20092] Repeatible form: validate the card after the create event is fired
## [v1.0.1] - 2020-11-04 ## [v1.0.1] - 2020-11-04
#### Bug fixes #### Bug fixes
[#20063] Fixes for data-entry components - [#20063] Fixes for data-entry components
## [v1.0.0] - 2020-10-07 ## [v1.0.0] - 2020-10-07
[#19916] First release - [#19916] First release

View File

@ -510,8 +510,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
case SHOW_REPORT: case SHOW_REPORT:
final Modal modal2 = new Modal(true, true); final Modal modal2 = new Modal(true, true);
modal2.setTitle("Report <div style='color:#555; font-size:22px;'>" + concessione.getNome() modal2.setTitle("<span style='font-size:20px;'>Report: <span style='color:#555; font-size:20px;'>" + concessione.getNome()
+ "</div>"); + "</span></span>");
modal2.setWidth(800); modal2.setWidth(800);
modal2.setCloseVisible(true); modal2.setCloseVisible(true);
if (concessione.getValidationReport() == null) { if (concessione.getValidationReport() == null) {
@ -527,8 +527,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
case SHOW_EDIT_MODE: case SHOW_EDIT_MODE:
final Modal modal3 = new Modal(true, true); final Modal modal3 = new Modal(true, true);
modal3.setTitle("Edit <div style='color:#555; font-size:22px;'>" + concessione.getNome() modal3.setTitle("<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>" + concessione.getNome()
+ "</div>"); + "</span></span>");
modal3.setWidth(950); modal3.setWidth(950);
modal3.setHeight("700px"); modal3.setHeight("700px");
modal3.setCloseVisible(true); modal3.setCloseVisible(true);

View File

@ -1,13 +1,19 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit; package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
import java.util.Arrays;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV; import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp; import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent; import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper; import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
@ -24,7 +30,7 @@ import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.ScrollPanel; import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
/** /**
@ -40,7 +46,7 @@ public class EditModeRecord extends Composite {
@UiField @UiField
Tab tabRawUpdate; Tab tabRawUpdate;
@UiField @UiField
Tab tabUploadFiles; Tab tabUploadFiles;
@ -48,7 +54,7 @@ public class EditModeRecord extends Composite {
FlowPanel rawUpdatePanel; FlowPanel rawUpdatePanel;
@UiField @UiField
ScrollPanel filesUpdatePanel; HTMLPanel filesUpdatePanel;
@UiField @UiField
Button buttonJSONUpdate; Button buttonJSONUpdate;
@ -60,6 +66,8 @@ public class EditModeRecord extends Composite {
private JSONEditorWrapper jsEditor; private JSONEditorWrapper jsEditor;
private HandlerManager appManagerBus; private HandlerManager appManagerBus;
private final HandlerManager editorManagerBus = new HandlerManager(null);
/** /**
* The Interface EditModeRecordUiBinder. * The Interface EditModeRecordUiBinder.
@ -84,7 +92,7 @@ public class EditModeRecord extends Composite {
this.recordType = type; this.recordType = type;
this.appManagerBus = appManagerBus; this.appManagerBus = appManagerBus;
this.filesUpdatePanel.setHeight("490px"); this.filesUpdatePanel.setHeight("490px");
//filesUpdatePanel.getElement().getStyle().setProperty("maxHeight", "550px"); // filesUpdatePanel.getElement().getStyle().setProperty("maxHeight", "550px");
instanceJSONEditor(); instanceJSONEditor();
instanceUpdateFilesetEditor(); instanceUpdateFilesetEditor();
@ -102,7 +110,8 @@ public class EditModeRecord extends Composite {
@Override @Override
public void onSuccess(FileSetPathsDV fileSetPaths) { public void onSuccess(FileSetPathsDV fileSetPaths) {
UpdateFileset updateFileset = new UpdateFileset(selectedConcessione, recordType, fileSetPaths.getFileSetPaths()); UpdateFileset updateFileset = new UpdateFileset(editorManagerBus, selectedConcessione, recordType,
fileSetPaths.getFileSetPaths());
filesUpdatePanel.add(updateFileset); filesUpdatePanel.add(updateFileset);
} }
}); });
@ -114,7 +123,7 @@ public class EditModeRecord extends Composite {
rawUpdatePanel.clear(); rawUpdatePanel.clear();
final FlowPanel fp = new FlowPanel(); final FlowPanel fp = new FlowPanel();
fp.getElement().setId("jsoneditor" + Random.nextInt()); fp.getElement().setId("jsoneditor" + Random.nextInt());
fp.setHeight("400px"); fp.setHeight("410px");
rawUpdatePanel.add(fp); rawUpdatePanel.add(fp);
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType, GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType,
@ -150,6 +159,7 @@ public class EditModeRecord extends Composite {
* Bind events. * Bind events.
*/ */
private void bindEvents() { private void bindEvents() {
buttonJSONUpdate.addClickHandler(new ClickHandler() { buttonJSONUpdate.addClickHandler(new ClickHandler() {
@Override @Override
@ -171,7 +181,7 @@ public class EditModeRecord extends Composite {
// TODO: handle exception // TODO: handle exception
} }
appManagerBus.fireEvent( editorManagerBus.fireEvent(
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD)); new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
} }
@ -185,17 +195,38 @@ public class EditModeRecord extends Composite {
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
selectedConcessione = result;
instanceJSONEditor(); DialogInform di = new DialogInform(null, "Project updated!", "Project '" + result.getNome() + "' updated correctly");
di.setZIndex(100000);
Window.alert("Project '" + result.getNome() + "' updated correctly"); di.center();
appManagerBus.fireEvent( editorManagerBus.fireEvent(
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD)); new ActionOnItemEvent<ConcessioneDV>(Arrays.asList(result), ACTION_ON_ITEM.UPDATED_RECORD));
} }
}); });
} }
}); });
editorManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() {
@Override
public <T extends RecordDV> void onDoActionFired(ActionOnItemEvent<T> showItemEvent) {
ACTION_ON_ITEM action = showItemEvent.getAction();
List<T> items = showItemEvent.getSelectItems();
if(items!=null) {
selectedConcessione = (BaseConcessioneDV) items.get(0);
instanceJSONEditor();
if(action.equals(ACTION_ON_ITEM.UPDATED_RECORD)) {
appManagerBus.fireEvent(
new ActionOnItemEvent<ConcessioneDV>((List<ConcessioneDV>) items, ACTION_ON_ITEM.UPDATED_RECORD));
}
}
}
});
} }
} }

View File

@ -21,7 +21,7 @@
<g:HTMLPanel> <g:HTMLPanel>
<b:TabPanel tabPosition="left" ui:field="tabPanel"> <b:TabPanel tabPosition="left" ui:field="tabPanel">
<b:Tab icon="PENCIL" active="true" heading="Edit the source" <b:Tab icon="PENCIL" active="true" heading="Edit the Project"
ui:field="tabRawUpdate"> ui:field="tabRawUpdate">
<b:Heading size="3">Source Project Editor</b:Heading> <b:Heading size="3">Source Project Editor</b:Heading>
<b:Label type="INFO">You can update the Source Project by editing <b:Label type="INFO">You can update the Source Project by editing
@ -66,8 +66,8 @@
them persistent on the service them persistent on the service
</p> </p>
</g:HTML> </g:HTML>
<g:ScrollPanel ui:field="filesUpdatePanel"> <g:HTMLPanel ui:field="filesUpdatePanel">
</g:ScrollPanel> </g:HTMLPanel>
</b:Tab> </b:Tab>
</b:TabPanel> </b:TabPanel>
</g:HTMLPanel> </g:HTMLPanel>

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit; package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -13,9 +14,11 @@ import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelaz
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV; 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.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV; import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp; import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync; import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField; import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
@ -61,6 +64,16 @@ import com.google.gwt.user.client.ui.Widget;
*/ */
public class UpdateFileset extends Composite { 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 final String _FORM_WIDTH_FIELDS_SIZE = "730px";
private static UpdateFilesetUiBinder uiBinder = GWT.create(UpdateFilesetUiBinder.class); private static UpdateFilesetUiBinder uiBinder = GWT.create(UpdateFilesetUiBinder.class);
@ -110,14 +123,22 @@ public class UpdateFileset extends Composite {
private Map<Integer, WorkspaceContentDV> mapForCCUploading = null; private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
private Map<Integer, List<WorkspaceContentDV>> mapWSContentListBox = null;
private HandlerManager editorManagerBus;
/** /**
* Instantiates a new update fileset. * 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 * @param listFileSetPaths the list file set paths
*/ */
public UpdateFileset(BaseConcessioneDV selectedConcessione, RECORD_TYPE recordType, List<String> listFileSetPaths) { public UpdateFileset(HandlerManager editorManagerBus, BaseConcessioneDV selectedConcessione, RECORD_TYPE recordType, List<String> listFileSetPaths) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.editorManagerBus = editorManagerBus;
this.selectedConcessione = selectedConcessione; this.selectedConcessione = selectedConcessione;
this.recordType = recordType; this.recordType = recordType;
this.listFileSetPaths = listFileSetPaths; this.listFileSetPaths = listFileSetPaths;
@ -208,11 +229,10 @@ public class UpdateFileset extends Composite {
dialogConfirm.hide(); dialogConfirm.hide();
buttonUpdate.setEnabled(false); buttonUpdate.setEnabled(false);
final DialogInform dialogInf = new DialogInform(null, "Updating Project", ""); final DialogInform dialogInf = new DialogInform(null, "Updating Project...", "");
dialogInf.setZIndex(100000); dialogInf.setZIndex(100000);
dialogInf.showLoader("updating file/s for project: "+fullConcessione.getNome()); dialogInf.showLoader("Updating file/s for project: "+fullConcessione.getNome());
//dialogInf.setWidth("400px"); //dialogInf.setWidth("400px");
dialogInf.center();
GeoportalDataEntryServiceAsync.Util.getInstance().updateSectionForRecord( GeoportalDataEntryServiceAsync.Util.getInstance().updateSectionForRecord(
fullConcessione.getItemId(), fullConcessione.getRecordType(), fullConcessione.getItemId(), fullConcessione.getRecordType(),
@ -237,8 +257,11 @@ public class UpdateFileset extends Composite {
dialogInf.setMsg(result.getNome() + " updated correclty"); dialogInf.setMsg(result.getNome() + " updated correclty");
dialogInf.center(); dialogInf.center();
fullConcessione = result; fullConcessione = result;
GWT.log("new concessione: "+fullConcessione);
buttonUpdate.setEnabled(true); buttonUpdate.setEnabled(true);
showUploadFileGUI(); showUploadFileGUI();
editorManagerBus.fireEvent(
new ActionOnItemEvent<ConcessioneDV>(Arrays.asList(fullConcessione), ACTION_ON_ITEM.UPDATED_RECORD));
} }
}); });
@ -268,6 +291,7 @@ public class UpdateFileset extends Composite {
fieldUploadWidget = null; fieldUploadWidget = null;
pathIndex = null; pathIndex = null;
mapForCCUploading = null; mapForCCUploading = null;
mapWSContentListBox = null;
// listBoxIndex.clear(); // listBoxIndex.clear();
cgSelectFile.setVisible(true); cgSelectFile.setVisible(true);
@ -275,60 +299,76 @@ public class UpdateFileset extends Composite {
ListBox listBoxContentIndex = new ListBox(); ListBox listBoxContentIndex = new ListBox();
listBoxContentIndex.setWidth(_FORM_WIDTH_FIELDS_SIZE); listBoxContentIndex.setWidth(_FORM_WIDTH_FIELDS_SIZE);
listBoxContentIndex.addItem("Select a content..."); listBoxContentIndex.addItem("Select a content...");
String section = null;
if (listBoxPaths.getSelectedItemText().contains("abstract_relazione")) { Integer posizIndex = 0;
if (listBoxPaths.getSelectedItemText().contains(SECTION_ABSTRACT_RELAZIONE)) {
section = SECTION_ABSTRACT_RELAZIONE;
AbstractRelazioneScavoDV ar = fullConcessione.getAbstractRelazioneScavo(); AbstractRelazioneScavoDV ar = fullConcessione.getAbstractRelazioneScavo();
if (ar == null) { if (ar == null) {
showMessage("abstract_relazione" + " NOT AVAILABLE", LabelType.WARNING); showMessage(SECTION_ABSTRACT_RELAZIONE + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return; return;
} }
int posizIndex = 0; fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, ar.getTitolo(),
fillListBoxToBeReplaced(listBoxContentIndex, "abstract_relazione", posizIndex, ar.getTitolo(),
ar.getListWsContent()); ar.getListWsContent());
} else if (listBoxPaths.getSelectedItemText().contains("immagini")) { } else if (listBoxPaths.getSelectedItemText().contains(SECTION_IMMAGINI)) {
section = SECTION_IMMAGINI;
List<UploadedImageDV> listImmagini = fullConcessione.getImmaginiRappresentative(); List<UploadedImageDV> listImmagini = fullConcessione.getImmaginiRappresentative();
if (listImmagini == null || listImmagini.isEmpty()) { if (listImmagini == null || listImmagini.isEmpty()) {
showMessage("immagini" + " NOT AVAILABLE", LabelType.WARNING); showMessage(SECTION_IMMAGINI + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return; return;
} }
int posizIndex = 0;
for (UploadedImageDV uploadedImageDV : listImmagini) { for (UploadedImageDV uploadedImageDV : listImmagini) {
fillListBoxToBeReplaced(listBoxContentIndex, "immagini", posizIndex, uploadedImageDV.getTitolo(), fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, uploadedImageDV.getTitolo(),
uploadedImageDV.getListWsContent()); uploadedImageDV.getListWsContent());
posizIndex++; posizIndex++;
} }
} else if (listBoxPaths.getSelectedItemText().contains("relazione")) { } else if (listBoxPaths.getSelectedItemText().contains(SECTION_RELAZIONE)) {
RelazioneScavoDV realzione = fullConcessione.getRelazioneScavo(); section = SECTION_RELAZIONE;
if (realzione == null || realzione.getListWsContent() == null) { RelazioneScavoDV relazioneScavo = fullConcessione.getRelazioneScavo();
showMessage("relazione" + " NOT AVAILABLE", LabelType.WARNING); if (relazioneScavo == null) {
showMessage(SECTION_RELAZIONE + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return; return;
} }
int posizIndex = 0;
fillListBoxToBeReplaced(listBoxContentIndex, "relazione", posizIndex, realzione.getTitolo(),
realzione.getListWsContent());
} else if (listBoxPaths.getSelectedItemText().contains("posizionamentoScavo")) { fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, relazioneScavo.getTitolo(),
relazioneScavo.getListWsContent());
} else if (listBoxPaths.getSelectedItemText().contains(SECTION_POSIZIONAMENTO_SCAVO)) {
section = SECTION_POSIZIONAMENTO_SCAVO;
LayerConcessioneDV posiz = fullConcessione.getPosizionamentoScavo(); LayerConcessioneDV posiz = fullConcessione.getPosizionamentoScavo();
if (posiz == null || posiz.getListWsContent() == null || posiz.getListWsContent().isEmpty()) { if (posiz == null) {
showMessage("posizionamentoScavo" + " NOT AVAILABLE", LabelType.WARNING); showMessage(SECTION_POSIZIONAMENTO_SCAVO + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return; return;
} }
int posizIndex = 0;
fillListBoxToBeReplaced(listBoxContentIndex, "posizionamentoScavo", posizIndex, posiz.getTitolo(), fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, posiz.getTitolo(),
posiz.getListWsContent()); posiz.getListWsContent());
} else if (listBoxPaths.getSelectedItemText().contains("piante")) { } else if (listBoxPaths.getSelectedItemText().contains(SECTION_PIANTE)) {
section = SECTION_PIANTE;
List<LayerConcessioneDV> piante = fullConcessione.getPianteFineScavo(); List<LayerConcessioneDV> piante = fullConcessione.getPianteFineScavo();
if (piante == null || piante.isEmpty()) { if (piante == null || piante.isEmpty()) {
showMessage("piante" + " NOT AVAILABLE", LabelType.WARNING); showMessage(SECTION_PIANTE + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return; return;
} }
int posizIndex = 0;
for (LayerConcessioneDV lcDV : piante) { for (LayerConcessioneDV lcDV : piante) {
fillListBoxToBeReplaced(listBoxContentIndex, "piante", posizIndex, lcDV.getTitolo(), fillListBoxToBeReplaced(listBoxContentIndex, SECTION_PIANTE, posizIndex, lcDV.getTitolo(),
lcDV.getListWsContent()); lcDV.getListWsContent());
posizIndex++; posizIndex++;
} }
@ -348,13 +388,21 @@ public class UpdateFileset extends Composite {
private void fillListBoxToBeReplaced(ListBox listBoxContentIndex, String section, int posizIndex, String title, private void fillListBoxToBeReplaced(ListBox listBoxContentIndex, String section, int posizIndex, String title,
List<WorkspaceContentDV> listWSC) { List<WorkspaceContentDV> listWSC) {
GWT.log("fillListBoxToBeReplaced called, posizIndex: "+posizIndex+", listWSC: "+listWSC);
if (listWSC == null || listWSC.isEmpty()) { if (listWSC == null || listWSC.isEmpty()) {
showMessage(section + " DOES NOT CONTAIN FILES", LabelType.WARNING); showMessage(section + " does not contain file!", LabelType.WARNING);
pathIndex = posizIndex;
showNewFileUpload();
return; return;
} }
if(mapWSContentListBox==null) {
mapWSContentListBox = new HashMap<Integer, List<WorkspaceContentDV>>();
}
listBoxContentIndex.addItem(title, posizIndex + ""); listBoxContentIndex.addItem(title, posizIndex + "");
mapWSContentListBox.put(posizIndex, listWSC);
// adding handler once // adding handler once
if (posizIndex == 0) { if (posizIndex == 0) {
@ -363,13 +411,15 @@ public class UpdateFileset extends Composite {
@Override @Override
public void onChange(ChangeEvent event) { public void onChange(ChangeEvent event) {
GWT.log("listBoxContentIndex changed, posizIndex: "+posizIndex);
if (placeholderListBoxIndex) { if (placeholderListBoxIndex) {
listBoxContentIndex.removeItem(0); // this is the placeholder, removing it once listBoxContentIndex.removeItem(0); // this is the placeholder, removing it once
placeholderListBoxIndex = false; placeholderListBoxIndex = false;
} }
int selectedIndex = listBoxContentIndex.getSelectedIndex();
showFileBrowseInteraction(listBoxContentIndex.getSelectedIndex(), listWSC); GWT.log("selected index: "+selectedIndex);
showFileBrowseInteraction(selectedIndex, mapWSContentListBox.get(selectedIndex));
} }
}); });
} }
@ -380,6 +430,8 @@ public class UpdateFileset extends Composite {
private void showFileBrowseInteraction(int pathContentIndex, List<WorkspaceContentDV> listWSC) { private void showFileBrowseInteraction(int pathContentIndex, List<WorkspaceContentDV> listWSC) {
uploadFileContainer.clear(); uploadFileContainer.clear();
pathIndex = pathContentIndex; pathIndex = pathContentIndex;
GWT.log("showing pathContentIndex: "+pathContentIndex);
GWT.log("showing ws content: "+listWSC);
// map for current content uploading // map for current content uploading
mapForCCUploading = new HashMap<Integer, WorkspaceContentDV>(listWSC.size()); mapForCCUploading = new HashMap<Integer, WorkspaceContentDV>(listWSC.size());
@ -424,6 +476,12 @@ public class UpdateFileset extends Composite {
uploadFileContainer.add(table); uploadFileContainer.add(table);
} }
showNewFileUpload();
}
private void showNewFileUpload() {
HTML label = new HTML(); HTML label = new HTML();
label.getElement().getStyle().setMarginTop(10, Unit.PX); label.getElement().getStyle().setMarginTop(10, Unit.PX);
label.getElement().getStyle().setMarginBottom(10, Unit.PX); label.getElement().getStyle().setMarginBottom(10, Unit.PX);

View File

@ -11,31 +11,38 @@
margin-top: 10px; margin-top: 10px;
float: right; float: right;
} }
.max-height-500 {
max-height: 450px;
}
</ui:style> </ui:style>
<g:HTMLPanel> <g:HTMLPanel>
<b:Form type="INLINE"> <g:ScrollPanel addStyleNames="{style.max-height-500}">
<b:Fieldset addStyleNames="form-fieldset-edit"> <b:Form type="INLINE">
<b:ControlGroup> <b:Fieldset addStyleNames="form-fieldset-edit">
<b:ControlLabel>Section</b:ControlLabel> <b:ControlGroup>
<b:Controls> <b:ControlLabel>Section</b:ControlLabel>
<b:ListBox ui:field="listBoxPaths"></b:ListBox> <b:Controls>
</b:Controls> <b:ListBox ui:field="listBoxPaths"></b:ListBox>
</b:ControlGroup> </b:Controls>
<b:ControlGroup ui:field="cgSelectFile" </b:ControlGroup>
visible="false"> <b:ControlGroup ui:field="cgSelectFile"
<b:ControlLabel>Manage the content of</b:ControlLabel> visible="false">
<b:Controls ui:field="controlsContent"> <b:ControlLabel>Manage the content of</b:ControlLabel>
<!-- <b:ListBox ui:field="listBoxIndex" --> <b:Controls ui:field="controlsContent">
<!-- addStyleNames="{style.width-500}"></b:ListBox> --> <!-- <b:ListBox ui:field="listBoxIndex" -->
</b:Controls> <!-- addStyleNames="{style.width-500}"></b:ListBox> -->
</b:ControlGroup> </b:Controls>
<b:ControlGroup> </b:ControlGroup>
<g:ScrollPanel> <b:ControlGroup>
<g:HTMLPanel ui:field="uploadFileContainer" addStyleNames="upload-file-container"></g:HTMLPanel> <g:ScrollPanel>
</g:ScrollPanel> <g:HTMLPanel ui:field="uploadFileContainer"
</b:ControlGroup> addStyleNames="upload-file-container"></g:HTMLPanel>
</b:Fieldset> </g:ScrollPanel>
</b:Form> </b:ControlGroup>
</b:Fieldset>
</b:Form>
</g:ScrollPanel>
<b:Button icon="SAVE" type="INFO" <b:Button icon="SAVE" type="INFO"
addStyleNames="{style.button-save-style}" ui:field="buttonUpdate" addStyleNames="{style.button-save-style}" ui:field="buttonUpdate"
visible="false">UPDATE</b:Button> visible="false">UPDATE</b:Button>

View File

@ -822,7 +822,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.info("Publishings itemId: "+itemId); LOG.info("Publishings itemId: "+itemId);
concessione = clientMongo.publish(itemId); concessione = clientMongo.publish(itemId);
LOG.trace("returning concessione: "+concessione); LOG.debug("returning concessione: "+concessione);
return ConvertToDataViewModel.toConcessione(concessione); return ConvertToDataViewModel.toConcessione(concessione);
} }

View File

@ -112,8 +112,10 @@ h1 {
.upload-file-container .control-group { .upload-file-container .control-group {
display: inline-flex; display: inline-flex;
width: 95%;
} }
.upload-file-container .control-group div { .upload-file-container .control-group div {
margin-left: 10px; margin-left: 10px;
width: 95%;
} }