Improved GUI. Added Temporal Comparator

This commit is contained in:
Francesco Mangiacrapa 2022-11-18 16:50:01 +01:00
parent 20c4da197e
commit 1f3b3c2be1
8 changed files with 137 additions and 50 deletions

View File

@ -505,9 +505,6 @@ public class GeoportalDataViewer implements EntryPoint {
}
mainPanel.hideOverlayLayers();
// layerManager.getOverlayLayerManager().hide();
// hidePopupLayers();
}
});

View File

@ -171,16 +171,6 @@ public class LayerManager {
GWT.log("From querying removing layername: " + layerName + ", it is not visible");
listLO.remove(layerObject);
}
// else {
// ExtentWrapped layerExtent = olMap.getSourceExtentForLayer(layerName);
// if(layerExtent!=null) {
// ExtentWrapped centerQueryPoint = new ExtentWrapped(minX, minY, maxX,maxY);
//
// boolean contains = layerExtent.containsExtent(centerQueryPoint);
// GWT.log("layer: "+layerName + " contains the queried BBOX: "+contains);
// }
// }
//
}
}
@ -714,6 +704,13 @@ public class LayerManager {
});
}
});
// //Ordering for temporal dimension
// try {
// Collections.sort(listGeoNaDataObject, new TemporalComparatorUtil());
// }catch (Exception e) {
// // TODO: handle exception
// }
String prevProjectId = "";
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
@ -753,7 +750,7 @@ public class LayerManager {
headingPanel.add(headingProfileName);
flowPanel.add(headingPanel);
flowPanel.add(new HTML(projectIntro));
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
@ -901,8 +898,8 @@ public class LayerManager {
Object theValue = map.get(key);
String toStringValue = theValue + "";
// intFlex.setHTML(i, 0, key);
intFlex.setHTML(intFlex.getRowCount() + 1, 0,
"<span title='"+toStringValue+"'>" + StringUtil.ellipsize(toStringValue, 100) + "</span>");
intFlex.setHTML(intFlex.getRowCount() + 1, 0, "<span title='" + toStringValue + "'>"
+ StringUtil.ellipsize(toStringValue, 100) + "</span>");
// i++;
} catch (Exception e) {
// TODO: handle exception
@ -914,7 +911,7 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
}
}

View File

@ -82,5 +82,4 @@ public class ProjectUtil {
return htmlCode;
}
}

View File

