in progress on edit mode

This commit is contained in:
Francesco Mangiacrapa 2021-09-30 13:06:14 +02:00
parent 765ca9f621
commit b4ec07371b
9 changed files with 145 additions and 60 deletions

View File

@ -387,7 +387,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
// resetUI(); // resetUI();
if (vr.getAsJSONString() != null) { if (vr.getAsJSONString() != null) {
modalContainerPanel.add(new ReportTemplateToHTML(vr.getAsJSONString())); modalContainerPanel.add(new ReportTemplateToHTML(vr.getAsJSONString(), false));
} }
} }

View File

@ -70,46 +70,49 @@
</b:Tab> </b:Tab>
<b:Tab icon="TABLE" heading="List of Projects" <b:Tab icon="TABLE" heading="List of Projects"
ui:field="tabGetListOfProjects"> ui:field="tabGetListOfProjects">
<g:ScrollPanel> <g:FlowPanel>
<g:HTMLPanel ui:field="contTabGetListOfProjects"> <g:FlowPanel addStyleNames="move-sticky">
<b:Navbar addStyleNames="{style.margin-botttom-5}"> <b:NavPills>
<b:Brand addStyleNames="{style.margin-top-5}">List of Projects</b:Brand> <b:NavLink ui:field="navShowOnMap" title="Show on Map"
<b:Nav> icon="MAP_MARKER">Show on Map</b:NavLink>
<b:Dropdown text="Sort by" ui:field="dropdownSortBy"> <b:NavLink ui:field="navShowReport"
</b:Dropdown> title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>
</b:Nav> <b:NavLink ui:field="navEditMode" title="Edit"
<b:Nav> icon="PENCIL">Edit</b:NavLink>
<b:TextBox ui:field="textBoxSortBy" readOnly="true" <b:NavLink ui:field="navDelete" title="Delete Project"
addStyleNames="{style.margin-top-8}"></b:TextBox> icon="TRASH">Delete Project</b:NavLink>
</b:Nav> </b:NavPills>
<b:Nav> </g:FlowPanel>
<b:NavLink ui:field="buttonReloadConcessioni" <g:ScrollPanel>
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink> <g:HTMLPanel ui:field="contTabGetListOfProjects">
</b:Nav> <b:Navbar addStyleNames="{style.margin-botttom-5}">
</b:Navbar> <b:Brand addStyleNames="{style.margin-top-5}">List of Projects</b:Brand>
<g:FlowPanel addStyleNames="move-sticky"> <b:Nav>
<b:NavPills> <b:Dropdown text="Sort by" ui:field="dropdownSortBy">
<b:NavLink ui:field="navShowOnMap" title="Show on Map" </b:Dropdown>
icon="MAP_MARKER">Show on Map</b:NavLink> </b:Nav>
<b:NavLink ui:field="navShowReport" <b:Nav>
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink> <b:TextBox ui:field="textBoxSortBy" readOnly="true"
<b:NavLink ui:field="navEditMode" title="Edit" addStyleNames="{style.margin-top-8}"></b:TextBox>
icon="PENCIL">Edit</b:NavLink> </b:Nav>
<b:NavLink ui:field="navDelete" title="Delete Project" <b:Nav>
icon="TRASH">Delete Project</b:NavLink> <b:NavLink ui:field="buttonReloadConcessioni"
</b:NavPills> title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
</g:FlowPanel> </b:Nav>
<g:HTMLPanel addStyleNames="{style.float-right}"> </b:Navbar>
<div id="topPage2"></div>
<a href="#bottomPage2">Go to bottom</a> <g:HTMLPanel addStyleNames="{style.float-right}">
<div id="topPage2"></div>
<a href="#bottomPage2">Go to bottom</a>
</g:HTMLPanel>
<g:HTMLPanel ui:field="geonaListOfConcessioniPanel"></g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage2"></div>
<a href="#topPage2">Go to top</a>
</g:HTMLPanel>
</g:HTMLPanel> </g:HTMLPanel>
<g:HTMLPanel ui:field="geonaListOfConcessioniPanel"></g:HTMLPanel> </g:ScrollPanel>
<g:HTMLPanel addStyleNames="{style.float-right}"> </g:FlowPanel>
<div id="bottomPage2"></div>
<a href="#topPage2">Go to top</a>
</g:HTMLPanel>
</g:HTMLPanel>
</g:ScrollPanel>
</b:Tab> </b:Tab>
</b:TabPanel> </b:TabPanel>
</g:HTMLPanel> </g:HTMLPanel>

