in progress on #24028
This commit is contained in:
parent
ed4f9bd204
commit
a3b5045ef7
|
@ -13,6 +13,8 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
|
||||||
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
* GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
|
* GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
|
||||||
* OpenLayers v.6.X. [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
|
* OpenLayers v.6.X. [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
|
||||||
|
* Vis-Timeline v7.x [VisTimeline](https://github.com/visjs/vis-timeline) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) and MIT
|
||||||
|
* Handlebarsjs v4.X [Handlebarsjs](https://handlebarsjs.com/) is licensed under MIT
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||||
|
@ -32,6 +34,9 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEven
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
||||||
|
@ -41,6 +46,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.Ope
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineRelationPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineRelationPanel;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
|
||||||
|
@ -77,6 +83,8 @@ import ol.layer.Image;
|
||||||
*/
|
*/
|
||||||
public class GeoportalDataViewer implements EntryPoint {
|
public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
|
public static final String DIV_TIMELINE_DATA = "timeline-data";
|
||||||
|
|
||||||
/** The Constant APP_DIV. */
|
/** The Constant APP_DIV. */
|
||||||
public final static String APP_DIV = "geoportal-data-viewer";
|
public final static String APP_DIV = "geoportal-data-viewer";
|
||||||
|
|
||||||
|
@ -110,7 +118,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
|
|
||||||
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait");
|
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait",
|
||||||
|
new com.google.gwt.user.client.ui.Image(GNAImages.ICONS.spinnerEarth()));
|
||||||
|
|
||||||
private HTML attributionDiv = new HTML();
|
private HTML attributionDiv = new HTML();
|
||||||
|
|
||||||
|
@ -135,7 +144,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
|
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(loaderApp);
|
// RootPanel.get(APP_DIV).add(loaderApp);
|
||||||
|
|
||||||
|
hideTimelineProjectRelations();
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance()
|
GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||||
.getConfigListOfFieldsForSearching(new AsyncCallback<List<ItemFieldsResponse>>() {
|
.getConfigListOfFieldsForSearching(new AsyncCallback<List<ItemFieldsResponse>>() {
|
||||||
|
@ -203,7 +214,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
ScriptInjector.fromUrl(
|
ScriptInjector.fromUrl(
|
||||||
"//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
"//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||||
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||||
|
|
||||||
GWT.log("Loading collections, count " + result.getAvailableCollections().size());
|
GWT.log("Loading collections, count " + result.getAvailableCollections().size());
|
||||||
|
|
||||||
mainPanel.setAvailableCollections(result.getAvailableCollections().values());
|
mainPanel.setAvailableCollections(result.getAvailableCollections().values());
|
||||||
|
@ -218,13 +229,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID,
|
GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID,
|
||||||
paramGeonaItemType);
|
paramGeonaItemType);
|
||||||
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO LOAD INITIAL LAYERS
|
// TODO LOAD INITIAL LAYERS
|
||||||
|
|
||||||
GWT.log("DONE INIT LOAD");
|
GWT.log("DONE INIT LOAD");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -241,20 +252,20 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
|
|
||||||
new Timer() {
|
new Timer() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GWT.log("Instancing timeline");
|
GWT.log("Instancing timeline");
|
||||||
TimelineRelationPanel timeline = new TimelineRelationPanel("concessione", "projectid");
|
ProjectDV project = new ProjectDV();
|
||||||
RootPanel.get("timeline-data").add(timeline);
|
project.setId("fake");
|
||||||
|
project.setProfileID("fake");
|
||||||
}
|
applicationBus.fireEvent(new TimelineProjectRelationsEvent(project, EVENT_TYPE.SHOW));
|
||||||
}.schedule(5000);
|
|
||||||
|
}
|
||||||
|
}.schedule(1000);
|
||||||
|
|
||||||
|
|
||||||
// Modal modal = new Modal(true, true);
|
// Modal modal = new Modal(true, true);
|
||||||
// modal.setWidth(400);
|
// modal.setWidth(400);
|
||||||
//
|
//
|
||||||
|
@ -323,7 +334,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
// Open Index Layer
|
// Open Index Layer
|
||||||
|
|
||||||
layerManager.addIndexLayer(layer, toOpen.getUcd().getProfileID());
|
layerManager.addIndexLayer(layer, toOpen.getUcd().getProfileID());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -350,7 +361,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
public void onShowDetails(final ShowDetailsEvent showDetailsEvent) {
|
||||||
GWT.log("Fired event: " + showDetailsEvent);
|
GWT.log("Fired event: " + showDetailsEvent);
|
||||||
|
|
||||||
String projectID = showDetailsEvent.getProjectID();
|
String projectID = showDetailsEvent.getProjectID();
|
||||||
|
@ -378,6 +389,17 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ProjectView result) {
|
public void onSuccess(ProjectView result) {
|
||||||
mainPanel.showAsDetails(result, showDetailsEvent.getGeonaItemRef());
|
mainPanel.showAsDetails(result, showDetailsEvent.getGeonaItemRef());
|
||||||
|
|
||||||
|
List<RelationshipDV> relationships = result.getTheProjectDV().getRelationships();
|
||||||
|
|
||||||
|
if (showDetailsEvent.isLoadTimelineRelationships()
|
||||||
|
&& relationships!= null && relationships.size() > 0) {
|
||||||
|
GWT.log("LoadTimelineRelationships is true and the project has Relationships");
|
||||||
|
showTimelineProjectRelations(result.getTheProjectDV());
|
||||||
|
} else {
|
||||||
|
hideTimelineProjectRelations();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -489,6 +511,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onClosed(ClosedViewDetailsEvent closedViewDetailsEvent) {
|
public void onClosed(ClosedViewDetailsEvent closedViewDetailsEvent) {
|
||||||
olMapMng.hidePopInfo();
|
olMapMng.hidePopInfo();
|
||||||
|
applicationBus.fireEvent(new TimelineProjectRelationsEvent(null, EVENT_TYPE.HIDE));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -501,6 +524,26 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
applicationBus.addHandler(TimelineProjectRelationsEvent.TYPE, new TimelineProjectRelationsEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTimelineRelationEvent(TimelineProjectRelationsEvent timelineProjectRelationsEvent) {
|
||||||
|
|
||||||
|
switch (timelineProjectRelationsEvent.getEventType()) {
|
||||||
|
case SHOW: {
|
||||||
|
showTimelineProjectRelations(timelineProjectRelationsEvent.getTheProjectDV());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case HIDE:
|
||||||
|
default: {
|
||||||
|
hideTimelineProjectRelations();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
|
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -625,6 +668,20 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
//
|
//
|
||||||
// }-*/;
|
// }-*/;
|
||||||
|
|
||||||
|
private void showTimelineProjectRelations(ProjectDV theProject) {
|
||||||
|
GWT.log("Showing project relations for: " + theProject);
|
||||||
|
RootPanel.get(DIV_TIMELINE_DATA).clear();
|
||||||
|
RootPanel.get(DIV_TIMELINE_DATA).setVisible(true);
|
||||||
|
TimelineRelationPanel timeline = new TimelineRelationPanel(applicationBus, theProject);
|
||||||
|
RootPanel.get(DIV_TIMELINE_DATA).add(timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideTimelineProjectRelations() {
|
||||||
|
GWT.log("hideTimelineProjectRelations");
|
||||||
|
RootPanel.get(DIV_TIMELINE_DATA).setVisible(false);
|
||||||
|
RootPanel.get(DIV_TIMELINE_DATA).clear();
|
||||||
|
}
|
||||||
|
|
||||||
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
||||||
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
||||||
if (projectID != null) {
|
if (projectID != null) {
|
||||||
|
|
|
@ -417,7 +417,7 @@ public class LayerManager {
|
||||||
|
|
||||||
LayerObjectType layerObjectType = layerObject.getType();
|
LayerObjectType layerObjectType = layerObject.getType();
|
||||||
return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null,
|
return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null,
|
||||||
layerObject.getProfileID(), productId, itemName, fRow);
|
layerObject.getProfileID(), productId, itemName, fRow, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -807,7 +807,7 @@ public class LayerManager {
|
||||||
public void onBrowserEvent(Event event) {
|
public void onBrowserEvent(Event event) {
|
||||||
if (Event.ONCLICK == event.getTypeInt()) {
|
if (Event.ONCLICK == event.getTypeInt()) {
|
||||||
applicationBus.fireEvent(new ShowDetailsEvent(lo.getType().name(),
|
applicationBus.fireEvent(new ShowDetailsEvent(lo.getType().name(),
|
||||||
lo.getProfileID(), newProjectID, null, null));
|
lo.getProfileID(), newProjectID, null, null, true));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
private String itemName;
|
private String itemName;
|
||||||
private String profileID;
|
private String profileID;
|
||||||
private String projectID;
|
private String projectID;
|
||||||
|
private boolean loadTimelineRelationships;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new show details event.
|
* Instantiates a new show details event.
|
||||||
|
@ -29,13 +30,13 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
* @param featureRow the feature row
|
* @param featureRow the feature row
|
||||||
*/
|
*/
|
||||||
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, String itemName,
|
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, String itemName,
|
||||||
FeatureRow featureRow) {
|
FeatureRow featureRow, boolean loadTimelineRelationships) {
|
||||||
this.layerObjectType = layerObjectType;
|
this.layerObjectType = layerObjectType;
|
||||||
this.profileID = profileID;
|
this.profileID = profileID;
|
||||||
this.projectID = projectID;
|
this.projectID = projectID;
|
||||||
this.itemName = itemName;
|
this.itemName = itemName;
|
||||||
this.featureRow = featureRow;
|
this.featureRow = featureRow;
|
||||||
|
this.loadTimelineRelationships = loadTimelineRelationships;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,13 +45,15 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
* @param gir the gir
|
* @param gir the gir
|
||||||
* @param itemName the item name
|
* @param itemName the item name
|
||||||
* @param featureRow the feature row
|
* @param featureRow the feature row
|
||||||
|
* @param loadTimelineRelationships the load timeline relationships
|
||||||
*/
|
*/
|
||||||
public ShowDetailsEvent(GeoportalItemReferences gir, String itemName, FeatureRow featureRow) {
|
public ShowDetailsEvent(GeoportalItemReferences gir, String itemName, FeatureRow featureRow, boolean loadTimelineRelationships) {
|
||||||
this.layerObjectType = gir.getLayerObjectType();
|
this.layerObjectType = gir.getLayerObjectType();
|
||||||
this.profileID = gir.getProfileID();
|
this.profileID = gir.getProfileID();
|
||||||
this.projectID = gir.getProjectID();
|
this.projectID = gir.getProjectID();
|
||||||
this.itemName = itemName;
|
this.itemName = itemName;
|
||||||
this.featureRow = featureRow;
|
this.featureRow = featureRow;
|
||||||
|
this.loadTimelineRelationships = loadTimelineRelationships;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Type<ShowDetailsEventHandler> getTYPE() {
|
public static Type<ShowDetailsEventHandler> getTYPE() {
|
||||||
|
@ -116,6 +119,15 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
public void setItemName(String itemName) {
|
public void setItemName(String itemName) {
|
||||||
this.itemName = itemName;
|
this.itemName = itemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is load timeline relationships.
|
||||||
|
*
|
||||||
|
* @return true, if is load timeline relationships
|
||||||
|
*/
|
||||||
|
public boolean isLoadTimelineRelationships() {
|
||||||
|
return loadTimelineRelationships;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the geona item ref.
|
* Gets the geona item ref.
|
||||||
|
@ -126,4 +138,25 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
return new GeoportalItemReferences(projectID, profileID, layerObjectType);
|
return new GeoportalItemReferences(projectID, profileID, layerObjectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("ShowDetailsEvent [layerObjectType=");
|
||||||
|
builder.append(layerObjectType);
|
||||||
|
builder.append(", featureRow=");
|
||||||
|
builder.append(featureRow);
|
||||||
|
builder.append(", itemName=");
|
||||||
|
builder.append(itemName);
|
||||||
|
builder.append(", profileID=");
|
||||||
|
builder.append(profileID);
|
||||||
|
builder.append(", projectID=");
|
||||||
|
builder.append(projectID);
|
||||||
|
builder.append(", loadTimelineRelationships=");
|
||||||
|
builder.append(loadTimelineRelationships);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class TimelineProjectRelationsEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 3, 2022
|
||||||
|
*/
|
||||||
|
public class TimelineProjectRelationsEvent extends GwtEvent<TimelineProjectRelationsEventHandler> {
|
||||||
|
public static Type<TimelineProjectRelationsEventHandler> TYPE = new Type<TimelineProjectRelationsEventHandler>();
|
||||||
|
private EVENT_TYPE eventType = EVENT_TYPE.HIDE; //default
|
||||||
|
private ProjectDV theProjectDV;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum EVENT_TYPE.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 3, 2022
|
||||||
|
*/
|
||||||
|
public enum EVENT_TYPE {
|
||||||
|
SHOW, HIDE
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new timeline project relations event.
|
||||||
|
*
|
||||||
|
* @param theProjectDV the the project DV
|
||||||
|
* @param eventType the event type
|
||||||
|
*/
|
||||||
|
public TimelineProjectRelationsEvent(ProjectDV theProjectDV, EVENT_TYPE eventType) {
|
||||||
|
this.theProjectDV = theProjectDV;
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<TimelineProjectRelationsEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(TimelineProjectRelationsEventHandler handler) {
|
||||||
|
handler.onTimelineRelationEvent(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the event type.
|
||||||
|
*
|
||||||
|
* @return the event type
|
||||||
|
*/
|
||||||
|
public EVENT_TYPE getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the the project DV.
|
||||||
|
*
|
||||||
|
* @return the the project DV
|
||||||
|
*/
|
||||||
|
public ProjectDV getTheProjectDV() {
|
||||||
|
return theProjectDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface TimelineProjectRelationsEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 3, 2022
|
||||||
|
*/
|
||||||
|
public interface TimelineProjectRelationsEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On timeline relation event.
|
||||||
|
*
|
||||||
|
* @param timelineProjectRelationsEvent the timeline project relations event
|
||||||
|
*/
|
||||||
|
void onTimelineRelationEvent(TimelineProjectRelationsEvent timelineProjectRelationsEvent);
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ public interface GNAImages extends ClientBundle {
|
||||||
* Our sample image icon. Makes the image resource for the gwt-compiler's css
|
* Our sample image icon. Makes the image resource for the gwt-compiler's css
|
||||||
* composer accessible
|
* composer accessible
|
||||||
*/
|
*/
|
||||||
@Source("map.png")
|
@Source("map1.png")
|
||||||
ImageResource map();
|
ImageResource map();
|
||||||
|
|
||||||
@Source("preset_location.png")
|
@Source("preset_location.png")
|
||||||
|
@ -46,5 +46,11 @@ public interface GNAImages extends ClientBundle {
|
||||||
|
|
||||||
@Source("layer_invisible.png")
|
@Source("layer_invisible.png")
|
||||||
ImageResource layerInvisible();
|
ImageResource layerInvisible();
|
||||||
|
|
||||||
|
@Source("spinner_earth.gif")
|
||||||
|
ImageResource spinnerEarth();
|
||||||
|
|
||||||
|
@Source("spinner_clock2.gif")
|
||||||
|
ImageResource spinnerClock();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 705 B |
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
|
@ -70,7 +70,7 @@ public class DetailsPanel extends Composite {
|
||||||
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
|
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
datailsContainerPanel.add(new ProjectViewer(geonaItemRef, result));
|
datailsContainerPanel.add(new ProjectViewer(applicationBus, geonaItemRef, result));
|
||||||
showPanelDetails();
|
showPanelDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
||||||
|
@ -25,6 +27,7 @@ import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
|
@ -73,16 +76,18 @@ public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
private boolean openImageButtonVisible = true;
|
private boolean openImageButtonVisible = true;
|
||||||
|
|
||||||
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
private ProjectViewer() {
|
private ProjectViewer() {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
pageViewDetails.getElement().setId("page-view-details");
|
pageViewDetails.getElement().setId("page-view-details");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectViewer(GeoportalItemReferences geoportalItemRefs, ProjectView projectView) {
|
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs, ProjectView projectView) {
|
||||||
this(geoportalItemRefs, projectView, true, true);
|
this(applicationBus, geoportalItemRefs, projectView, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectViewer(GeoportalItemReferences geoportalItemRefs, final ProjectView projectView,
|
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs, final ProjectView projectView,
|
||||||
boolean viewImageButtonVisible, boolean openImageButtonVisible) {
|
boolean viewImageButtonVisible, boolean openImageButtonVisible) {
|
||||||
this();
|
this();
|
||||||
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
|
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
|
||||||
|
@ -90,6 +95,7 @@ public class ProjectViewer extends Composite {
|
||||||
this.geoportalItemReferences = geoportalItemRefs;
|
this.geoportalItemReferences = geoportalItemRefs;
|
||||||
this.viewImageButtonVisible = viewImageButtonVisible;
|
this.viewImageButtonVisible = viewImageButtonVisible;
|
||||||
this.openImageButtonVisible = openImageButtonVisible;
|
this.openImageButtonVisible = openImageButtonVisible;
|
||||||
|
this.applicationBus = applicationBus;
|
||||||
|
|
||||||
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
||||||
? projectView.getTheProjectDV().getProfileName()
|
? projectView.getTheProjectDV().getProfileName()
|
||||||
|
@ -119,7 +125,7 @@ public class ProjectViewer extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
ProjectViewer cv = new ProjectViewer(geoportalItemReferences, theProjectView, false,
|
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView, false,
|
||||||
openImageButtonVisible);
|
openImageButtonVisible);
|
||||||
cv.setExpandViewButtonVisible(false);
|
cv.setExpandViewButtonVisible(false);
|
||||||
int width = Window.getClientWidth() * 75 / 100;
|
int width = Window.getClientWidth() * 75 / 100;
|
||||||
|
@ -142,6 +148,16 @@ public class ProjectViewer extends Composite {
|
||||||
relationshipsButton.setVisible(true);
|
relationshipsButton.setVisible(true);
|
||||||
} else
|
} else
|
||||||
relationshipsButton.setVisible(false);
|
relationshipsButton.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
|
relationshipsButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
applicationBus.fireEvent(new TimelineProjectRelationsEvent(theProjectView.getTheProjectDV(), EVENT_TYPE.SHOW));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@ -172,8 +188,9 @@ public class ProjectViewer extends Composite {
|
||||||
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
||||||
|
|
||||||
if (theProjectView != null && theProjectView.getTheProjectDV() != null) {
|
if (theProjectView != null && theProjectView.getTheProjectDV() != null) {
|
||||||
|
|
||||||
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
|
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
|
||||||
|
|
||||||
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
MAP_PROJECTION.EPSG_3857.getName());
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
|
||||||
|
@ -182,6 +199,7 @@ public class ProjectViewer extends Composite {
|
||||||
mapView.addMarker(transfCoord, authenticatedUser);
|
mapView.addMarker(transfCoord, authenticatedUser);
|
||||||
centroidPanel.add(mapView);
|
centroidPanel.add(mapView);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (theProjectView != null) {
|
} else if (theProjectView != null) {
|
||||||
GeoportalDataViewerConstants
|
GeoportalDataViewerConstants
|
||||||
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " + theProjectView
|
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " + theProjectView
|
||||||
|
|
|
@ -2,17 +2,30 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relati
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
import com.google.gwt.dom.client.Style.TextAlign;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.json.client.JSONArray;
|
import com.google.gwt.json.client.JSONArray;
|
||||||
import com.google.gwt.json.client.JSONParser;
|
import com.google.gwt.json.client.JSONParser;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
@ -21,13 +34,35 @@ public class TimelineRelationPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel timelineContainer;
|
ScrollPanel timelineContainer;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel timelineTitle;
|
||||||
|
|
||||||
|
private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait", new Image(GNAImages.ICONS.spinnerClock()));
|
||||||
|
|
||||||
|
private TimelineRelationPanel instance = this;
|
||||||
|
|
||||||
|
private String selectedProjectID;
|
||||||
|
|
||||||
|
private ProjectDV theProjectDV;
|
||||||
|
|
||||||
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
private static TimelineRelationPanelUiBinder uiBinder = GWT.create(TimelineRelationPanelUiBinder.class);
|
private static TimelineRelationPanelUiBinder uiBinder = GWT.create(TimelineRelationPanelUiBinder.class);
|
||||||
|
|
||||||
interface TimelineRelationPanelUiBinder extends UiBinder<Widget, TimelineRelationPanel> {
|
interface TimelineRelationPanelUiBinder extends UiBinder<Widget, TimelineRelationPanel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TimelineRelationPanel(String profileID, String projectID) {
|
public TimelineRelationPanel(HandlerManager applicationBus, ProjectDV theProjectDV) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.theProjectDV = theProjectDV;
|
||||||
|
this.applicationBus = applicationBus;
|
||||||
|
|
||||||
|
String html = ProjectUtil.toHMLCode(theProjectDV.getTheDocument(), theProjectDV.getId());
|
||||||
|
HTML title = new HTML("Relationships of the Project: " + html);
|
||||||
|
timelineTitle.add(title);
|
||||||
|
|
||||||
|
loaderData.getElement().getStyle().setTextAlign(TextAlign.CENTER);
|
||||||
|
timelineTitle.add(loaderData);
|
||||||
|
|
||||||
timelineContainer.getElement().setId("visualization");
|
timelineContainer.getElement().setId("visualization");
|
||||||
|
|
||||||
|
@ -35,8 +70,8 @@ public class TimelineRelationPanel extends Composite {
|
||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getRelationshipsForTimeline(profileID, projectID,
|
GeoportalDataViewerServiceAsync.Util.getInstance().getRelationshipsForTimeline(
|
||||||
new AsyncCallback<List<String>>() {
|
theProjectDV.getProfileID(), theProjectDV.getId(), new AsyncCallback<List<String>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<String> result) {
|
public void onSuccess(List<String> result) {
|
||||||
|
@ -46,13 +81,17 @@ public class TimelineRelationPanel extends Composite {
|
||||||
toJsonArr.set(i, JSONParser.parseStrict(result.get(i)));
|
toJsonArr.set(i, JSONParser.parseStrict(result.get(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceTimeline(timelineContainer.getElement().getId(), toJsonArr);
|
instanceTimeline(timelineContainer.getElement().getId(), toJsonArr, instance);
|
||||||
|
timelineTitle.remove(loaderData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
// TODO Auto-generated method stub
|
timelineTitle.remove(loaderData);
|
||||||
|
Alert alert = new Alert(caught.getMessage());
|
||||||
|
alert.setType(AlertType.ERROR);
|
||||||
|
alert.setClose(false);
|
||||||
|
timelineTitle.add(alert);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -61,7 +100,28 @@ public class TimelineRelationPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems) /*-{
|
private void setSelectedProject(String projectID) {
|
||||||
|
this.selectedProjectID = projectID;
|
||||||
|
GWT.log("selectedProjectID: " + selectedProjectID);
|
||||||
|
|
||||||
|
String[] references = this.selectedProjectID.split(",");
|
||||||
|
|
||||||
|
GeoportalItemReferences gir = new GeoportalItemReferences(references[1],
|
||||||
|
references[0]);
|
||||||
|
ShowDetailsEvent event = new ShowDetailsEvent(gir, null, null, false);
|
||||||
|
GWT.log("fireEvetn: "+event);
|
||||||
|
|
||||||
|
//applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null, false));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSelectedProjectID() {
|
||||||
|
return selectedProjectID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
|
||||||
|
TimelineRelationPanel instance) /*-{
|
||||||
console.log('showTimeline_instanceTimeline for json items: '
|
console.log('showTimeline_instanceTimeline for json items: '
|
||||||
+ jsonItems);
|
+ jsonItems);
|
||||||
|
|
||||||
|
@ -81,10 +141,15 @@ public class TimelineRelationPanel extends Composite {
|
||||||
// Create a DataSet (allows two way data-binding)
|
// Create a DataSet (allows two way data-binding)
|
||||||
var items = new $wnd.vis.DataSet(myArray);
|
var items = new $wnd.vis.DataSet(myArray);
|
||||||
|
|
||||||
|
|
||||||
// Create a Timeline
|
// Create a Timeline
|
||||||
var timeline = new $wnd.vis.Timeline(container, items,
|
var timeline = new $wnd.vis.Timeline(container, items,
|
||||||
$wnd.optionsTimeline);
|
$wnd.optionsTimeline);
|
||||||
|
|
||||||
|
timeline.on('select',function(properties, items) {
|
||||||
|
//console.log('selected: ' + $wnd.JSON.stringify(properties));
|
||||||
|
console.log('selected items: ' + properties.items);
|
||||||
|
instance.@org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineRelationPanel::setSelectedProject(Ljava/lang/String;)(properties.items+'')
|
||||||
|
});
|
||||||
|
|
||||||
}-*/;
|
}-*/;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,20 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.timeline_title {
|
||||||
|
padding: 5px;
|
||||||
|
background-color: rgba(0, 60, 136, 0.7);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.timeline {
|
.timeline {
|
||||||
border: 1px solid lightgray;
|
/*border: 1px solid lightgray;*/
|
||||||
max-height: 400px;
|
max-height: 400px;
|
||||||
}
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel>
|
<g:HTMLPanel>
|
||||||
|
<g:HTMLPanel ui:field="timelineTitle"
|
||||||
|
addStyleNames="{style.timeline_title}"></g:HTMLPanel>
|
||||||
<g:ScrollPanel ui:field="timelineContainer"
|
<g:ScrollPanel ui:field="timelineContainer"
|
||||||
addStyleNames="{style.timeline}"></g:ScrollPanel>
|
addStyleNames="{style.timeline}"></g:ScrollPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
|
|
|
@ -131,8 +131,8 @@ public class SearchFacilityUI extends Composite {
|
||||||
* @param searchForFields the search for fields
|
* @param searchForFields the search for fields
|
||||||
* @param initialSortFilter the initial sort filter
|
* @param initialSortFilter the initial sort filter
|
||||||
*/
|
*/
|
||||||
public SearchFacilityUI(String profileID, HandlerManager appManagerBus,List<ItemFieldDV> displayByFields, List<ItemFieldDV> sortByFields,
|
public SearchFacilityUI(String profileID, HandlerManager appManagerBus, List<ItemFieldDV> displayByFields,
|
||||||
List<ItemFieldDV> searchForFields, SearchingFilter initialSortFilter) {
|
List<ItemFieldDV> sortByFields, List<ItemFieldDV> searchForFields, SearchingFilter initialSortFilter) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.profileID = profileID;
|
this.profileID = profileID;
|
||||||
this.displayByFields = displayByFields;
|
this.displayByFields = displayByFields;
|
||||||
|
@ -331,7 +331,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
|
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
|
||||||
profileID);
|
profileID);
|
||||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null, true));
|
||||||
|
|
||||||
GeoJSON spatialReference = resultDoc.getSpatialReference();
|
GeoJSON spatialReference = resultDoc.getSpatialReference();
|
||||||
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, null,
|
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, null,
|
||||||
|
|
|
@ -31,10 +31,29 @@ public class LoaderIcon extends HorizontalPanel{
|
||||||
setText(txtHTML);
|
setText(txtHTML);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new loader icon.
|
||||||
|
*
|
||||||
|
* @param txtHTML the txt html
|
||||||
|
*/
|
||||||
|
public LoaderIcon(String txtHTML, Image spinner) {
|
||||||
|
setText(txtHTML);
|
||||||
|
this.imgLoading = spinner!=null?spinner:imgLoading;
|
||||||
|
setStyleName("marginTop20");
|
||||||
|
add(imgLoading);
|
||||||
|
add(txtLoading);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new loader icon.
|
* Instantiates a new loader icon.
|
||||||
*/
|
*/
|
||||||
public LoaderIcon() {
|
public LoaderIcon() {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
setStyleName("marginTop20");
|
setStyleName("marginTop20");
|
||||||
add(imgLoading);
|
add(imgLoading);
|
||||||
add(txtLoading);
|
add(txtLoading);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||||
import org.gcube.application.geoportal.common.model.configuration.Index;
|
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
|
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportal.common.rest.Projects;
|
import org.gcube.application.geoportal.common.rest.Projects;
|
||||||
|
@ -81,6 +82,9 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
import com.jayway.jsonpath.DocumentContext;
|
||||||
|
import com.jayway.jsonpath.JsonPath;
|
||||||
|
import com.jayway.jsonpath.Option;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
@ -1256,15 +1260,68 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
throw new Exception("Invalid parameter. Either profileID or projectID is null");
|
throw new Exception("Invalid parameter. Either profileID or projectID is null");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
LOG.info("Trying to getRelationshipsForTimeline for id " + profileID);
|
||||||
LOG.info("Trying to getRelationshipChain for id " + profileID);
|
|
||||||
|
|
||||||
List<String> listJSON = new ArrayList<String>();
|
List<String> listJSON = new ArrayList<String>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String template = "{\"content\": \"$._theDocument.nome\","
|
||||||
|
+ "\"start\" : \"$._theDocument.dataInizioProgetto\","
|
||||||
|
+ "\"end\" : \"$._theDocument.dataFineProgetto\"}";
|
||||||
|
|
||||||
|
JSONObject sourceJsonTemplate = new JSONObject(template);
|
||||||
|
JSONObject targetJsonObject = new JSONObject();
|
||||||
|
com.jayway.jsonpath.Configuration conf = com.jayway.jsonpath.Configuration.defaultConfiguration();
|
||||||
|
com.jayway.jsonpath.Configuration conf2 = conf.addOptions(Option.ALWAYS_RETURN_LIST);
|
||||||
|
|
||||||
|
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
||||||
|
List<Relationship> relationships = theProject.getRelationships();
|
||||||
|
|
||||||
|
for (Relationship relationship : relationships) {
|
||||||
|
targetJsonObject.put("id", relationship.getTargetUCD()+","+relationship.getTargetID());
|
||||||
|
Project targetProject = GeoportalClientCaller.projects().getProjectByID(relationship.getTargetUCD(),
|
||||||
|
relationship.getTargetID());
|
||||||
|
|
||||||
|
DocumentContext targetDoc = JsonPath.using(conf2).parse(targetProject.getTheDocument().toJson());
|
||||||
|
|
||||||
|
for (Object key : sourceJsonTemplate.keySet()) {
|
||||||
|
String theKey = key + "";
|
||||||
|
String jsonPath = sourceJsonTemplate.getString(theKey);
|
||||||
|
// Works fine
|
||||||
|
|
||||||
|
List<String> listValue = targetDoc.read(jsonPath);
|
||||||
|
String result = "";
|
||||||
|
for (int i = 0; i < listValue.size() - 1; i++) {
|
||||||
|
result += listValue.get(i) + ", ";
|
||||||
|
}
|
||||||
|
result += listValue.get(listValue.size() - 1);
|
||||||
|
targetJsonObject.put(theKey, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PayloadDV> images = getImagesForId(relationship.getTargetUCD(), relationship.getTargetID(),
|
||||||
|
true);
|
||||||
|
if (images.size() > 0) {
|
||||||
|
images.get(0).getLink();
|
||||||
|
targetJsonObject.put("image_url", images.get(0).getLink());
|
||||||
|
}
|
||||||
|
String theJSONResult = targetJsonObject.toString();
|
||||||
|
LOG.debug("Built jsonObject " + theJSONResult);
|
||||||
|
listJSON.add(theJSONResult);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
String erroMsg = "Error occurred on reading relatioships for id: " + projectID;
|
||||||
|
LOG.error(erroMsg, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO LOAD AND APPLT TEMPLATING OF KIND
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("id", i);
|
jsonObject.put("id", "UCD"+i+",ID"+i);
|
||||||
jsonObject.put("title", "title " + i);
|
jsonObject.put("content",
|
||||||
|
"title moooooooooooooolto lungoooooooooooooooooooooooooooooooooooooooooooooooooo" + i);
|
||||||
jsonObject.put("start", "201" + i + "-04-1");
|
jsonObject.put("start", "201" + i + "-04-1");
|
||||||
jsonObject.put("end", "201" + i + "-09-1");
|
jsonObject.put("end", "201" + i + "-09-1");
|
||||||
if (i < 3)
|
if (i < 3)
|
||||||
|
|
|
@ -552,7 +552,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.vis-item-content table code {
|
.vis-item-content table code {
|
||||||
color: gray;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vis-item-content table span {
|
.vis-item-content table span {
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
</tr></td>
|
</tr></td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="3" class="description" title="{{content}}">{{truncate title}}</th>
|
<th colspan="3" class="description">{{truncate_msg content}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>{{dateformat start}} / {{dateformat end}}</code></td>
|
<td><code>{{dateformat start}} / {{dateformat end}}</code></td>
|
||||||
|
@ -81,10 +81,9 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper("truncate", function(input, max_lenght) {
|
Handlebars.registerHelper("truncate_msg", function(input) {
|
||||||
|
|
||||||
if (!max_lenght)
|
max_lenght = 20;
|
||||||
max_lenght = 10;
|
|
||||||
|
|
||||||
if (input.length > max_lenght) {
|
if (input.length > max_lenght) {
|
||||||
return input.substring(0, max_lenght) + '...';
|
return input.substring(0, max_lenght) + '...';
|
||||||
|
@ -99,7 +98,8 @@
|
||||||
var optionsTimeline = {
|
var optionsTimeline = {
|
||||||
// specify a template for the items
|
// specify a template for the items
|
||||||
template : templateHandlebars,
|
template : templateHandlebars,
|
||||||
type : 'box'
|
type : 'box',
|
||||||
|
dataAttributes : 'all'
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -58,13 +58,13 @@
|
||||||
</tr></td>
|
</tr></td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="3" class="description" title="{{content}}">{{truncate title}}</th>
|
<th colspan="3" class="description">{{truncate_msg content}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><code>{{dateformat start}} / {{dateformat end}}</code></td>
|
<td><code>{{dateformat start}} / {{dateformat end}}</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
Handlebars
|
Handlebars
|
||||||
|
|
Loading…
Reference in New Issue