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

View File

@ -56,9 +56,9 @@
</b:Tab>
<b:Tab icon="UPLOAD_ALT" heading="Update File/s"
ui:field="tabUploadFiles">
<b:Heading size="3">Update the file/s</b:Heading>
<b:Label type="INFO">By choosing a section (e.g. "relazione") and
uploading new file/s the old one/s will be replaced</b:Label>
<b:Heading size="3">Manage the file/s</b:Heading>
<b:Label type="INFO">You can choose a section (e.g. "piante") and
manage the existing file/s (by removing it/them) and uploading new one/s</b:Label>
<g:HTML addStyleNames="{style.info-panel}">
<p style='color: #585858'>
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;
import java.util.ArrayList;
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;
@ -25,6 +27,7 @@ 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.Style.Unit;
@ -52,7 +55,7 @@ import com.google.gwt.user.client.ui.Widget;
*/
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);
@ -96,9 +99,11 @@ public class UpdateFileset extends Composite {
private HandlerManager uiBus = new HandlerManager(null);
private MetaDataField fieldUploadWidget;
private Integer pathIndex = null;
private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
/**
* Instantiates a new update fileset.
*
@ -113,7 +118,7 @@ public class UpdateFileset extends Composite {
for (String path : listFileSetPaths) {
listBoxPaths.addItem(path);
}
listBoxPaths.setWidth(_FORM_FIELDS_SIZE);
listBoxPaths.setWidth(_FORM_WIDTH_FIELDS_SIZE);
// add handler on select
listBoxPaths.addChangeHandler(new ChangeHandler() {
@ -190,12 +195,13 @@ public class UpdateFileset extends Composite {
placeholderListBoxIndex = true;
fieldUploadWidget = null;
pathIndex = null;
mapForCCUploading = null;
// listBoxIndex.clear();
cgSelectFile.setVisible(true);
ListBox listBoxContentIndex = new ListBox();
listBoxContentIndex.setWidth(_FORM_FIELDS_SIZE);
listBoxContentIndex.setWidth(_FORM_WIDTH_FIELDS_SIZE);
listBoxContentIndex.addItem("Select a content...");
if (listBoxPaths.getSelectedItemText().contains("abstract_relazione")) {
@ -250,13 +256,20 @@ public class UpdateFileset extends Composite {
}
int posizIndex = 0;
for (LayerConcessioneDV lcDV : piante) {
fillListBoxToBeReplaced(listBoxContentIndex, "piante", posizIndex, lcDV.getTitolo(), lcDV.getListWsContent());
fillListBoxToBeReplaced(listBoxContentIndex, "piante", posizIndex, lcDV.getTitolo(),
lcDV.getListWsContent());
posizIndex++;
}
}
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) {
uploadFileContainer.clear();
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) {
FlexTable table = new FlexTable();
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, 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 (WorkspaceContentDV wsContent : listWSC) {
for (final WorkspaceContentDV wsContent : listWSC) {
table.setHTML(i, 0, wsContent.getName());
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);
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++;
}
@ -316,7 +353,8 @@ public class UpdateFileset extends Composite {
HTML label = new HTML();
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);
// mDU = new MultipleDilaogUpload();
@ -328,12 +366,10 @@ public class UpdateFileset extends Composite {
try {
fieldUploadWidget = new MetaDataField(uploadField, uiBus);
// BrowseFilePanel fieldsetContent = new BrowseFilePanel(fieldUploadWidget);
uploadFileContainer.add(fieldUploadWidget);
buttonUpdate.setVisible(true);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

View File

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

View File

@ -48,7 +48,7 @@ public class BuildValidationReport extends FlowPanel {
break;
}
rTToHTML = new ReportTemplateToHTML(validationReport.getAsJSONString());
rTToHTML = new ReportTemplateToHTML(validationReport.getAsJSONString(), true);
add(recordPublished);
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 com.github.gwtbootstrap.client.ui.AccordionGroup;
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.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
@ -41,6 +47,9 @@ public class ReportTemplateToHTML extends Composite {
@UiField
VerticalPanel htmlContainer;
@UiField
AccordionGroup showReportAsJSON;
@UiField
Paragraph reportJSON;
@ -52,9 +61,37 @@ public class ReportTemplateToHTML extends Composite {
*
* @param reportAsJSON the report as JSON
*/
public ReportTemplateToHTML(String reportAsJSON) {
public ReportTemplateToHTML(String reportAsJSON, boolean openJSONReport) {
initWidget(uiBinder.createAndBindUi(this));
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) {
GWT.log("report is: " + reportAsJSON);
vpContainer.setVisible(true);

View File

@ -17,7 +17,7 @@
<b:Label>Publication Report: </b:Label>
<g:VerticalPanel ui:field="htmlContainer"
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:AccordionGroup>

View File

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