From aba4e0dca0681afb883f05aa1a964a296703165c Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 11 Oct 2022 16:10:46 +0200 Subject: [PATCH] Rendering list of files --- .settings/org.eclipse.wst.common.component | 3 ++ .../client/ui/cms/project/SectionViewer.java | 36 +++++++++++++++++++ .../client/ui/util/CustomFlexTable.java | 2 +- src/main/webapp/GeoportalDataViewer.css | 33 +++++++++-------- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 321953b..1f1af12 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -131,6 +131,9 @@ + + uses + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/SectionViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/SectionViewer.java index d53b19f..5be0a0d 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/SectionViewer.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/SectionViewer.java @@ -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 files = subDocumentView.getListFiles(); + if(files!=null) { + for (FilesetDV fileset : files) { + showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload()); + } + } } } } + + private void showLinkToDownloadWsContent(String title, List 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( + "" + downloadLabel + "")); + } + + sectionPanelContainer.add(customTable); + } + } } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/util/CustomFlexTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/util/CustomFlexTable.java index 46f1d65..50ca3bc 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/util/CustomFlexTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/util/CustomFlexTable.java @@ -23,7 +23,7 @@ public class CustomFlexTable extends FlexTable { */ public CustomFlexTable() { - this.getElement().addClassName("my-custom-flex-table"); + this.getElement().addClassName("my-html-table"); } diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index e29ca97..7721f19 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -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 {