@ -67,7 +67,7 @@ public class ProjectViewer extends Composite {
@UiField
HTMLPanel pageViewDetails;
@UiField
HTMLPanel projectViewerMainPanel;
@ -88,6 +88,15 @@ public class ProjectViewer extends Composite {
@UiField
Button addLayersToMap;
@UiField
HTMLPanel toc_container;
@UiField
HTMLPanel toc_list_container;
@UiField
Button reduceToc;
@UiField
UListElement toc_list_anchors;
@ -100,8 +109,6 @@ public class ProjectViewer extends Composite {
private HandlerManager applicationBus;
private HandlerManager projectViewerBus;
private String projectViewerMainPanelID;
/**
@ -110,7 +117,7 @@ public class ProjectViewer extends Composite {
private ProjectViewer() {
initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().addClassName("page-view-details");
projectViewerMainPanelID = "projectViewer-"+Random.nextInt();
projectViewerMainPanelID = "projectViewer-" + Random.nextInt();
projectViewerMainPanel.getElement().setId(projectViewerMainPanelID);
}
@ -128,7 +135,6 @@ public class ProjectViewer extends Composite {
this.theProjectView = projectView;
this.geoportalItemReferences = geoportalItemRefs;
this.applicationBus = applicationBus;
this.projectViewerBus = new HandlerManager(null);
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
? projectView.getTheProjectDV().getProfileName()
@ -223,7 +229,26 @@ public class ProjectViewer extends Composite {
public void onFailure(Throwable caught) {
}
});
reduceToc.setType(ButtonType.LINK);
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
toc_list_container.setVisible(false);
reduceToc.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
boolean visible = toc_list_container.isVisible();
if(visible) {
toc_list_container.setVisible(false);
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
}
else {
toc_list_container.setVisible(true);
reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
}
}
});
for (SectionView sectionView : projectView.getListSections()) {
if (!sectionView.isEmpty()) {
@ -248,8 +273,6 @@ public class ProjectViewer extends Composite {
}
private void addAnchorToSection(String id, String text) {
// Anchor anchor = new Anchor(text);
// anchor.setHref("#"+id);
String htmlAnchor = "<a href='#" + id + "'>" + text + "</a>";
toc_list_anchors.appendChild(new HTML("<li>" + htmlAnchor + "</li>").getElement());
}

View File

@ -28,6 +28,10 @@
.width-100 {
width: 100%;
}
.display-item-list {
display: inline-table;
}
</ui:style>
<g:HTMLPanel ui:field="projectViewerMainPanel">
<!-- <g:HTMLPanel ui:field="sharePanel" -->
@ -45,12 +49,16 @@
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="tableOfContentPanel"
visible="false">
<div id="toc_container">
<p class="toc_title">Contents</p>
<ul ui:field="toc_list_anchors" class="toc_list">
</ul>
</div>
visible="false" addStyleNames="{style.display-item-list}">
<g:HTMLPanel ui:field="toc_container"
addStyleNames="toc_container">
<b:Button ui:field="reduceToc"
addStyleNames="toc_container_reduce_button"></b:Button>
<div class="toc_title">Contents</div>
<g:HTMLPanel ui:field="toc_list_container" addStyleNames="toc_list_container">
<ul ui:field="toc_list_anchors"></ul>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>

View File

@ -5,6 +5,7 @@ import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPl
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@ -59,6 +60,7 @@ import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
import org.gcube.portlets.user.geoportaldataviewer.server.util.TemporalComparatorUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
@ -92,14 +94,8 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@SuppressWarnings("serial")
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements GeoportalDataViewerService {
// private static final String TIMELINE_CONFIG_TJT_DOCUMENT =
// UseCaseDescriptorCaller.TIMELINE_CONFIG_TJT_DOCUMENT;
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
// private static final String CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE =
// "MAP_IMAGE_PREVIEW_FOR_CONCESSIONE";
/**
* The Enum COMMON_IMAGES_FORMAT.
*
@ -1075,6 +1071,13 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
+ " feature/s");
listDAO.add(geoDAO);
// Ordering for temporal dimension
try {
Collections.sort(listDAO, new TemporalComparatorUtil());
} catch (Exception e) {
// silent
}
}
default:

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.user.geoportaldataviewer.server.util;
import java.util.Comparator;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
/**
* The Class TemporalComparatorUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 18, 2022
*/
public class TemporalComparatorUtil implements Comparator<GeoNaSpatialQueryResult> {
/**
* Compare.
*
* @param a the a
* @param b the b
* @return the int
*/
@Override
public int compare(GeoNaSpatialQueryResult a, GeoNaSpatialQueryResult b) {
if (a == null || a.getSourceLayerObject() == null || a.getSourceLayerObject().getProjectDV() == null) {
return -1;
}
if (b == null || b.getSourceLayerObject() == null || b.getSourceLayerObject().getProjectDV() == null) {
return 1;
}
ProjectDV project1 = a.getSourceLayerObject().getProjectDV();
ProjectDV project2 = b.getSourceLayerObject().getProjectDV();
if (project1.getTemporalReference() == null || project1.getTemporalReference().getStart() == null)
return -1;
if (project2.getTemporalReference() == null || project2.getTemporalReference().getStart() == null)
return 1;
return project1.getTemporalReference().getStart().compareTo(project2.getTemporalReference().getStart());
}
}

View File

@ -25,14 +25,15 @@ body {
position: absolute;
background-color: white;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
padding: 15px;
border-radius: 10px;
padding: 10px;
border-radius: 2px;
border: 1px solid #cccccc;
bottom: 12px;
left: -50px;
min-width: 280px;
max-width: 500px;
visibility: hidden;
padding-top: 20px;
}
.ol-popup img {
@ -70,11 +71,11 @@ body {
position: absolute;
top: 2px;
right: 8px;
font-size: 12px;
}
.ol-popup-closer:after {
content: "✖";
font-size: 14px;
}
.go-top-right {
@ -84,7 +85,7 @@ body {
position: relative;
font-size: 18px;
}
.go-top-right a:visited {
.go-top-right:visited {
color: #08c !important;
}
@ -126,11 +127,13 @@ body {
margin-bottom: 10px;
position: sticky;
top: 0;
background-color: white !important;
background-color: #f9f9f9 !important;
opacity: 0.9;
border-radius: 5px;
z-index: 2000;
border: 1px #eee solid;
}
.ol-mouse-position {
top: 8px !important;
right: 60px !important;
@ -646,28 +649,40 @@ body {
/******************************
Table Of Contents (TOC)
*******************************/
#toc_container {
.toc_container {
background: #f9f9f9 none repeat scroll 0 0;
border: 1px solid #eee;
display: table;
font-size: 95%;
padding: 20px;
width: auto;
font-size: 13px;
padding: 5px 15px;
min-width: 120px;
}
.toc_title {
font-weight: 700;
text-align: center;
}
#toc_container li, #toc_container ul, #toc_container ul li {
.toc_list_container {
display: inline-block;
}
.toc_list_container ul {
margin-left: 35px;
}
.toc_list_container ul li {
list-style: outside none none !important;
}
#toc_container ul li a:visited {
.toc_list_container ul li a:visited {
color: #08c !important;
}
.toc_container_reduce_button {
float: left;
padding: 0px 10px !important;
}
.anchor-target {
top: -35px;
position: relative;