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(); 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"); GWT.log("From querying removing layername: " + layerName + ", it is not visible");
listLO.remove(layerObject); 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);
// }
// }
//
} }
} }
@ -715,6 +705,13 @@ public class LayerManager {
} }
}); });
// //Ordering for temporal dimension
// try {
// Collections.sort(listGeoNaDataObject, new TemporalComparatorUtil());
// }catch (Exception e) {
// // TODO: handle exception
// }
String prevProjectId = ""; String prevProjectId = "";
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) { for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
try { try {
@ -901,8 +898,8 @@ public class LayerManager {
Object theValue = map.get(key); Object theValue = map.get(key);
String toStringValue = theValue + ""; String toStringValue = theValue + "";
// intFlex.setHTML(i, 0, key); // intFlex.setHTML(i, 0, key);
intFlex.setHTML(intFlex.getRowCount() + 1, 0, intFlex.setHTML(intFlex.getRowCount() + 1, 0, "<span title='" + toStringValue + "'>"
"<span title='"+toStringValue+"'>" + StringUtil.ellipsize(toStringValue, 100) + "</span>"); + StringUtil.ellipsize(toStringValue, 100) + "</span>");
// i++; // i++;
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception

View File

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

View File

@ -89,6 +89,15 @@ public class ProjectViewer extends Composite {
@UiField @UiField
Button addLayersToMap; Button addLayersToMap;
@UiField
HTMLPanel toc_container;
@UiField
HTMLPanel toc_list_container;
@UiField
Button reduceToc;
@UiField @UiField
UListElement toc_list_anchors; UListElement toc_list_anchors;
@ -100,8 +109,6 @@ public class ProjectViewer extends Composite {
private HandlerManager applicationBus; private HandlerManager applicationBus;
private HandlerManager projectViewerBus;
private String projectViewerMainPanelID; private String projectViewerMainPanelID;
/** /**
@ -110,7 +117,7 @@ public class ProjectViewer extends Composite {
private ProjectViewer() { private ProjectViewer() {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().addClassName("page-view-details"); pageViewDetails.getElement().addClassName("page-view-details");
projectViewerMainPanelID = "projectViewer-"+Random.nextInt(); projectViewerMainPanelID = "projectViewer-" + Random.nextInt();
projectViewerMainPanel.getElement().setId(projectViewerMainPanelID); projectViewerMainPanel.getElement().setId(projectViewerMainPanelID);
} }
@ -128,7 +135,6 @@ public class ProjectViewer extends Composite {
this.theProjectView = projectView; this.theProjectView = projectView;
this.geoportalItemReferences = geoportalItemRefs; this.geoportalItemReferences = geoportalItemRefs;
this.applicationBus = applicationBus; this.applicationBus = applicationBus;
this.projectViewerBus = new HandlerManager(null);
final String theTitle = projectView.getTheProjectDV().getProfileName() != null final String theTitle = projectView.getTheProjectDV().getProfileName() != null
? projectView.getTheProjectDV().getProfileName() ? projectView.getTheProjectDV().getProfileName()
@ -224,6 +230,25 @@ public class ProjectViewer extends Composite {
} }
}); });
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()) { for (SectionView sectionView : projectView.getListSections()) {
if (!sectionView.isEmpty()) { if (!sectionView.isEmpty()) {
@ -248,8 +273,6 @@ public class ProjectViewer extends Composite {
} }
private void addAnchorToSection(String id, String text) { private void addAnchorToSection(String id, String text) {
// Anchor anchor = new Anchor(text);
// anchor.setHref("#"+id);
String htmlAnchor = "<a href='#" + id + "'>" + text + "</a>"; String htmlAnchor = "<a href='#" + id + "'>" + text + "</a>";
toc_list_anchors.appendChild(new HTML("<li>" + htmlAnchor + "</li>").getElement()); toc_list_anchors.appendChild(new HTML("<li>" + htmlAnchor + "</li>").getElement());
} }

View File

@ -28,6 +28,10 @@
.width-100 { .width-100 {
width: 100%; width: 100%;
} }
.display-item-list {
display: inline-table;
}
</ui:style> </ui:style>
<g:HTMLPanel ui:field="projectViewerMainPanel"> <g:HTMLPanel ui:field="projectViewerMainPanel">
<!-- <g:HTMLPanel ui:field="sharePanel" --> <!-- <g:HTMLPanel ui:field="sharePanel" -->
@ -45,12 +49,16 @@
</g:HorizontalPanel> </g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel> <g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="tableOfContentPanel" <g:HTMLPanel ui:field="tableOfContentPanel"
visible="false"> visible="false" addStyleNames="{style.display-item-list}">
<div id="toc_container"> <g:HTMLPanel ui:field="toc_container"
<p class="toc_title">Contents</p> addStyleNames="toc_container">
<ul ui:field="toc_list_anchors" class="toc_list"> <b:Button ui:field="reduceToc"
</ul> addStyleNames="toc_container_reduce_button"></b:Button>
</div> <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> </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.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap; 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.mongoservice.GeoportalServiceIdentityProxy;
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest; 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.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.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse; import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
@ -92,14 +94,8 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements GeoportalDataViewerService { 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 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. * The Enum COMMON_IMAGES_FORMAT.
* *
@ -1075,6 +1071,13 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
+ " feature/s"); + " feature/s");
listDAO.add(geoDAO); listDAO.add(geoDAO);
// Ordering for temporal dimension
try {
Collections.sort(listDAO, new TemporalComparatorUtil());
} catch (Exception e) {
// silent
}
} }
default: 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; position: absolute;
background-color: white; background-color: white;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
padding: 15px; padding: 10px;
border-radius: 10px; border-radius: 2px;
border: 1px solid #cccccc; border: 1px solid #cccccc;
bottom: 12px; bottom: 12px;
left: -50px; left: -50px;
min-width: 280px; min-width: 280px;
max-width: 500px; max-width: 500px;
visibility: hidden; visibility: hidden;
padding-top: 20px;
} }
.ol-popup img { .ol-popup img {
@ -70,11 +71,11 @@ body {
position: absolute; position: absolute;
top: 2px; top: 2px;
right: 8px; right: 8px;
font-size: 12px;
} }
.ol-popup-closer:after { .ol-popup-closer:after {
content: "✖"; content: "✖";
font-size: 14px;
} }
.go-top-right { .go-top-right {
@ -84,7 +85,7 @@ body {
position: relative; position: relative;
font-size: 18px; font-size: 18px;
} }
.go-top-right a:visited { .go-top-right:visited {
color: #08c !important; color: #08c !important;
} }
@ -126,11 +127,13 @@ body {
margin-bottom: 10px; margin-bottom: 10px;
position: sticky; position: sticky;
top: 0; top: 0;
background-color: white !important; background-color: #f9f9f9 !important;
opacity: 0.9; opacity: 0.9;
border-radius: 5px; border-radius: 5px;
z-index: 2000; z-index: 2000;
border: 1px #eee solid;
} }
.ol-mouse-position { .ol-mouse-position {
top: 8px !important; top: 8px !important;
right: 60px !important; right: 60px !important;
@ -646,28 +649,40 @@ body {
/****************************** /******************************
Table Of Contents (TOC) Table Of Contents (TOC)
*******************************/ *******************************/
#toc_container { .toc_container {
background: #f9f9f9 none repeat scroll 0 0; background: #f9f9f9 none repeat scroll 0 0;
border: 1px solid #eee; border: 1px solid #eee;
display: table; display: table;
font-size: 95%; font-size: 13px;
padding: 20px; padding: 5px 15px;
width: auto; min-width: 120px;
} }
.toc_title { .toc_title {
font-weight: 700; 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; list-style: outside none none !important;
} }
#toc_container ul li a:visited { .toc_list_container ul li a:visited {
color: #08c !important; color: #08c !important;
} }
.toc_container_reduce_button {
float: left;
padding: 0px 10px !important;
}
.anchor-target { .anchor-target {
top: -35px; top: -35px;
position: relative; position: relative;