Rendering list of files

This commit is contained in:
Francesco Mangiacrapa 2022-10-11 16:10:46 +02:00
parent 6363c2ea5e
commit aba4e0dca0
4 changed files with 58 additions and 16 deletions

View File

@ -131,6 +131,9 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -2,10 +2,14 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.view.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery.ImagesSectionGallery;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import com.github.gwtbootstrap.client.ui.PageHeader;
import com.google.gwt.core.client.GWT;
@ -57,9 +61,41 @@ public class SectionViewer extends Composite {
for (SubDocumentView subDocumentView : subDocuments) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
sectionPanelContainer.add(new HTML(table));
List<FilesetDV> files = subDocumentView.getListFiles();
if(files!=null) {
for (FilesetDV fileset : files) {
showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
}
}
}
}
}
private void showLinkToDownloadWsContent(String title, List<PayloadDV> listPayloads) {
if (listPayloads != null) {
CustomFlexTable customTable = new CustomFlexTable();
int i = 0;
String fieldLabel = title;
for (PayloadDV payload : listPayloads) {
if (i > 0) {
fieldLabel = "";
}
String downloadLabel = "download";
if(payload.getName()!=null) {
downloadLabel = payload.getName();
}
customTable.addNextKeyWidget(fieldLabel, new HTML(
"<a href=\"" + payload.getLink() + "\">" + downloadLabel + "</a>"));
}
sectionPanelContainer.add(customTable);
}
}
}

View File

@ -23,7 +23,7 @@ public class CustomFlexTable extends FlexTable {
*/
public CustomFlexTable() {
this.getElement().addClassName("my-custom-flex-table");
this.getElement().addClassName("my-html-table");
}

View File

@ -105,23 +105,23 @@ body {
text-align: justify;
}
#page-view-details .my-custom-flex-table {
margin-left: 10px;
/*margin-right: 40px;*/
font-size: 13px;
max-width: 95%;
}
/* #page-view-details .my-custom-flex-table { */
/* margin-left: 10px; */
/* /*margin-right: 40px;*/ */
/* font-size: 13px; */
/* max-width: 95%; */
/* } */
#page-view-details .my-custom-flex-table td {
padding-top: 5px;
padding-bottom: 5px;
}
/* #page-view-details .my-custom-flex-table td { */
/* padding-top: 5px; */
/* padding-bottom: 5px; */
/* } */
#page-view-details .my-custom-flex-table tbody tr>td:first-child {
color: gray;
font-weight: bold;
width: 200px;
}
/* #page-view-details .my-custom-flex-table tbody tr>td:first-child { */
/* color: gray; */
/* font-weight: bold; */
/* width: 200px; */
/* } */
.ol-mouse-position {
top: 8px !important;
@ -516,6 +516,9 @@ body {
margin-left: 10px;
margin-bottom: 10px;
margin-right: 5px;
font-size: 13px;
max-width: 95%;
word-break: break-word;
}
.my-html-table td {