Created the ItemFieldsResponse

This commit is contained in:
Francesco Mangiacrapa 2022-10-17 16:52:22 +02:00
parent 6986aa493d
commit 51a44a3e54
18 changed files with 708 additions and 596 deletions

View File

@ -2,13 +2,11 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
@ -37,6 +35,8 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCent
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
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.collections.CloseCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
@ -46,6 +46,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPa
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
@ -136,27 +137,35 @@ public class GeoportalDataViewer implements EntryPoint {
RootPanel.get(APP_DIV).add(loaderApp);
GeoportalDataViewerServiceAsync.Util.getInstance()
.listOfFieldsForSearching(new AsyncCallback<Map<String, List<ItemFieldDV>>>() {
.listOfFieldsForSearching(new AsyncCallback<List<ItemFieldsResponse>>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
// TODO Auto-generated method stub
}
@Override
public void onSuccess(Map<String, List<ItemFieldDV>> mapOfSearchingFilterForUCD) {
GWT.log("listOfFieldsForSearching: " + mapOfSearchingFilterForUCD);
public void onSuccess(List<ItemFieldsResponse> itemFieldsResult) {
GWT.log("listOfFieldsForSearching: " + itemFieldsResult);
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),
mapOfSearchingFilterForUCD);
itemFieldsResult);
RootPanel.get(APP_DIV).add(mainPanel);
initApplication();
}
}
});
// GWT.log("listOfFieldsForSearching: " + mapOfSearchingFilterForUCD);
//
// mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),
// mapOfSearchingFilterForUCD);
// RootPanel.get(APP_DIV).add(mainPanel);
//
// initApplication();
}
private void initApplication() {
@ -341,7 +350,7 @@ public class GeoportalDataViewer implements EntryPoint {
@Override
public void onOpenCollection(OpenCollectionEvent openCollectionEvent) {
GWT.log("Fired event: " + openCollectionEvent);
GWT.log("OpenCollectionEvent Fired event: " + openCollectionEvent);
// Check if ID is available
String collId = openCollectionEvent.getCollectionId();
ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
@ -369,6 +378,10 @@ public class GeoportalDataViewer implements EntryPoint {
}
});
applicationBus.addHandler(CloseCollectionEvent.TYPE, new CloseCollectionEventHandler() {
});
// applicationBus.addHandler(OpenCollectionEvent.TYPE, openCollectionEvent -> {
// GWT.log("Fired event: " + openCollectionEvent);
// // Check if ID is available

View File

@ -1,19 +1,18 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -139,7 +138,7 @@ public interface GeoportalDataViewerService extends RemoteService {
* @return the list
* @throws Exception
*/
Map<String, List<ItemFieldDV>> listOfFieldsForSearching() throws Exception;
List<ItemFieldsResponse> listOfFieldsForSearching() throws Exception;
// /**
// * Gets the list concessioni.

View File

@ -1,19 +1,18 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -66,7 +65,7 @@ public interface GeoportalDataViewerServiceAsync {
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
void listOfFieldsForSearching(AsyncCallback<Map<String, List<ItemFieldDV>>> callback);
void listOfFieldsForSearching(AsyncCallback<List<ItemFieldsResponse>> callback);
// void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
// AsyncCallback<ResultSetPaginatedData> callback);

View File

@ -80,6 +80,7 @@ public class LayerManager {
private Map<String, LayerObject> mapDetailLayerObjects = new HashMap<String, LayerObject>();
private Map<String, LayerObject> mapBaseLayerObjects = new HashMap<String, LayerObject>();
private Map<String, LayerObject> mapIndexLayerObjects = new HashMap<String, LayerObject>();
private HandlerManager layerManagerBus = new HandlerManager("");
@ -546,10 +547,7 @@ public class LayerManager {
addLayer(LayerObjectType.INDEX_LAYER, null, null, layer.getLayer().getOgcLinks().get("wms"), false, false, null, false,
null, null, null, null);
// toLayerItem(null, null, null, null, null, false, false, false, null, null,
// false, null, false, null, null, null, null)
}
/**

View File

@ -17,7 +17,6 @@ public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler>
@Override
protected void dispatch(CloseCollectionEventHandler h) {
}
public CloseCollectionEvent(String collectionId) {

View File

@ -70,8 +70,6 @@ public class DetailsPanel extends Composite {
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
}
//datailsContainerPanel.add(new ConcessioneView(geonaItemRef, result));
datailsContainerPanel.add(new ProjectViewer(geonaItemRef, result));
showPanelDetails();
}

View File

@ -3,12 +3,12 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
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.events.ChangeMapLayerEvent;
@ -22,6 +22,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search.SearchFa
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import com.github.gwtbootstrap.client.ui.Button;
@ -139,7 +140,7 @@ public class GeonaDataViewMainPanel extends Composite {
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
Map<String, List<ItemFieldDV>> mapOfSearchingFilterForUCD) {
List<ItemFieldsResponse> itemFieldsReponse) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
mapPanel = new MapPanel(mapHeight + "px");
@ -165,14 +166,14 @@ public class GeonaDataViewMainPanel extends Composite {
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
openCollectionDropDown.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
openCollectionDropDown.setIcon(IconType.COMPASS);
SearchingFilter initialSortFilter = new SearchingFilter();
initialSortFilter.setOrder(ORDER.ASC);
for (final String profileID : mapOfSearchingFilterForUCD.keySet()) {
for (final ItemFieldsResponse ifResponse : itemFieldsReponse) {
List<ItemFieldDV> result = mapOfSearchingFilterForUCD.get(profileID);
List<ItemFieldDV> result = ifResponse.getListItemFields();
List<ItemFieldDV> displayFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
@ -190,28 +191,29 @@ public class GeonaDataViewMainPanel extends Composite {
}
}
NavLink navLink = new NavLink(profileID);
navLink.setText(profileID);
final UseCaseDescriptorDV ucd = ifResponse.getUseCaseDescriptorDV();
NavLink navLink = new NavLink(ifResponse.getUseCaseDescriptorDV().getName());
//navLink.setText(ucd.getName());
navLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
searchFacilityPanel.clear();
SearchFacilityUI searchFacility = new SearchFacilityUI(profileID, applicationBus, sortByFields, searchByFields,
SearchFacilityUI searchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, sortByFields, searchByFields,
initialSortFilter);
searchFacilityPanel.add(searchFacility);
searchFacility.setSearchButton(searchFacilityButton);
}
});
GWT.log("Added navLink for: " + profileID);
GWT.log("Added navLink for: " + ucd.getName());
navListSearch.add(navLink);
}
searchFacilityButton.setIcon(IconType.SEARCH);
if (mapOfSearchingFilterForUCD.size() == 0) {
if (itemFieldsReponse.size() == 0) {
searchFacilityPanel.setVisible(false);
searchFacilityButton.setVisible(false);
}
@ -507,6 +509,13 @@ public class GeonaDataViewMainPanel extends Composite {
openCollectionPanel.add(checkbox);
}
if(collection!=null && collection.size()==1) {
CheckBox checkbox = (CheckBox) openCollectionPanel.getWidget(0);
checkbox.setValue(true, true);
String collectionID = checkbox.getId().replace("gcubeCollectionSelector_", "");
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}
}

View File

@ -11,6 +11,12 @@
.font-weight-bold {
font-weight: bold;
}
.open-collection-style {
padding-left: 15px;
padding-right: 15px;
}
</ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel">
<g:HTMLPanel ui:field="mainContainerPanel">
@ -37,7 +43,7 @@
</b:DropdownButton>
<b:DropdownButton type="LINK"
text="Open Collection" ui:field="openCollectionDropDown">
<g:HTMLPanel ui:field="openCollectionPanel">
<g:HTMLPanel ui:field="openCollectionPanel" addStyleNames="{style.open-collection-style}">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK"

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.layers;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
@ -49,17 +50,28 @@ public class LayersSectionViewer extends Composite {
int downloadAttempt = 0;
public LayersSectionViewer(GCubeSDIViewerLayerDV layer) {
private GCubeSDIViewerLayerDV layer;
private SubDocumentView subDocumentView;
public LayersSectionViewer(GCubeSDIViewerLayerDV layer, SubDocumentView subDocumentView) {
initWidget(uiBinder.createAndBindUi(this));
GWT.log("Showing: " + layer);
this.layer = layer;
this.subDocumentView = subDocumentView;
String wmsLink = null;
try {
wmsLink = layer.getOgcLinks().get("wms");
}catch (Exception e) {
} catch (Exception e) {
return;
}
if (wmsLink == null) {
GeoportalDataViewerConstants.printJs("Wms link is null");
return;
}
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
GWT.log("WMS LINK: " + wmsLink);
@ -70,22 +82,21 @@ public class LayersSectionViewer extends Composite {
exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
Style exportStyle = exportMapButton.getElement().getStyle();
//exportStyle.setWidth(100, Unit.PCT);
// exportStyle.setWidth(100, Unit.PCT);
exportStyle.setMarginLeft(70, Unit.PCT);
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
mapViewPanel.add(mapView);
mapViewPanel.add(exportMapButton);
String mapServerHost = wmsLink.contains("?")
? wmsLink.substring(0,wmsLink.indexOf("?"))
: wmsLink;
String mapServerHost = wmsLink.contains("?") ? wmsLink.substring(0, wmsLink.indexOf("?")) : wmsLink;
GWT.log("mapServerHost: " + mapServerHost);
BBOXDV bbox = layer.getBbox();
GWT.log("bbox: " + bbox);
GWT.log("bbox keys: " + bbox.keySet());
@ -94,12 +105,12 @@ public class LayersSectionViewer extends Composite {
GWT.log("minY: " + bbox.getMinY());
GWT.log("maxX: " + bbox.getMaxX());
GWT.log("maxY: " + bbox.getMaxY());
BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), "");
BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), "");
GWT.log("bounds: " + bounds);
mapView.addWMSLayer(mapServerHost, layerName, bounds);
String htmlLinkId = mapView.getPanelMapElementId() + "-image-download";
for (IMAGE_EXPORT_AS exportType : IMAGE_EXPORT_AS.values()) {
NavLink navLink = new NavLink(exportType.name());
String exportExt = exportType.name().toLowerCase();
@ -131,8 +142,8 @@ public class LayersSectionViewer extends Composite {
}
// DOWNLOAD the OSM + layer by canvas
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId,
filename, mimeType);
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId, filename,
mimeType);
// mapExport(mapView.getLightOLSM().getMap(), mapView.getPanelMapElementId());
}
});
@ -140,8 +151,12 @@ public class LayersSectionViewer extends Composite {
exportMapButton.add(navLink);
}
//mapViewPanel.add(exportMapButton);
if (subDocumentView.getMetadataAsJSON() != null) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
layerPanel.add(new HTML(table));
}
// mapViewPanel.add(exportMapButton);
// customTable.addNextKeyValue("Abstract", layerDV.getAbstractSection());
// customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita());

View File

@ -6,6 +6,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.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
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.dialogs.DialogShareableLink;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
@ -38,18 +40,21 @@ public class ProjectViewer extends Composite {
}
@UiField
PageHeader title;
PageHeader pageHeaderTitle;
@UiField
HTMLPanel pageViewDetails;
@UiField
HTMLPanel centroidPanel;
@UiField
Button shareButton;
@UiField
Button expandButton;
private ProjectView projectView;
private ProjectView theProjectView;
private CustomFlexTable customTable = new CustomFlexTable();
@ -70,17 +75,21 @@ public class ProjectViewer extends Composite {
this(item, projectView, true, true);
}
public ProjectViewer(GeoNaItemRef item, ProjectView projectView, boolean viewImageButtonVisible,
public ProjectViewer(GeoNaItemRef item, final ProjectView projectView, boolean viewImageButtonVisible,
boolean openImageButtonVisible) {
this();
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
this.projectView = projectView;
this.theProjectView = projectView;
this.geonaItemRef = item;
this.viewImageButtonVisible = viewImageButtonVisible;
this.openImageButtonVisible = openImageButtonVisible;
title.setText("Project: "+projectView.getTheProjectDV().getProfileID());
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
? projectView.getTheProjectDV().getProfileName()
: projectView.getTheProjectDV().getId();
pageHeaderTitle.setText("Project: " + theTitle);
shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with...");
@ -102,24 +111,20 @@ public class ProjectViewer extends Composite {
@Override
public void onClick(ClickEvent event) {
Window.alert("Expand must be revisited");
/*
ProjectViewer cv = new ProjectViewer(geonaItemRef, concessioneDV, false, openImageButtonVisible);
ProjectViewer cv = new ProjectViewer(geonaItemRef, theProjectView, false, openImageButtonVisible);
cv.setExpandViewButtonVisible(false);
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height);
ModalWindow mw = new ModalWindow(theTitle, width, height);
mw.add(cv);
mw.setCaller(ProjectViewer.this);
// mw.setWidth(900);
mw.show();
*/
}
});
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
@Override
@ -132,11 +137,10 @@ public class ProjectViewer extends Composite {
public void onFailure(Throwable caught) {
}
});
for (SectionView sectionView : projectView.getListSections()) {
if(!sectionView.isEmpty()) {
if (!sectionView.isEmpty()) {
SectionViewer sectionViewer = new SectionViewer(sectionView);
pageViewDetails.add(sectionViewer);
}
@ -149,26 +153,24 @@ public class ProjectViewer extends Composite {
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
Window.alert("addCentroidMap must be revisited");
// if (concessioneDV != null && concessioneDV.getCentroidLat() != null
// && concessioneDV.getCentroidLong() != null) {
// Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
// Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
// MAP_PROJECTION.EPSG_3857.getName());
// // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
// boolean authenticatedUser = myLogin != null ? true : false;
// mapView.addMarker(transfCoord, authenticatedUser);
// mapViewPanel.add(mapView);
// } else if (concessioneDV != null) {
// GeoportalDataViewerConstants
// .printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
// + concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
// }
if (theProjectView != null && theProjectView.getCentroidLat() != null
&& theProjectView.getCentroidLong() != null) {
Coordinate coord = new Coordinate(theProjectView.getCentroidLong(), theProjectView.getCentroidLat());
Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
// Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
boolean authenticatedUser = myLogin != null ? true : false;
mapView.addMarker(transfCoord, authenticatedUser);
centroidPanel.add(mapView);
} else if (theProjectView != null) {
GeoportalDataViewerConstants
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
+ theProjectView.getCentroidLong() + ", Long:" + theProjectView.getCentroidLat());
}
}
public ProjectView getProjectView() {
return projectView;
return theProjectView;
}
protected void setExpandViewButtonVisible(boolean bool) {

View File

@ -33,12 +33,13 @@
<!-- <g:HTMLPanel ui:field="sharePanel" -->
<!-- addStyleNames="{style.align-to-right}"> -->
<!-- </g:HTMLPanel> -->
<b:PageHeader ui:field="title"
<b:PageHeader ui:field="pageHeaderTitle"
addStyleNames="{style.the-title}"></b:PageHeader>
<g:HorizontalPanel
addStyleNames="{style.margin-bottom-10}">
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="expandButton">Expand</b:Button>
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -72,13 +72,13 @@ public class SectionViewer extends Composite {
} else if (displayAsMapOfLayers) {
GWT.log("displayAsMapOfLayers the: "+sectionView);
for (SubDocumentView subDocumentView : subDocuments) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
sectionPanelContainer.add(new HTML(table));
// String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
// sectionPanelContainer.add(new HTML(table));
List<GCubeSDIViewerLayerDV> layers = subDocumentView.getListLayers();
if (layers != null) {
for (GCubeSDIViewerLayerDV gCubeLayer : layers) {
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer);
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer, subDocumentView);
sectionPanelContainer.add(layerSectionViewer);
//showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
}

View File

@ -1,166 +1,166 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.ui.HTMLPanel;
/**
* The Class ImagesSectionGallery.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jul 21, 2021
*/
public class ImagesGallery {
private HTMLPanel galleryPanel;
private List<UploadedImageDV> listImages;
private String galleryDivId;
/**
* Show gallery.
*
* @param json_array_images the json array images
*/
private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
console.log("showing: " + json_array_images)
var waitForJQuery = setInterval(
function() {
if (typeof $wnd.$ != 'undefined') {
$wnd
.$("#"+galleryDivId)
.nanogallery2(
{
thumbnailHeight : '200 XS150 SM150', // RESPONSIVE THUMBNAIL HEIGHT: default=200px, XS resolution=150px, SM resolution=150px
thumbnailWidth : '218 XS150 SM150', // RESPONSIVE THUMBNAIL WIDTH: auto
thumbnailAlignment : 'left',
thumbnailBorderHorizontal : 0,
thumbnailBorderVertical : 0,
thumbnailGutterWidth : '10 XS10 SM10',
thumbnailGutterHeight : '10 XS10 SM10',
// THUMBNAIL TOOLS & LABEL
thumbnailLabel : {
display : true,
position : 'onBottom',
align : 'left'
},
thumbnailToolbarImage : {
bottomLeft : 'display'
},
// replace the default DISPLAY tool icon
icons : {
thumbnailDisplay : '<i class="fa fa-long-arrow-right" aria-hidden="true"></i> display'
},
// DISPLAY ANIMATION
galleryDisplayTransition : 'slideUp',
galleryDisplayTransitionDuration : 1000,
thumbnailDisplayTransition : 'scaleDown',
thumbnailDisplayTransitionDuration : 300,
thumbnailDisplayInterval : 50,
// THUMBNAIL'S HOVER ANIMATION
//thumbnailBuildInit2 : 'tools_font-size_1.5em|title_font-size_1.5em',
thumbnailHoverEffect2 : 'imageScaleIn80|tools_opacity_0_1|tools_translateX_-30px_0px|title_opacity_1_0|title_translateX_0px_-30px',
touchAnimation : true,
touchAutoOpenDelay : 800,
// GALLERY THEME
galleryTheme : {
thumbnail : {
borderRadius : '2px !important',
background : '#ffffff !important',
titleShadow : 'none !important',
titleColor : '#696969 !important',
labelBackground : '#f3f3f3 !important'
},
thumbnailIcon : {
color : '#000',
shadow : 'none'
},
},
viewerToolbar : {
display : true,
standard : 'minimizeButton, label',
minimized : 'minimizeButton, label, fullscreenButton, downloadButton'
},
viewerTools : {
topLeft : 'pageCounter',
topRight : 'playPauseButton, zoomButton, fullscreenButton, downloadButton, closeButton'
},
// DEEP LINKING
locationHash : false,
items : json_array_images
})
clearInterval(waitForJQuery);
}
}, 200);
}-*/;
/**
* Instantiates a new images gallery.
*
* @param immagini the immagini
*/
public ImagesGallery(List<UploadedImageDV> immagini) {
this.galleryDivId = "nanogallery"+Random.nextInt()+Random.nextInt();
this.galleryPanel = new HTMLPanel("<div id='"+galleryDivId+"'></div>");
this.listImages = immagini;
}
/**
* Gets the gallery panel.
*
* @return the gallery panel
*/
public HTMLPanel getGalleryPanel() {
return galleryPanel;
}
/**
* Fill gallery.
*/
public void fillGallery() {
JSONArray jsonArray = new JSONArray();
int index = 0;
for (UploadedImageDV image : listImages) {
if(image.getListWsContent()!=null) {
for (WorkspaceContentDV imageContent : image.getListWsContent()) {
JSONObject json = new JSONObject();
json.put("src", new JSONString(imageContent.getLink()));
json.put("srct", new JSONString(imageContent.getLink()));
List<String> listAuthors = image.getResponsabili();
String txtAuthors = listAuthors.size()>1 ? "Authors: ": "Author: ";
for (String author : listAuthors) {
txtAuthors+= " "+author +",";
}
txtAuthors = txtAuthors.substring(0,txtAuthors.length()-2);
String description = txtAuthors + ". ID Licenza: "+image.getLicenseID();
json.put("title", new JSONString(image.getDidascalia()));
json.put("description", new JSONString(description));
json.put("downloadURL", new JSONString(imageContent.getLink()));
jsonArray.set(index, json);
index++;
}
}
}
showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
}
}
//package org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery;
//
//import java.util.List;
//
//import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
//import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
//
//import com.google.gwt.core.client.JavaScriptObject;
//import com.google.gwt.json.client.JSONArray;
//import com.google.gwt.json.client.JSONObject;
//import com.google.gwt.json.client.JSONString;
//import com.google.gwt.user.client.Random;
//import com.google.gwt.user.client.ui.HTMLPanel;
//
//
///**
// * The Class ImagesSectionGallery.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
// *
// * Jul 21, 2021
// */
//public class ImagesGallery {
//
// private HTMLPanel galleryPanel;
// private List<UploadedImageDV> listImages;
// private String galleryDivId;
//
// /**
// * Show gallery.
// *
// * @param json_array_images the json array images
// */
// private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
//
// console.log("showing: " + json_array_images)
// var waitForJQuery = setInterval(
// function() {
// if (typeof $wnd.$ != 'undefined') {
//
// $wnd
// .$("#"+galleryDivId)
// .nanogallery2(
// {
// thumbnailHeight : '200 XS150 SM150', // RESPONSIVE THUMBNAIL HEIGHT: default=200px, XS resolution=150px, SM resolution=150px
// thumbnailWidth : '218 XS150 SM150', // RESPONSIVE THUMBNAIL WIDTH: auto
// thumbnailAlignment : 'left',
// thumbnailBorderHorizontal : 0,
// thumbnailBorderVertical : 0,
// thumbnailGutterWidth : '10 XS10 SM10',
// thumbnailGutterHeight : '10 XS10 SM10',
//
// // THUMBNAIL TOOLS & LABEL
// thumbnailLabel : {
// display : true,
// position : 'onBottom',
// align : 'left'
// },
// thumbnailToolbarImage : {
// bottomLeft : 'display'
// },
// // replace the default DISPLAY tool icon
// icons : {
// thumbnailDisplay : '<i class="fa fa-long-arrow-right" aria-hidden="true"></i> display'
// },
//
// // DISPLAY ANIMATION
// galleryDisplayTransition : 'slideUp',
// galleryDisplayTransitionDuration : 1000,
// thumbnailDisplayTransition : 'scaleDown',
// thumbnailDisplayTransitionDuration : 300,
// thumbnailDisplayInterval : 50,
//
// // THUMBNAIL'S HOVER ANIMATION
// //thumbnailBuildInit2 : 'tools_font-size_1.5em|title_font-size_1.5em',
// thumbnailHoverEffect2 : 'imageScaleIn80|tools_opacity_0_1|tools_translateX_-30px_0px|title_opacity_1_0|title_translateX_0px_-30px',
// touchAnimation : true,
// touchAutoOpenDelay : 800,
//
// // GALLERY THEME
// galleryTheme : {
// thumbnail : {
// borderRadius : '2px !important',
// background : '#ffffff !important',
// titleShadow : 'none !important',
// titleColor : '#696969 !important',
// labelBackground : '#f3f3f3 !important'
// },
// thumbnailIcon : {
// color : '#000',
// shadow : 'none'
// },
// },
// viewerToolbar : {
// display : true,
// standard : 'minimizeButton, label',
// minimized : 'minimizeButton, label, fullscreenButton, downloadButton'
// },
// viewerTools : {
// topLeft : 'pageCounter',
// topRight : 'playPauseButton, zoomButton, fullscreenButton, downloadButton, closeButton'
// },
//
// // DEEP LINKING
// locationHash : false,
// items : json_array_images
// })
//
// clearInterval(waitForJQuery);
// }
// }, 200);
//
// }-*/;
//
// /**
// * Instantiates a new images gallery.
// *
// * @param immagini the immagini
// */
// public ImagesGallery(List<UploadedImageDV> immagini) {
// this.galleryDivId = "nanogallery"+Random.nextInt()+Random.nextInt();
// this.galleryPanel = new HTMLPanel("<div id='"+galleryDivId+"'></div>");
// this.listImages = immagini;
// }
//
// /**
// * Gets the gallery panel.
// *
// * @return the gallery panel
// */
// public HTMLPanel getGalleryPanel() {
// return galleryPanel;
// }
//
// /**
// * Fill gallery.
// */
// public void fillGallery() {
//
// JSONArray jsonArray = new JSONArray();
// int index = 0;
// for (UploadedImageDV image : listImages) {
// if(image.getListWsContent()!=null) {
// for (WorkspaceContentDV imageContent : image.getListWsContent()) {
// JSONObject json = new JSONObject();
// json.put("src", new JSONString(imageContent.getLink()));
// json.put("srct", new JSONString(imageContent.getLink()));
// List<String> listAuthors = image.getResponsabili();
// String txtAuthors = listAuthors.size()>1 ? "Authors: ": "Author: ";
// for (String author : listAuthors) {
// txtAuthors+= " "+author +",";
// }
// txtAuthors = txtAuthors.substring(0,txtAuthors.length()-2);
// String description = txtAuthors + ". ID Licenza: "+image.getLicenseID();
// json.put("title", new JSONString(image.getDidascalia()));
// json.put("description", new JSONString(description));
// json.put("downloadURL", new JSONString(imageContent.getLink()));
// jsonArray.set(index, json);
// index++;
// }
// }
//
// }
// showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
// }
//}

View File

@ -1,333 +1,333 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
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.GeoportalDataViewerServiceAsync;
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.dialogs.DialogShareableLink;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery.ImagesGallery;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.PageHeader;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.Thumbnails;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate;
public class ConcessioneView extends Composite {
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
}
@UiField
PageHeader titolo;
@UiField
Paragraph introduzione;
@UiField
HTMLPanel concessioniPanel;
@UiField
HTMLPanel relazioneScavoPanel;
@UiField
HTMLPanel imagesPanel;
@UiField
HTMLPanel pageViewDetails;
@UiField
HTMLPanel mapViewPanel;
@UiField
HTMLPanel posizionamentoAreaIndaginePanel;
@UiField
HTMLPanel piantaFineScavoPanel;
@UiField
Button shareButton;
@UiField
Button expandButton;
private ConcessioneDV concessioneDV;
private Thumbnails thumbNails = new Thumbnails();
private CustomFlexTable customTable = new CustomFlexTable();
private GeoNaItemRef geonaItemRef;
private String myLogin;
private boolean viewImageButtonVisible = true;
private boolean openImageButtonVisible = true;
private ConcessioneView() {
initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().setId("page-view-details");
}
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV) {
this(item, concDV, true, true);
}
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible,
boolean openImageButtonVisible) {
this();
GWT.log("Rendering " + concDV.getNome());
this.concessioneDV = concDV;
this.geonaItemRef = item;
this.viewImageButtonVisible = viewImageButtonVisible;
this.openImageButtonVisible = openImageButtonVisible;
titolo.setText(concessioneDV.getNome());
introduzione.setText(concessioneDV.getIntroduzione());
if (concessioneDV.getDataInizioProgetto() != null) {
customTable.addNextKeyValue("Data Inizio Progetto",
GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataInizioProgetto()));
}
if (concessioneDV.getDataFineProgetto() != null) {
customTable.addNextKeyValue("Data Fine Progetto",
GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataFineProgetto()));
}
if (concessioneDV.getParoleChiaveLibere() != null) {
customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getParoleChiaveICCD() != null) {
customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getAuthors() != null) {
customTable.addNextKeyValues("Staff", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getContributore() != null) {
customTable.addNextKeyValue("Contributore", concessioneDV.getContributore());
}
if (concessioneDV.getEditore() != null) {
customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
}
if (concessioneDV.getResponsabile() != null) {
customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile());
}
if (concessioneDV.getRisorseCorrelate() != null) {
customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getTitolari() != null) {
customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getSoggetto() != null) {
customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getEditore() != null) {
customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
}
if (concessioneDV.getFontiFinanziamento() != null) {
customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getLicenzaID() != null) {
customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
}
if (concessioneDV.getTitolariLicenza() != null) {
customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getTitolariCopyright() != null) {
customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(),
GeoportalDataViewerConstants.NEW_LINE_BR);
}
shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with...");
shareButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null);
}
});
expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND);
expandButton.setTitle("Show this view in new Window");
expandButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ConcessioneView cv = new ConcessioneView(geonaItemRef, concessioneDV, false, openImageButtonVisible);
cv.setExpandViewButtonVisible(false);
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height);
mw.add(cv);
mw.setCaller(ConcessioneView.this);
// mw.setWidth(900);
mw.show();
}
});
concessioniPanel.add(customTable);
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
myLogin = result;
addCentroidMap();
addRelazioneDiScavo();
addPosizionamentoAreaIndagine();
addPiantaFineScavo();
}
@Override
public void onFailure(Throwable caught) {
}
});
addUploadedImages();
}
private void addPosizionamentoAreaIndagine() {
LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo();
if (layer == null)
return;
posizionamentoAreaIndaginePanel.setVisible(true);
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
}
private void addPiantaFineScavo() {
List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo();
if (listLayersDV == null)
return;
for (LayerConcessioneDV layerDV : listLayersDV) {
piantaFineScavoPanel.setVisible(true);
piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
}
}
private void addRelazioneDiScavo() {
AbstractRelazioneScavoDV abstractRS = concessioneDV.getAbstractRelazioneScavo();
RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo();
if (abstractRS == null && relazioneScavo==null)
return;
relazioneScavoPanel.setVisible(true);
relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo()));
}
private void addCentroidMap() {
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
if (concessioneDV != null && concessioneDV.getCentroidLat() != null
&& concessioneDV.getCentroidLong() != null) {
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
// Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
boolean authenticatedUser = myLogin != null ? true : false;
mapView.addMarker(transfCoord, authenticatedUser);
mapViewPanel.add(mapView);
} else if (concessioneDV != null) {
GeoportalDataViewerConstants
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
+ concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
}
}
private void addUploadedImages() {
GWT.log("Managing immagini: " + concessioneDV.getImmaginiRappresentative());
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
if (immagini != null && immagini.size() > 0) {
imagesPanel.setVisible(true);
List<UploadedImageDV> immaginiToShow = new ArrayList<UploadedImageDV>();
for (UploadedImageDV uploadedImageDV : immagini) {
immaginiToShow.add(uploadedImageDV);
}
if (immaginiToShow.size() > 0) {
ImagesGallery gallery = new ImagesGallery(immaginiToShow);
imagesPanel.add(gallery.getGalleryPanel());
gallery.fillGallery();
}
}
}
public ConcessioneDV getConcessioneDV() {
return concessioneDV;
}
protected void setExpandViewButtonVisible(boolean bool) {
expandButton.setVisible(bool);
}
}
//package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
//import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
//import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
//import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
//import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
//import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
//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.GeoportalDataViewerServiceAsync;
//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.dialogs.DialogShareableLink;
//import org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery.ImagesGallery;
//import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
//import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
//import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
//import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
//import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
//
//import com.github.gwtbootstrap.client.ui.Button;
//import com.github.gwtbootstrap.client.ui.PageHeader;
//import com.github.gwtbootstrap.client.ui.Paragraph;
//import com.github.gwtbootstrap.client.ui.Thumbnails;
//import com.github.gwtbootstrap.client.ui.constants.ButtonType;
//import com.github.gwtbootstrap.client.ui.constants.IconType;
//import com.google.gwt.core.client.GWT;
//import com.google.gwt.event.dom.client.ClickEvent;
//import com.google.gwt.event.dom.client.ClickHandler;
//import com.google.gwt.uibinder.client.UiBinder;
//import com.google.gwt.uibinder.client.UiField;
//import com.google.gwt.user.client.Window;
//import com.google.gwt.user.client.rpc.AsyncCallback;
//import com.google.gwt.user.client.ui.Composite;
//import com.google.gwt.user.client.ui.HTMLPanel;
//import com.google.gwt.user.client.ui.Widget;
//
//import ol.Coordinate;
//
//public class ConcessioneView extends Composite {
//
// private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
//
// interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
// }
//
// @UiField
// PageHeader titolo;
//
// @UiField
// Paragraph introduzione;
//
// @UiField
// HTMLPanel concessioniPanel;
//
// @UiField
// HTMLPanel relazioneScavoPanel;
//
// @UiField
// HTMLPanel imagesPanel;
//
// @UiField
// HTMLPanel pageViewDetails;
//
// @UiField
// HTMLPanel mapViewPanel;
//
// @UiField
// HTMLPanel posizionamentoAreaIndaginePanel;
//
// @UiField
// HTMLPanel piantaFineScavoPanel;
//
// @UiField
// Button shareButton;
//
// @UiField
// Button expandButton;
//
// private ConcessioneDV concessioneDV;
//
// private Thumbnails thumbNails = new Thumbnails();
//
// private CustomFlexTable customTable = new CustomFlexTable();
//
// private GeoNaItemRef geonaItemRef;
//
// private String myLogin;
//
// private boolean viewImageButtonVisible = true;
//
// private boolean openImageButtonVisible = true;
//
// private ConcessioneView() {
// initWidget(uiBinder.createAndBindUi(this));
// pageViewDetails.getElement().setId("page-view-details");
// }
//
// public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV) {
// this(item, concDV, true, true);
// }
//
// public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible,
// boolean openImageButtonVisible) {
// this();
// GWT.log("Rendering " + concDV.getNome());
// this.concessioneDV = concDV;
// this.geonaItemRef = item;
// this.viewImageButtonVisible = viewImageButtonVisible;
// this.openImageButtonVisible = openImageButtonVisible;
//
// titolo.setText(concessioneDV.getNome());
// introduzione.setText(concessioneDV.getIntroduzione());
//
// if (concessioneDV.getDataInizioProgetto() != null) {
// customTable.addNextKeyValue("Data Inizio Progetto",
// GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataInizioProgetto()));
// }
//
// if (concessioneDV.getDataFineProgetto() != null) {
// customTable.addNextKeyValue("Data Fine Progetto",
// GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataFineProgetto()));
// }
//
// if (concessioneDV.getParoleChiaveLibere() != null) {
// customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getParoleChiaveICCD() != null) {
// customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getAuthors() != null) {
// customTable.addNextKeyValues("Staff", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getContributore() != null) {
// customTable.addNextKeyValue("Contributore", concessioneDV.getContributore());
// }
//
// if (concessioneDV.getEditore() != null) {
// customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
// }
//
// if (concessioneDV.getResponsabile() != null) {
// customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile());
// }
//
// if (concessioneDV.getRisorseCorrelate() != null) {
// customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getTitolari() != null) {
// customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getSoggetto() != null) {
// customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getEditore() != null) {
// customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
// }
//
// if (concessioneDV.getFontiFinanziamento() != null) {
// customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getLicenzaID() != null) {
// customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
// }
//
// if (concessioneDV.getTitolariLicenza() != null) {
// customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// if (concessioneDV.getTitolariCopyright() != null) {
// customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(),
// GeoportalDataViewerConstants.NEW_LINE_BR);
// }
//
// shareButton.setType(ButtonType.LINK);
// shareButton.setIcon(IconType.SHARE);
// shareButton.setTitle("Get a link to share with...");
//
// shareButton.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null);
//
// }
// });
//
// expandButton.setType(ButtonType.LINK);
// expandButton.setIcon(IconType.EXPAND);
// expandButton.setTitle("Show this view in new Window");
//
// expandButton.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
//
// ConcessioneView cv = new ConcessioneView(geonaItemRef, concessioneDV, false, openImageButtonVisible);
// cv.setExpandViewButtonVisible(false);
// int width = Window.getClientWidth() * 75 / 100;
// int height = Window.getClientHeight() * 70 / 100;
// ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height);
// mw.add(cv);
// mw.setCaller(ConcessioneView.this);
// // mw.setWidth(900);
// mw.show();
//
// }
// });
//
// concessioniPanel.add(customTable);
//
// GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
//
// @Override
// public void onSuccess(String result) {
// myLogin = result;
// addCentroidMap();
// addRelazioneDiScavo();
// addPosizionamentoAreaIndagine();
// addPiantaFineScavo();
// }
//
// @Override
// public void onFailure(Throwable caught) {
// }
// });
//
// addUploadedImages();
//
// }
//
// private void addPosizionamentoAreaIndagine() {
//
// LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo();
// if (layer == null)
// return;
//
// posizionamentoAreaIndaginePanel.setVisible(true);
// posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
// }
//
// private void addPiantaFineScavo() {
//
// List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo();
//
// if (listLayersDV == null)
// return;
//
// for (LayerConcessioneDV layerDV : listLayersDV) {
// piantaFineScavoPanel.setVisible(true);
// piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
// }
// }
//
// private void addRelazioneDiScavo() {
//
// AbstractRelazioneScavoDV abstractRS = concessioneDV.getAbstractRelazioneScavo();
// RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo();
// if (abstractRS == null && relazioneScavo==null)
// return;
//
// relazioneScavoPanel.setVisible(true);
// relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo()));
// }
//
// private void addCentroidMap() {
// Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
// Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
// MapView mapView = new MapView(transformedCenterCoordinate,
// GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
//
// if (concessioneDV != null && concessioneDV.getCentroidLat() != null
// && concessioneDV.getCentroidLong() != null) {
// Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
// Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
// MAP_PROJECTION.EPSG_3857.getName());
// // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
// boolean authenticatedUser = myLogin != null ? true : false;
// mapView.addMarker(transfCoord, authenticatedUser);
// mapViewPanel.add(mapView);
// } else if (concessioneDV != null) {
// GeoportalDataViewerConstants
// .printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
// + concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
// }
// }
//
// private void addUploadedImages() {
// GWT.log("Managing immagini: " + concessioneDV.getImmaginiRappresentative());
// List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
// if (immagini != null && immagini.size() > 0) {
// imagesPanel.setVisible(true);
//
// List<UploadedImageDV> immaginiToShow = new ArrayList<UploadedImageDV>();
// for (UploadedImageDV uploadedImageDV : immagini) {
// immaginiToShow.add(uploadedImageDV);
// }
//
// if (immaginiToShow.size() > 0) {
// ImagesGallery gallery = new ImagesGallery(immaginiToShow);
// imagesPanel.add(gallery.getGalleryPanel());
// gallery.fillGallery();
// }
// }
// }
//
// public ConcessioneDV getConcessioneDV() {
// return concessioneDV;
// }
//
// protected void setExpandViewButtonVisible(boolean bool) {
// expandButton.setVisible(bool);
// }
//
//}