View File

@ -56,9 +56,9 @@
</b:Tab> </b:Tab>
<b:Tab icon="UPLOAD_ALT" heading="Update File/s" <b:Tab icon="UPLOAD_ALT" heading="Update File/s"
ui:field="tabUploadFiles"> ui:field="tabUploadFiles">
<b:Heading size="3">Update the file/s</b:Heading> <b:Heading size="3">Manage the file/s</b:Heading>
<b:Label type="INFO">By choosing a section (e.g. "relazione") and <b:Label type="INFO">You can choose a section (e.g. "piante") and
uploading new file/s the old one/s will be replaced</b:Label> manage the existing file/s (by removing it/them) and uploading new one/s</b:Label>
<g:HTML addStyleNames="{style.info-panel}"> <g:HTML addStyleNames="{style.info-panel}">
<p style='color: #585858'> <p style='color: #585858'>
At the end of the changes press the "Update" button to At the end of the changes press the "Update" button to

View File

@ -1,7 +1,9 @@
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.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
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;
@ -25,6 +27,7 @@ import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.Controls; import com.github.gwtbootstrap.client.ui.Controls;
import com.github.gwtbootstrap.client.ui.Label; import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.ListBox; 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.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
@ -52,7 +55,7 @@ import com.google.gwt.user.client.ui.Widget;
*/ */
public class UpdateFileset extends Composite { public class UpdateFileset extends Composite {
private static final String _FORM_FIELDS_SIZE = "740px"; 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);
@ -96,9 +99,11 @@ public class UpdateFileset extends Composite {
private HandlerManager uiBus = new HandlerManager(null); private HandlerManager uiBus = new HandlerManager(null);
private MetaDataField fieldUploadWidget; private MetaDataField fieldUploadWidget;
private Integer pathIndex = null; private Integer pathIndex = null;
private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
/** /**
* Instantiates a new update fileset. * Instantiates a new update fileset.
* *
@ -113,7 +118,7 @@ public class UpdateFileset extends Composite {
for (String path : listFileSetPaths) { for (String path : listFileSetPaths) {
listBoxPaths.addItem(path); listBoxPaths.addItem(path);
} }
listBoxPaths.setWidth(_FORM_FIELDS_SIZE); listBoxPaths.setWidth(_FORM_WIDTH_FIELDS_SIZE);
// add handler on select // add handler on select
listBoxPaths.addChangeHandler(new ChangeHandler() { listBoxPaths.addChangeHandler(new ChangeHandler() {
@ -190,12 +195,13 @@ public class UpdateFileset extends Composite {
placeholderListBoxIndex = true; placeholderListBoxIndex = true;
fieldUploadWidget = null; fieldUploadWidget = null;
pathIndex = null; pathIndex = null;
mapForCCUploading = null;
// listBoxIndex.clear(); // listBoxIndex.clear();
cgSelectFile.setVisible(true); cgSelectFile.setVisible(true);
ListBox listBoxContentIndex = new ListBox(); ListBox listBoxContentIndex = new ListBox();
listBoxContentIndex.setWidth(_FORM_FIELDS_SIZE); listBoxContentIndex.setWidth(_FORM_WIDTH_FIELDS_SIZE);
listBoxContentIndex.addItem("Select a content..."); listBoxContentIndex.addItem("Select a content...");
if (listBoxPaths.getSelectedItemText().contains("abstract_relazione")) { if (listBoxPaths.getSelectedItemText().contains("abstract_relazione")) {
@ -250,13 +256,20 @@ public class UpdateFileset extends Composite {
} }
int posizIndex = 0; int posizIndex = 0;
for (LayerConcessioneDV lcDV : piante) { for (LayerConcessioneDV lcDV : piante) {
fillListBoxToBeReplaced(listBoxContentIndex, "piante", posizIndex, lcDV.getTitolo(), lcDV.getListWsContent()); fillListBoxToBeReplaced(listBoxContentIndex, "piante", posizIndex, lcDV.getTitolo(),
lcDV.getListWsContent());
posizIndex++; posizIndex++;
} }
} }
controlsContent.add(listBoxContentIndex); controlsContent.add(listBoxContentIndex);
if(listBoxContentIndex.getItemCount()==1) {
listBoxContentIndex.setSelectedIndex(0);
listBoxContentIndex.setSelectedValue(listBoxContentIndex.getItemText(0));
}
} }
@ -294,7 +307,16 @@ 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;
// 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) { if (listWSC.size() > 0) {
FlexTable table = new FlexTable(); FlexTable table = new FlexTable();
table.addStyleName("table-current-content"); table.addStyleName("table-current-content");
@ -302,12 +324,27 @@ public class UpdateFileset extends Composite {
table.setHTML(1, 0, "<span style='color:rgb(155, 80, 78);'>Filename</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, 1, "<span style='color:rgb(155, 80, 78);'>MimeType<span>");
table.setHTML(1, 2, "<span style='color:rgb(155, 80, 78);'>Link</span>"); table.setHTML(1, 2, "<span style='color:rgb(155, 80, 78);'>Link</span>");
int i = 2; int i = 2;
for (WorkspaceContentDV wsContent : listWSC) { for (final WorkspaceContentDV wsContent : listWSC) {
table.setHTML(i, 0, wsContent.getName()); table.setHTML(i, 0, wsContent.getName());
table.setHTML(i, 1, wsContent.getMimetype()); table.setHTML(i, 1, wsContent.getMimetype());
String link = "<a href=" + wsContent.getLink() + ">Download</a>"; String link = "<a target=\"_blank\" href=" + wsContent.getLink() + ">View</a>";
table.setHTML(i, 2, link); 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++; i++;
} }
@ -316,7 +353,8 @@ public class UpdateFileset extends Composite {
HTML label = new HTML(); HTML label = new HTML();
label.getElement().getStyle().setMarginTop(10, Unit.PX); label.getElement().getStyle().setMarginTop(10, Unit.PX);
label.setHTML("<b>With new content:</b>"); label.getElement().getStyle().setMarginBottom(10, Unit.PX);
label.setHTML("<b>Add new file/s:</b>");
uploadFileContainer.add(label); uploadFileContainer.add(label);
// mDU = new MultipleDilaogUpload(); // mDU = new MultipleDilaogUpload();
@ -328,12 +366,10 @@ public class UpdateFileset extends Composite {
try { try {
fieldUploadWidget = new MetaDataField(uploadField, uiBus); fieldUploadWidget = new MetaDataField(uploadField, uiBus);
// BrowseFilePanel fieldsetContent = new BrowseFilePanel(fieldUploadWidget);
uploadFileContainer.add(fieldUploadWidget); uploadFileContainer.add(fieldUploadWidget);
buttonUpdate.setVisible(true); buttonUpdate.setVisible(true);
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -23,7 +23,7 @@
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup ui:field="cgSelectFile" <b:ControlGroup ui:field="cgSelectFile"
visible="false"> visible="false">
<b:ControlLabel>Replace the content</b:ControlLabel> <b:ControlLabel>Manage the content of</b:ControlLabel>
<b:Controls ui:field="controlsContent"> <b:Controls ui:field="controlsContent">
<!-- <b:ListBox ui:field="listBoxIndex" --> <!-- <b:ListBox ui:field="listBoxIndex" -->
<!-- addStyleNames="{style.width-500}"></b:ListBox> --> <!-- addStyleNames="{style.width-500}"></b:ListBox> -->
@ -31,7 +31,7 @@
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup> <b:ControlGroup>
<g:ScrollPanel> <g:ScrollPanel>
<g:HTMLPanel ui:field="uploadFileContainer"></g:HTMLPanel> <g:HTMLPanel ui:field="uploadFileContainer" addStyleNames="upload-file-container"></g:HTMLPanel>
</g:ScrollPanel> </g:ScrollPanel>
</b:ControlGroup> </b:ControlGroup>
</b:Fieldset> </b:Fieldset>

View File

@ -48,7 +48,7 @@ public class BuildValidationReport extends FlowPanel {
break; break;
} }
rTToHTML = new ReportTemplateToHTML(validationReport.getAsJSONString()); rTToHTML = new ReportTemplateToHTML(validationReport.getAsJSONString(), true);
add(recordPublished); add(recordPublished);
add(rTToHTML); add(rTToHTML);

View File

@ -2,7 +2,13 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.report;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.ExternalLib; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.ExternalLib;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.github.gwtbootstrap.client.ui.Paragraph; import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.event.HiddenEvent;
import com.github.gwtbootstrap.client.ui.event.HiddenHandler;
import com.github.gwtbootstrap.client.ui.event.ShowEvent;
import com.github.gwtbootstrap.client.ui.event.ShowHandler;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject; import com.google.gwt.json.client.JSONObject;
@ -41,6 +47,9 @@ public class ReportTemplateToHTML extends Composite {
@UiField @UiField
VerticalPanel htmlContainer; VerticalPanel htmlContainer;
@UiField
AccordionGroup showReportAsJSON;
@UiField @UiField
Paragraph reportJSON; Paragraph reportJSON;
@ -52,9 +61,37 @@ public class ReportTemplateToHTML extends Composite {
* *
* @param reportAsJSON the report as JSON * @param reportAsJSON the report as JSON
*/ */
public ReportTemplateToHTML(String reportAsJSON) { public ReportTemplateToHTML(String reportAsJSON, boolean openJSONReport) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
vpContainer.setVisible(false); vpContainer.setVisible(false);
showReportAsJSON.setDefaultOpen(openJSONReport);
//showReportAsJSON.setIconPosition(IconPosition.RIGHT);
if(openJSONReport) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
}else {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
}
showReportAsJSON.addShowHandler(new ShowHandler() {
@Override
public void onShow(ShowEvent showEvent) {
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
}
});
showReportAsJSON.addHiddenHandler(new HiddenHandler() {
@Override
public void onHidden(HiddenEvent hiddenEvent) {
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
}
});
if (reportAsJSON != null) { if (reportAsJSON != null) {
GWT.log("report is: " + reportAsJSON); GWT.log("report is: " + reportAsJSON);
vpContainer.setVisible(true); vpContainer.setVisible(true);

View File

@ -17,7 +17,7 @@
<b:Label>Publication Report: </b:Label> <b:Label>Publication Report: </b:Label>
<g:VerticalPanel ui:field="htmlContainer" <g:VerticalPanel ui:field="htmlContainer"
addStyleNames="{style.margin-top-10}"></g:VerticalPanel> addStyleNames="{style.margin-top-10}"></g:VerticalPanel>
<b:AccordionGroup heading="Show Report as JSON"> <b:AccordionGroup heading="Show Report as JSON" ui:field="showReportAsJSON">
<b:Paragraph ui:field="reportJSON"></b:Paragraph> <b:Paragraph ui:field="reportJSON"></b:Paragraph>
</b:AccordionGroup> </b:AccordionGroup>

View File

@ -83,7 +83,8 @@ h1 {
position: -webkit-sticky; position: -webkit-sticky;
position: sticky; position: sticky;
top: 0; top: 0;
background-color: #eeeeee; background-color: #f8f8f8;
border-radius: 20px;
} }
.modal-body-custom { .modal-body-custom {
@ -108,3 +109,11 @@ h1 {
.table-current-content td { .table-current-content td {
padding: 5px; padding: 5px;
} }
.upload-file-container .control-group {
display: inline-flex;
}
.upload-file-container .control-group div {
margin-left: 10px;
}