#21990 completed edit mode for registerFileSet

pull/4/head
Francesco Mangiacrapa 3 years ago
parent 3bda56a55c
commit 9690b09cb1

@ -8,44 +8,44 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
#### Enhancements
[#20435] Client integration with MongoConcessioni
Moved to maven-portal-bom 3.6.3
[#21856] Implemented new user feedback
[#21890] Passed to mongoID
[#20599] Get List of Records
[#22002] Integrated with ValidationReport and status
[#21990] Provide the (first version of) edit mode
[#22040] Revisited the "Abstract Relazione di Scavo"
- [#20435] Client integration with MongoConcessioni
- Moved to maven-portal-bom 3.6.3
- [#21856] Implemented new user feedback
- [#21890] Passed to mongoID
- [#20599] Get List of Records
- [#22002] Integrated with ValidationReport and status
- [#21990] Provide the (first version of) edit mode
- [#22040] Revisited the "Abstract Relazione di Scavo"
## [v1.2.0] - 2020-12-18
#### Enhancements
[#20357] new requirements
- [#20357] new requirements
## [v1.1.0] - 2020-12-1
#### 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
#### 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
#### Bug fixes
[#20063] Fixes for data-entry components
- [#20063] Fixes for data-entry components
## [v1.0.0] - 2020-10-07
[#19916] First release
- [#19916] First release

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

@ -1,13 +1,19 @@
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.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
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.RECORD_TYPE;
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.ActionOnItemEventHandler;
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 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.ui.Composite;
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;
/**
@ -40,7 +46,7 @@ public class EditModeRecord extends Composite {
@UiField
Tab tabRawUpdate;
@UiField
Tab tabUploadFiles;
@ -48,7 +54,7 @@ public class EditModeRecord extends Composite {
FlowPanel rawUpdatePanel;
@UiField
ScrollPanel filesUpdatePanel;
HTMLPanel filesUpdatePanel;
@UiField
Button buttonJSONUpdate;
@ -60,6 +66,8 @@ public class EditModeRecord extends Composite {
private JSONEditorWrapper jsEditor;
private HandlerManager appManagerBus;
private final HandlerManager editorManagerBus = new HandlerManager(null);
/**
* The Interface EditModeRecordUiBinder.
@ -84,7 +92,7 @@ public class EditModeRecord extends Composite {
this.recordType = type;
this.appManagerBus = appManagerBus;
this.filesUpdatePanel.setHeight("490px");
//filesUpdatePanel.getElement().getStyle().setProperty("maxHeight", "550px");
// filesUpdatePanel.getElement().getStyle().setProperty("maxHeight", "550px");
instanceJSONEditor();
instanceUpdateFilesetEditor();
@ -102,7 +110,8 @@ public class EditModeRecord extends Composite {
@Override
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);
}
});
@ -114,7 +123,7 @@ public class EditModeRecord extends Composite {
rawUpdatePanel.clear();
final FlowPanel fp = new FlowPanel();
fp.getElement().setId("jsoneditor" + Random.nextInt());
fp.setHeight("400px");
fp.setHeight("410px");
rawUpdatePanel.add(fp);
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType,
@ -150,6 +159,7 @@ public class EditModeRecord extends Composite {
* Bind events.
*/
private void bindEvents() {
buttonJSONUpdate.addClickHandler(new ClickHandler() {
@Override
@ -171,7 +181,7 @@ public class EditModeRecord extends Composite {
// TODO: handle exception
}
appManagerBus.fireEvent(
editorManagerBus.fireEvent(
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
}
@ -185,17 +195,38 @@ public class EditModeRecord extends Composite {
} catch (Exception e) {
// TODO: handle exception
}
selectedConcessione = result;
instanceJSONEditor();
Window.alert("Project '" + result.getNome() + "' updated correctly");
appManagerBus.fireEvent(
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
DialogInform di = new DialogInform(null, "Project updated!", "Project '" + result.getNome() + "' updated correctly");
di.setZIndex(100000);
di.center();
editorManagerBus.fireEvent(
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));
}
}
}
});
}
}

@ -21,7 +21,7 @@
<g:HTMLPanel>
<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">
<b:Heading size="3">Source Project Editor</b:Heading>
<b:Label type="INFO">You can update the Source Project by editing
@ -66,8 +66,8 @@
them persistent on the service
</p>
</g:HTML>
<g:ScrollPanel ui:field="filesUpdatePanel">
</g:ScrollPanel>
<g:HTMLPanel ui:field="filesUpdatePanel">
</g:HTMLPanel>
</b:Tab>
</b:TabPanel>
</g:HTMLPanel>

@ -1,6 +1,7 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
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.RelazioneScavoDV;
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.GeoPortalDataEntryApp;
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.DialogInform;
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 {
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);
@ -110,14 +123,22 @@ public class UpdateFileset extends Composite {
private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
private Map<Integer, List<WorkspaceContentDV>> mapWSContentListBox = null;
private HandlerManager editorManagerBus;
/**
* 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(BaseConcessioneDV selectedConcessione, RECORD_TYPE recordType, List<String> listFileSetPaths) {
public UpdateFileset(HandlerManager editorManagerBus, BaseConcessioneDV selectedConcessione, RECORD_TYPE recordType, List<String> listFileSetPaths) {
initWidget(uiBinder.createAndBindUi(this));
this.editorManagerBus = editorManagerBus;
this.selectedConcessione = selectedConcessione;
this.recordType = recordType;
this.listFileSetPaths = listFileSetPaths;
@ -208,11 +229,10 @@ public class UpdateFileset extends Composite {
dialogConfirm.hide();
buttonUpdate.setEnabled(false);
final DialogInform dialogInf = new DialogInform(null, "Updating Project", "");
final DialogInform dialogInf = new DialogInform(null, "Updating Project...", "");
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.center();
GeoportalDataEntryServiceAsync.Util.getInstance().updateSectionForRecord(
fullConcessione.getItemId(), fullConcessione.getRecordType(),
@ -237,8 +257,11 @@ public class UpdateFileset extends Composite {
dialogInf.setMsg(result.getNome() + " updated correclty");
dialogInf.center();
fullConcessione = result;
GWT.log("new concessione: "+fullConcessione);
buttonUpdate.setEnabled(true);
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;
pathIndex = null;
mapForCCUploading = null;
mapWSContentListBox = null;
// listBoxIndex.clear();
cgSelectFile.setVisible(true);
@ -275,60 +299,76 @@ public class UpdateFileset extends Composite {
ListBox listBoxContentIndex = new ListBox();
listBoxContentIndex.setWidth(_FORM_WIDTH_FIELDS_SIZE);
listBoxContentIndex.addItem("Select a content...");
if (listBoxPaths.getSelectedItemText().contains("abstract_relazione")) {
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("abstract_relazione" + " NOT AVAILABLE", LabelType.WARNING);
showMessage(SECTION_ABSTRACT_RELAZIONE + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return;
}
int posizIndex = 0;
fillListBoxToBeReplaced(listBoxContentIndex, "abstract_relazione", posizIndex, ar.getTitolo(),
fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, ar.getTitolo(),
ar.getListWsContent());
} else if (listBoxPaths.getSelectedItemText().contains("immagini")) {
} else if (listBoxPaths.getSelectedItemText().contains(SECTION_IMMAGINI)) {
section = SECTION_IMMAGINI;
List<UploadedImageDV> listImmagini = fullConcessione.getImmaginiRappresentative();
if (listImmagini == null || listImmagini.isEmpty()) {
showMessage("immagini" + " NOT AVAILABLE", LabelType.WARNING);
showMessage(SECTION_IMMAGINI + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return;
}
int posizIndex = 0;
for (UploadedImageDV uploadedImageDV : listImmagini) {
fillListBoxToBeReplaced(listBoxContentIndex, "immagini", posizIndex, uploadedImageDV.getTitolo(),
fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, uploadedImageDV.getTitolo(),
uploadedImageDV.getListWsContent());
posizIndex++;
}
} else if (listBoxPaths.getSelectedItemText().contains("relazione")) {
RelazioneScavoDV realzione = fullConcessione.getRelazioneScavo();
if (realzione == null || realzione.getListWsContent() == null) {
showMessage("relazione" + " NOT AVAILABLE", LabelType.WARNING);
} 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;
}
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();
if (posiz == null || posiz.getListWsContent() == null || posiz.getListWsContent().isEmpty()) {
showMessage("posizionamentoScavo" + " NOT AVAILABLE", LabelType.WARNING);
if (posiz == null) {
showMessage(SECTION_POSIZIONAMENTO_SCAVO + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return;
}
int posizIndex = 0;
fillListBoxToBeReplaced(listBoxContentIndex, "posizionamentoScavo", posizIndex, posiz.getTitolo(),
fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, posiz.getTitolo(),
posiz.getListWsContent());
} else if (listBoxPaths.getSelectedItemText().contains("piante")) {
} else if (listBoxPaths.getSelectedItemText().contains(SECTION_PIANTE)) {
section = SECTION_PIANTE;
List<LayerConcessioneDV> piante = fullConcessione.getPianteFineScavo();
if (piante == null || piante.isEmpty()) {
showMessage("piante" + " NOT AVAILABLE", LabelType.WARNING);
showMessage(SECTION_PIANTE + " NOT AVAILABLE", LabelType.WARNING);
// pathIndex = 0;
// showNewFileUpload();
return;
}
int posizIndex = 0;
for (LayerConcessioneDV lcDV : piante) {
fillListBoxToBeReplaced(listBoxContentIndex, "piante", posizIndex, lcDV.getTitolo(),
fillListBoxToBeReplaced(listBoxContentIndex, SECTION_PIANTE, posizIndex, lcDV.getTitolo(),
lcDV.getListWsContent());
posizIndex++;
}
@ -348,13 +388,21 @@ public class UpdateFileset extends Composite {
private void fillListBoxToBeReplaced(ListBox listBoxContentIndex, String section, int posizIndex, String title,
List<WorkspaceContentDV> listWSC) {
GWT.log("fillListBoxToBeReplaced called, posizIndex: "+posizIndex+", listWSC: "+listWSC);
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;
}
if(mapWSContentListBox==null) {
mapWSContentListBox = new HashMap<Integer, List<WorkspaceContentDV>>();
}
listBoxContentIndex.addItem(title, posizIndex + "");
mapWSContentListBox.put(posizIndex, listWSC);
// adding handler once
if (posizIndex == 0) {
@ -363,13 +411,15 @@ public class UpdateFileset extends Composite {
@Override
public void onChange(ChangeEvent event) {
GWT.log("listBoxContentIndex changed, posizIndex: "+posizIndex);
if (placeholderListBoxIndex) {
listBoxContentIndex.removeItem(0); // this is the placeholder, removing it once
placeholderListBoxIndex = false;
}
showFileBrowseInteraction(listBoxContentIndex.getSelectedIndex(), listWSC);
int selectedIndex = listBoxContentIndex.getSelectedIndex();
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) {
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());
@ -424,6 +476,12 @@ public class UpdateFileset extends Composite {
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);

@ -11,31 +11,38 @@
margin-top: 10px;
float: right;
}
.max-height-500 {
max-height: 450px;
}
</ui:style>
<g:HTMLPanel>
<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 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>

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

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

Loading…
Cancel
Save