View File

@ -57,7 +57,7 @@ public class GcubeProfilesPerUCDIdCache {
RemovalListener<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> removalListener = new RemovalListener<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>>() {
public void onRemoval(
RemovalNotification<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> removal) {
LOG.debug("cache expired");
LOG.info(GcubeProfilesPerUCDIdCache.class.getSimpleName() + " cache expired");
}
};

View File

@ -56,6 +56,7 @@ import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
@ -786,7 +787,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
}
@Override
public Map<String, List<ItemFieldDV>> listOfFieldsForSearching() throws Exception {
public List<ItemFieldsResponse> listOfFieldsForSearching() throws Exception {
LOG.info("listOfFieldsForSearching called");
try {
@ -794,7 +795,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
// GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
// return profile.getListItemFields();
Map<String, List<ItemFieldDV>> map = new HashMap<String, List<ItemFieldDV>>();
List<ItemFieldsResponse> listIFResponse = new ArrayList<ItemFieldsResponse>();
List<String> handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId());
List<UseCaseDescriptor> listUseCaseDescriptor;
@ -810,10 +811,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
listUseCaseDescriptor = new ArrayList<UseCaseDescriptor>();
}
List<UseCaseDescriptorDV> listUCDDV = new ArrayList<UseCaseDescriptorDV>(listUseCaseDescriptor.size());
//List<UseCaseDescriptorDV> listUCDDV = new ArrayList<UseCaseDescriptorDV>(listUseCaseDescriptor.size());
for (UseCaseDescriptor ucd : listUseCaseDescriptor) {
UseCaseDescriptorDV ucdDV = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null);
listUCDDV.add(ucdDV);
//listUCDDV.add(ucdDV);
HandlerDeclarationDV dataListHandler = getHandlerDeclarationFor(ucdDV,
GEOPORTAL_DATA_HANDLER.geoportal_data_list);
@ -821,8 +822,12 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
ConfigurationDV<?> config = dataListHandler.getConfiguration();
switch (config.getConfigurationType()) {
case item_fields:
ItemFieldsResponse ifResponse = new ItemFieldsResponse();
ifResponse.setUseCaseDescriptorDV(ucdDV);
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) config.getConfiguration();
map.put(ucdDV.getProfileID(), listItemFields);
//map.put(ucdDV.getProfileID(), listItemFields);
ifResponse.setListItemFields(listItemFields);
listIFResponse.add(ifResponse);
break;
default:
@ -831,8 +836,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
}
}
LOG.info("listOfFieldsForSearching returning: " + map);
return map;
LOG.info("listOfFieldsForSearching returning: " + listIFResponse);
return listIFResponse;
} catch (Exception e) {
LOG.error("Error on loading list of fields for searching: ", e);
throw new Exception("Error occurred on loading list of fields for searching. Error: " + e.getMessage());
@ -1062,8 +1067,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.info("Trying to get project for id " + profileID);
GeoportalServiceIdentityProxy cms = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
ProjectDV theProjectDV = cms.getProjectByID(profileID, projectID);
GeoportalServiceIdentityProxy geoIP = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
UseCaseDescriptorDV ucd = geoIP.getUCDByID(profileID);
ProjectDV theProjectDV = geoIP.getProjectByID(profileID, projectID);
theProjectDV.setProfileName(ucd.getName());
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, scope, userName);

View File

@ -3,11 +3,14 @@ package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
import javax.servlet.http.HttpServletRequest;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.common.portal.PortalContext;
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.GcubeIdentity;
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientIdentity;
@ -79,4 +82,17 @@ public class GeoportalServiceIdentityProxy {
* gCubeIdentity.resetIdentity(); }
*/
}
/**
* Gets the UCD by ID.
*
* @param profileID the profile ID
* @return the UCD by ID
* @throws Exception the exception
*/
public UseCaseDescriptorDV getUCDByID(String profileID) throws Exception {
UseCaseDescriptorCaller ucdCaller = GeoportalClientCaller.useCaseDescriptors();
UseCaseDescriptor ucd = ucdCaller.getUCDForId(profileID);
return ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null);
}
}

View File

@ -0,0 +1,49 @@
package org.gcube.portlets.user.geoportaldataviewer.shared;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
public class ItemFieldsResponse implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8778792633248190350L;
UseCaseDescriptorDV useCaseDescriptorDV;
List<ItemFieldDV> listItemFields;
public ItemFieldsResponse() {
}
public UseCaseDescriptorDV getUseCaseDescriptorDV() {
return useCaseDescriptorDV;
}
public List<ItemFieldDV> getListItemFields() {
return listItemFields;
}
public void setUseCaseDescriptorDV(UseCaseDescriptorDV useCaseDescriptorDV) {
this.useCaseDescriptorDV = useCaseDescriptorDV;
}
public void setListItemFields(List<ItemFieldDV> listItemFields) {
this.listItemFields = listItemFields;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ItemFieldsResponse [useCaseDescriptorDV=");
builder.append(useCaseDescriptorDV);
builder.append(", listItemFields=");
builder.append(listItemFields);
builder.append("]");
return builder.toString();
}
}