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

View File

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

View File

@ -1,19 +1,18 @@
package org.gcube.portlets.user.geoportaldataviewer.client; package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.List; import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData; import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter; 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.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap; import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; 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.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV; import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration; 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.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -66,7 +65,7 @@ public interface GeoportalDataViewerServiceAsync {
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback); 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, // void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
// AsyncCallback<ResultSetPaginatedData> callback); // 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> mapDetailLayerObjects = new HashMap<String, LayerObject>();
private Map<String, LayerObject> mapBaseLayerObjects = 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(""); 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, addLayer(LayerObjectType.INDEX_LAYER, null, null, layer.getLayer().getOgcLinks().get("wms"), false, false, null, false,
null, null, null, null); 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 @Override
protected void dispatch(CloseCollectionEventHandler h) { protected void dispatch(CloseCollectionEventHandler h) {
} }
public CloseCollectionEvent(String collectionId) { public CloseCollectionEvent(String collectionId) {

View File

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

View File

@ -3,12 +3,12 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.SearchingFilter; import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER; import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; 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.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.events.ChangeMapLayerEvent; 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;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location; 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.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
@ -139,7 +140,7 @@ public class GeonaDataViewMainPanel extends Composite {
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight, public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
Map<String, List<ItemFieldDV>> mapOfSearchingFilterForUCD) { List<ItemFieldsResponse> itemFieldsReponse) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus; this.applicationBus = applicationBus;
mapPanel = new MapPanel(mapHeight + "px"); mapPanel = new MapPanel(mapHeight + "px");
@ -165,14 +166,14 @@ public class GeonaDataViewMainPanel extends Composite {
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get()); linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get()); linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
openCollectionDropDown.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get()); openCollectionDropDown.setIcon(IconType.COMPASS);
SearchingFilter initialSortFilter = new SearchingFilter(); SearchingFilter initialSortFilter = new SearchingFilter();
initialSortFilter.setOrder(ORDER.ASC); 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> displayFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>(); List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>(); List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
@ -190,28 +191,29 @@ public class GeonaDataViewMainPanel extends Composite {
} }
} }
NavLink navLink = new NavLink(profileID); final UseCaseDescriptorDV ucd = ifResponse.getUseCaseDescriptorDV();
navLink.setText(profileID); NavLink navLink = new NavLink(ifResponse.getUseCaseDescriptorDV().getName());
//navLink.setText(ucd.getName());
navLink.addClickHandler(new ClickHandler() { navLink.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
searchFacilityPanel.clear(); searchFacilityPanel.clear();
SearchFacilityUI searchFacility = new SearchFacilityUI(profileID, applicationBus, sortByFields, searchByFields, SearchFacilityUI searchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, sortByFields, searchByFields,
initialSortFilter); initialSortFilter);
searchFacilityPanel.add(searchFacility); searchFacilityPanel.add(searchFacility);
searchFacility.setSearchButton(searchFacilityButton); searchFacility.setSearchButton(searchFacilityButton);
} }
}); });
GWT.log("Added navLink for: " + profileID); GWT.log("Added navLink for: " + ucd.getName());
navListSearch.add(navLink); navListSearch.add(navLink);
} }
searchFacilityButton.setIcon(IconType.SEARCH); searchFacilityButton.setIcon(IconType.SEARCH);
if (mapOfSearchingFilterForUCD.size() == 0) { if (itemFieldsReponse.size() == 0) {
searchFacilityPanel.setVisible(false); searchFacilityPanel.setVisible(false);
searchFacilityButton.setVisible(false); searchFacilityButton.setVisible(false);
} }
@ -507,6 +509,13 @@ public class GeonaDataViewMainPanel extends Composite {
openCollectionPanel.add(checkbox); 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 {
font-weight: bold; font-weight: bold;
} }
.open-collection-style {
padding-left: 15px;
padding-right: 15px;
}
</ui:style> </ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel"> <g:HTMLPanel ui:field="mainHTMLPanel">
<g:HTMLPanel ui:field="mainContainerPanel"> <g:HTMLPanel ui:field="mainContainerPanel">
@ -37,7 +43,7 @@
</b:DropdownButton> </b:DropdownButton>
<b:DropdownButton type="LINK" <b:DropdownButton type="LINK"
text="Open Collection" ui:field="openCollectionDropDown"> text="Open Collection" ui:field="openCollectionDropDown">
<g:HTMLPanel ui:field="openCollectionPanel"> <g:HTMLPanel ui:field="openCollectionPanel" addStyleNames="{style.open-collection-style}">
</g:HTMLPanel> </g:HTMLPanel>
</b:DropdownButton> </b:DropdownButton>
<b:DropdownButton type="LINK" <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.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV; 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.application.geoportalcommon.shared.gis.BoundsMap;
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;
@ -49,17 +50,28 @@ public class LayersSectionViewer extends Composite {
int downloadAttempt = 0; int downloadAttempt = 0;
public LayersSectionViewer(GCubeSDIViewerLayerDV layer) { private GCubeSDIViewerLayerDV layer;
private SubDocumentView subDocumentView;
public LayersSectionViewer(GCubeSDIViewerLayerDV layer, SubDocumentView subDocumentView) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
GWT.log("Showing: " + layer); GWT.log("Showing: " + layer);
this.layer = layer;
this.subDocumentView = subDocumentView;
String wmsLink = null; String wmsLink = null;
try { try {
wmsLink = layer.getOgcLinks().get("wms"); wmsLink = layer.getOgcLinks().get("wms");
}catch (Exception e) { } catch (Exception e) {
return; return;
} }
if (wmsLink == null) {
GeoportalDataViewerConstants.printJs("Wms link is null");
return;
}
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink); String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
GWT.log("WMS LINK: " + wmsLink); GWT.log("WMS LINK: " + wmsLink);
@ -70,22 +82,21 @@ public class LayersSectionViewer extends Composite {
exportMapButton.setIcon(IconType.DOWNLOAD_ALT); exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
exportMapButton.setTitle("Export the map view (OSM + layer) as an image..."); exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
Style exportStyle = exportMapButton.getElement().getStyle(); Style exportStyle = exportMapButton.getElement().getStyle();
//exportStyle.setWidth(100, Unit.PCT); // exportStyle.setWidth(100, Unit.PCT);
exportStyle.setMarginLeft(70, Unit.PCT); exportStyle.setMarginLeft(70, Unit.PCT);
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY); Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857); Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate, MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px"); GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
mapViewPanel.add(mapView); mapViewPanel.add(mapView);
mapViewPanel.add(exportMapButton); mapViewPanel.add(exportMapButton);
String mapServerHost = wmsLink.contains("?")
? wmsLink.substring(0,wmsLink.indexOf("?")) String mapServerHost = wmsLink.contains("?") ? wmsLink.substring(0, wmsLink.indexOf("?")) : wmsLink;
: wmsLink;
GWT.log("mapServerHost: " + mapServerHost); GWT.log("mapServerHost: " + mapServerHost);
BBOXDV bbox = layer.getBbox(); BBOXDV bbox = layer.getBbox();
GWT.log("bbox: " + bbox); GWT.log("bbox: " + bbox);
GWT.log("bbox keys: " + bbox.keySet()); GWT.log("bbox keys: " + bbox.keySet());
@ -94,12 +105,12 @@ public class LayersSectionViewer extends Composite {
GWT.log("minY: " + bbox.getMinY()); GWT.log("minY: " + bbox.getMinY());
GWT.log("maxX: " + bbox.getMaxX()); GWT.log("maxX: " + bbox.getMaxX());
GWT.log("maxY: " + bbox.getMaxY()); 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); GWT.log("bounds: " + bounds);
mapView.addWMSLayer(mapServerHost, layerName, bounds); mapView.addWMSLayer(mapServerHost, layerName, bounds);
String htmlLinkId = mapView.getPanelMapElementId() + "-image-download"; String htmlLinkId = mapView.getPanelMapElementId() + "-image-download";
for (IMAGE_EXPORT_AS exportType : IMAGE_EXPORT_AS.values()) { for (IMAGE_EXPORT_AS exportType : IMAGE_EXPORT_AS.values()) {
NavLink navLink = new NavLink(exportType.name()); NavLink navLink = new NavLink(exportType.name());
String exportExt = exportType.name().toLowerCase(); String exportExt = exportType.name().toLowerCase();
@ -131,8 +142,8 @@ public class LayersSectionViewer extends Composite {
} }
// DOWNLOAD the OSM + layer by canvas // DOWNLOAD the OSM + layer by canvas
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId, downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId, filename,
filename, mimeType); mimeType);
// mapExport(mapView.getLightOLSM().getMap(), mapView.getPanelMapElementId()); // mapExport(mapView.getLightOLSM().getMap(), mapView.getPanelMapElementId());
} }
}); });
@ -140,8 +151,12 @@ public class LayersSectionViewer extends Composite {
exportMapButton.add(navLink); 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("Abstract", layerDV.getAbstractSection());
// customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita()); // 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;
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.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.dialogs.DialogShareableLink;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil; 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.Location;
@ -38,18 +40,21 @@ public class ProjectViewer extends Composite {
} }
@UiField @UiField
PageHeader title; PageHeader pageHeaderTitle;
@UiField @UiField
HTMLPanel pageViewDetails; HTMLPanel pageViewDetails;
@UiField
HTMLPanel centroidPanel;
@UiField @UiField
Button shareButton; Button shareButton;
@UiField @UiField
Button expandButton; Button expandButton;
private ProjectView projectView; private ProjectView theProjectView;
private CustomFlexTable customTable = new CustomFlexTable(); private CustomFlexTable customTable = new CustomFlexTable();
@ -70,17 +75,21 @@ public class ProjectViewer extends Composite {
this(item, projectView, true, true); this(item, projectView, true, true);
} }
public ProjectViewer(GeoNaItemRef item, ProjectView projectView, boolean viewImageButtonVisible, public ProjectViewer(GeoNaItemRef item, final ProjectView projectView, boolean viewImageButtonVisible,
boolean openImageButtonVisible) { boolean openImageButtonVisible) {
this(); this();
GWT.log("Rendering " + projectView.getTheProjectDV().getId()); GWT.log("Rendering " + projectView.getTheProjectDV().getId());
this.projectView = projectView; this.theProjectView = projectView;
this.geonaItemRef = item; this.geonaItemRef = item;
this.viewImageButtonVisible = viewImageButtonVisible; this.viewImageButtonVisible = viewImageButtonVisible;
this.openImageButtonVisible = openImageButtonVisible; 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.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE); shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with..."); shareButton.setTitle("Get a link to share with...");
@ -102,24 +111,20 @@ public class ProjectViewer extends Composite {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
Window.alert("Expand must be revisited");
/* ProjectViewer cv = new ProjectViewer(geonaItemRef, theProjectView, false, openImageButtonVisible);
ProjectViewer cv = new ProjectViewer(geonaItemRef, concessioneDV, false, openImageButtonVisible);
cv.setExpandViewButtonVisible(false); cv.setExpandViewButtonVisible(false);
int width = Window.getClientWidth() * 75 / 100; int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 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.add(cv);
mw.setCaller(ProjectViewer.this); mw.setCaller(ProjectViewer.this);
// mw.setWidth(900); // mw.setWidth(900);
mw.show(); mw.show();
*/
} }
}); });
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() { GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
@Override @Override
@ -132,11 +137,10 @@ public class ProjectViewer extends Composite {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
} }
}); });
for (SectionView sectionView : projectView.getListSections()) { for (SectionView sectionView : projectView.getListSections()) {
if(!sectionView.isEmpty()) { if (!sectionView.isEmpty()) {
SectionViewer sectionViewer = new SectionViewer(sectionView); SectionViewer sectionViewer = new SectionViewer(sectionView);
pageViewDetails.add(sectionViewer); pageViewDetails.add(sectionViewer);
} }
@ -149,26 +153,24 @@ public class ProjectViewer extends Composite {
MapView mapView = new MapView(transformedCenterCoordinate, MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px"); GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
Window.alert("addCentroidMap must be revisited"); if (theProjectView != null && theProjectView.getCentroidLat() != null
&& theProjectView.getCentroidLong() != null) {
// if (concessioneDV != null && concessioneDV.getCentroidLat() != null Coordinate coord = new Coordinate(theProjectView.getCentroidLong(), theProjectView.getCentroidLat());
// && concessioneDV.getCentroidLong() != null) { Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
// Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat()); MAP_PROJECTION.EPSG_3857.getName());
// Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(), // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
// MAP_PROJECTION.EPSG_3857.getName()); boolean authenticatedUser = myLogin != null ? true : false;
// // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord); mapView.addMarker(transfCoord, authenticatedUser);
// boolean authenticatedUser = myLogin != null ? true : false; centroidPanel.add(mapView);
// mapView.addMarker(transfCoord, authenticatedUser); } else if (theProjectView != null) {
// mapViewPanel.add(mapView); GeoportalDataViewerConstants
// } else if (concessioneDV != null) { .printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
// GeoportalDataViewerConstants + theProjectView.getCentroidLong() + ", Long:" + theProjectView.getCentroidLat());
// .printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " }
// + concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
// }
} }
public ProjectView getProjectView() { public ProjectView getProjectView() {
return projectView; return theProjectView;
} }
protected void setExpandViewButtonVisible(boolean bool) { protected void setExpandViewButtonVisible(boolean bool) {

View File

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

View File

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

View File

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

View File

@ -1,333 +1,333 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni; //package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; //import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; //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.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV; //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.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV; //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;
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.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;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery.ImagesGallery; //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;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location; //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.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView; //import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable; //import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
//
import com.github.gwtbootstrap.client.ui.Button; //import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.PageHeader; //import com.github.gwtbootstrap.client.ui.PageHeader;
import com.github.gwtbootstrap.client.ui.Paragraph; //import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.Thumbnails; //import com.github.gwtbootstrap.client.ui.Thumbnails;
import com.github.gwtbootstrap.client.ui.constants.ButtonType; //import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType; //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.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;
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.HTMLPanel; //import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
import ol.Coordinate; //import ol.Coordinate;
//
public class ConcessioneView extends Composite { //public class ConcessioneView extends Composite {
//
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class); // private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
//
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> { // interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
} // }
//
@UiField // @UiField
PageHeader titolo; // PageHeader titolo;
//
@UiField // @UiField
Paragraph introduzione; // Paragraph introduzione;
//
@UiField // @UiField
HTMLPanel concessioniPanel; // HTMLPanel concessioniPanel;
//
@UiField // @UiField
HTMLPanel relazioneScavoPanel; // HTMLPanel relazioneScavoPanel;
//
@UiField // @UiField
HTMLPanel imagesPanel; // HTMLPanel imagesPanel;
//
@UiField // @UiField
HTMLPanel pageViewDetails; // HTMLPanel pageViewDetails;
//
@UiField // @UiField
HTMLPanel mapViewPanel; // HTMLPanel mapViewPanel;
//
@UiField // @UiField
HTMLPanel posizionamentoAreaIndaginePanel; // HTMLPanel posizionamentoAreaIndaginePanel;
//
@UiField // @UiField
HTMLPanel piantaFineScavoPanel; // HTMLPanel piantaFineScavoPanel;
//
@UiField // @UiField
Button shareButton; // Button shareButton;
//
@UiField // @UiField
Button expandButton; // Button expandButton;
//
private ConcessioneDV concessioneDV; // private ConcessioneDV concessioneDV;
//
private Thumbnails thumbNails = new Thumbnails(); // private Thumbnails thumbNails = new Thumbnails();
//
private CustomFlexTable customTable = new CustomFlexTable(); // private CustomFlexTable customTable = new CustomFlexTable();
//
private GeoNaItemRef geonaItemRef; // private GeoNaItemRef geonaItemRef;
//
private String myLogin; // private String myLogin;
//
private boolean viewImageButtonVisible = true; // private boolean viewImageButtonVisible = true;
//
private boolean openImageButtonVisible = true; // private boolean openImageButtonVisible = true;
//
private ConcessioneView() { // private ConcessioneView() {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().setId("page-view-details"); // pageViewDetails.getElement().setId("page-view-details");
} // }
//
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV) { // public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV) {
this(item, concDV, true, true); // this(item, concDV, true, true);
} // }
//
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible, // public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible,
boolean openImageButtonVisible) { // boolean openImageButtonVisible) {
this(); // this();
GWT.log("Rendering " + concDV.getNome()); // GWT.log("Rendering " + concDV.getNome());
this.concessioneDV = concDV; // this.concessioneDV = concDV;
this.geonaItemRef = item; // this.geonaItemRef = item;
this.viewImageButtonVisible = viewImageButtonVisible; // this.viewImageButtonVisible = viewImageButtonVisible;
this.openImageButtonVisible = openImageButtonVisible; // this.openImageButtonVisible = openImageButtonVisible;
//
titolo.setText(concessioneDV.getNome()); // titolo.setText(concessioneDV.getNome());
introduzione.setText(concessioneDV.getIntroduzione()); // introduzione.setText(concessioneDV.getIntroduzione());
//
if (concessioneDV.getDataInizioProgetto() != null) { // if (concessioneDV.getDataInizioProgetto() != null) {
customTable.addNextKeyValue("Data Inizio Progetto", // customTable.addNextKeyValue("Data Inizio Progetto",
GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataInizioProgetto())); // GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataInizioProgetto()));
} // }
//
if (concessioneDV.getDataFineProgetto() != null) { // if (concessioneDV.getDataFineProgetto() != null) {
customTable.addNextKeyValue("Data Fine Progetto", // customTable.addNextKeyValue("Data Fine Progetto",
GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataFineProgetto())); // GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataFineProgetto()));
} // }
//
if (concessioneDV.getParoleChiaveLibere() != null) { // if (concessioneDV.getParoleChiaveLibere() != null) {
customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(), // customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getParoleChiaveICCD() != null) { // if (concessioneDV.getParoleChiaveICCD() != null) {
customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(), // customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getAuthors() != null) { // if (concessioneDV.getAuthors() != null) {
customTable.addNextKeyValues("Staff", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR); // customTable.addNextKeyValues("Staff", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getContributore() != null) { // if (concessioneDV.getContributore() != null) {
customTable.addNextKeyValue("Contributore", concessioneDV.getContributore()); // customTable.addNextKeyValue("Contributore", concessioneDV.getContributore());
} // }
//
if (concessioneDV.getEditore() != null) { // if (concessioneDV.getEditore() != null) {
customTable.addNextKeyValue("Editore", concessioneDV.getEditore()); // customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
} // }
//
if (concessioneDV.getResponsabile() != null) { // if (concessioneDV.getResponsabile() != null) {
customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile()); // customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile());
} // }
//
if (concessioneDV.getRisorseCorrelate() != null) { // if (concessioneDV.getRisorseCorrelate() != null) {
customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(), // customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getTitolari() != null) { // if (concessioneDV.getTitolari() != null) {
customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(), // customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getSoggetto() != null) { // if (concessioneDV.getSoggetto() != null) {
customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(), // customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getEditore() != null) { // if (concessioneDV.getEditore() != null) {
customTable.addNextKeyValue("Editore", concessioneDV.getEditore()); // customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
} // }
//
if (concessioneDV.getFontiFinanziamento() != null) { // if (concessioneDV.getFontiFinanziamento() != null) {
customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(), // customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getLicenzaID() != null) { // if (concessioneDV.getLicenzaID() != null) {
customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID()); // customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
} // }
//
if (concessioneDV.getTitolariLicenza() != null) { // if (concessioneDV.getTitolariLicenza() != null) {
customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(), // customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
if (concessioneDV.getTitolariCopyright() != null) { // if (concessioneDV.getTitolariCopyright() != null) {
customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(), // customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(),
GeoportalDataViewerConstants.NEW_LINE_BR); // GeoportalDataViewerConstants.NEW_LINE_BR);
} // }
//
shareButton.setType(ButtonType.LINK); // shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE); // shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with..."); // shareButton.setTitle("Get a link to share with...");
//
shareButton.addClickHandler(new ClickHandler() { // shareButton.addClickHandler(new ClickHandler() {
//
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null); // DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null);
//
} // }
}); // });
//
expandButton.setType(ButtonType.LINK); // expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND); // expandButton.setIcon(IconType.EXPAND);
expandButton.setTitle("Show this view in new Window"); // expandButton.setTitle("Show this view in new Window");
//
expandButton.addClickHandler(new ClickHandler() { // expandButton.addClickHandler(new ClickHandler() {
//
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
//
ConcessioneView cv = new ConcessioneView(geonaItemRef, concessioneDV, false, openImageButtonVisible); // ConcessioneView cv = new ConcessioneView(geonaItemRef, concessioneDV, false, openImageButtonVisible);
cv.setExpandViewButtonVisible(false); // cv.setExpandViewButtonVisible(false);
int width = Window.getClientWidth() * 75 / 100; // int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100; // int height = Window.getClientHeight() * 70 / 100;
ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height); // ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height);
mw.add(cv); // mw.add(cv);
mw.setCaller(ConcessioneView.this); // mw.setCaller(ConcessioneView.this);
// mw.setWidth(900); // // mw.setWidth(900);
mw.show(); // mw.show();
//
} // }
}); // });
//
concessioniPanel.add(customTable); // concessioniPanel.add(customTable);
//
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() { // GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
//
@Override // @Override
public void onSuccess(String result) { // public void onSuccess(String result) {
myLogin = result; // myLogin = result;
addCentroidMap(); // addCentroidMap();
addRelazioneDiScavo(); // addRelazioneDiScavo();
addPosizionamentoAreaIndagine(); // addPosizionamentoAreaIndagine();
addPiantaFineScavo(); // addPiantaFineScavo();
} // }
//
@Override // @Override
public void onFailure(Throwable caught) { // public void onFailure(Throwable caught) {
} // }
}); // });
//
addUploadedImages(); // addUploadedImages();
//
} // }
//
private void addPosizionamentoAreaIndagine() { // private void addPosizionamentoAreaIndagine() {
//
LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo(); // LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo();
if (layer == null) // if (layer == null)
return; // return;
//
posizionamentoAreaIndaginePanel.setVisible(true); // posizionamentoAreaIndaginePanel.setVisible(true);
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer)); // posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
} // }
//
private void addPiantaFineScavo() { // private void addPiantaFineScavo() {
//
List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo(); // List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo();
//
if (listLayersDV == null) // if (listLayersDV == null)
return; // return;
//
for (LayerConcessioneDV layerDV : listLayersDV) { // for (LayerConcessioneDV layerDV : listLayersDV) {
piantaFineScavoPanel.setVisible(true); // piantaFineScavoPanel.setVisible(true);
piantaFineScavoPanel.add(new LayerConcessioneView(layerDV)); // piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
} // }
} // }
//
private void addRelazioneDiScavo() { // private void addRelazioneDiScavo() {
//
AbstractRelazioneScavoDV abstractRS = concessioneDV.getAbstractRelazioneScavo(); // AbstractRelazioneScavoDV abstractRS = concessioneDV.getAbstractRelazioneScavo();
RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo(); // RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo();
if (abstractRS == null && relazioneScavo==null) // if (abstractRS == null && relazioneScavo==null)
return; // return;
//
relazioneScavoPanel.setVisible(true); // relazioneScavoPanel.setVisible(true);
relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo())); // relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo()));
} // }
//
private void addCentroidMap() { // private void addCentroidMap() {
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY); // Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857); // Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate, // MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px"); // GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
//
if (concessioneDV != null && concessioneDV.getCentroidLat() != null // if (concessioneDV != null && concessioneDV.getCentroidLat() != null
&& concessioneDV.getCentroidLong() != null) { // && concessioneDV.getCentroidLong() != null) {
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat()); // Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(), // Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName()); // MAP_PROJECTION.EPSG_3857.getName());
// Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord); // // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
boolean authenticatedUser = myLogin != null ? true : false; // boolean authenticatedUser = myLogin != null ? true : false;
mapView.addMarker(transfCoord, authenticatedUser); // mapView.addMarker(transfCoord, authenticatedUser);
mapViewPanel.add(mapView); // mapViewPanel.add(mapView);
} else if (concessioneDV != null) { // } else if (concessioneDV != null) {
GeoportalDataViewerConstants // GeoportalDataViewerConstants
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " // .printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
+ concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat()); // + concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
} // }
} // }
//
private void addUploadedImages() { // private void addUploadedImages() {
GWT.log("Managing immagini: " + concessioneDV.getImmaginiRappresentative()); // GWT.log("Managing immagini: " + concessioneDV.getImmaginiRappresentative());
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative(); // List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
if (immagini != null && immagini.size() > 0) { // if (immagini != null && immagini.size() > 0) {
imagesPanel.setVisible(true); // imagesPanel.setVisible(true);
//
List<UploadedImageDV> immaginiToShow = new ArrayList<UploadedImageDV>(); // List<UploadedImageDV> immaginiToShow = new ArrayList<UploadedImageDV>();
for (UploadedImageDV uploadedImageDV : immagini) { // for (UploadedImageDV uploadedImageDV : immagini) {
immaginiToShow.add(uploadedImageDV); // immaginiToShow.add(uploadedImageDV);
} // }
//
if (immaginiToShow.size() > 0) { // if (immaginiToShow.size() > 0) {
ImagesGallery gallery = new ImagesGallery(immaginiToShow); // ImagesGallery gallery = new ImagesGallery(immaginiToShow);
imagesPanel.add(gallery.getGalleryPanel()); // imagesPanel.add(gallery.getGalleryPanel());
gallery.fillGallery(); // gallery.fillGallery();
} // }
} // }
} // }
//
public ConcessioneDV getConcessioneDV() { // public ConcessioneDV getConcessioneDV() {
return concessioneDV; // return concessioneDV;
} // }
//
protected void setExpandViewButtonVisible(boolean bool) { // protected void setExpandViewButtonVisible(boolean bool) {
expandButton.setVisible(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>>>() { RemovalListener<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> removalListener = new RemovalListener<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>>() {
public void onRemoval( public void onRemoval(
RemovalNotification<String, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>> removal) { 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.server.util.SessionUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection; import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration; import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError; import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
@ -786,7 +787,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
} }
@Override @Override
public Map<String, List<ItemFieldDV>> listOfFieldsForSearching() throws Exception { public List<ItemFieldsResponse> listOfFieldsForSearching() throws Exception {
LOG.info("listOfFieldsForSearching called"); LOG.info("listOfFieldsForSearching called");
try { try {
@ -794,7 +795,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
// GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile(); // GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
// return profile.getListItemFields(); // 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<String> handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId());
List<UseCaseDescriptor> listUseCaseDescriptor; List<UseCaseDescriptor> listUseCaseDescriptor;
@ -810,10 +811,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
listUseCaseDescriptor = new ArrayList<UseCaseDescriptor>(); listUseCaseDescriptor = new ArrayList<UseCaseDescriptor>();
} }
List<UseCaseDescriptorDV> listUCDDV = new ArrayList<UseCaseDescriptorDV>(listUseCaseDescriptor.size()); //List<UseCaseDescriptorDV> listUCDDV = new ArrayList<UseCaseDescriptorDV>(listUseCaseDescriptor.size());
for (UseCaseDescriptor ucd : listUseCaseDescriptor) { for (UseCaseDescriptor ucd : listUseCaseDescriptor) {
UseCaseDescriptorDV ucdDV = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null); UseCaseDescriptorDV ucdDV = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null);
listUCDDV.add(ucdDV); //listUCDDV.add(ucdDV);
HandlerDeclarationDV dataListHandler = getHandlerDeclarationFor(ucdDV, HandlerDeclarationDV dataListHandler = getHandlerDeclarationFor(ucdDV,
GEOPORTAL_DATA_HANDLER.geoportal_data_list); GEOPORTAL_DATA_HANDLER.geoportal_data_list);
@ -821,8 +822,12 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
ConfigurationDV<?> config = dataListHandler.getConfiguration(); ConfigurationDV<?> config = dataListHandler.getConfiguration();
switch (config.getConfigurationType()) { switch (config.getConfigurationType()) {
case item_fields: case item_fields:
ItemFieldsResponse ifResponse = new ItemFieldsResponse();
ifResponse.setUseCaseDescriptorDV(ucdDV);
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) config.getConfiguration(); List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) config.getConfiguration();
map.put(ucdDV.getProfileID(), listItemFields); //map.put(ucdDV.getProfileID(), listItemFields);
ifResponse.setListItemFields(listItemFields);
listIFResponse.add(ifResponse);
break; break;
default: default:
@ -831,8 +836,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
} }
} }
LOG.info("listOfFieldsForSearching returning: " + map); LOG.info("listOfFieldsForSearching returning: " + listIFResponse);
return map; return listIFResponse;
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error on loading list of fields for searching: ", 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()); 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); LOG.info("Trying to get project for id " + profileID);
GeoportalServiceIdentityProxy cms = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest()); GeoportalServiceIdentityProxy geoIP = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
ProjectDV theProjectDV = cms.getProjectByID(profileID, projectID); UseCaseDescriptorDV ucd = geoIP.getUCDByID(profileID);
ProjectDV theProjectDV = geoIP.getProjectByID(profileID, projectID);
theProjectDV.setProfileName(ucd.getName());
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, scope, userName); 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 javax.servlet.http.HttpServletRequest;
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.useCaseDescriptor.UseCaseDescriptor;
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel; import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
import org.gcube.application.geoportalcommon.ProjectDVBuilder; import org.gcube.application.geoportalcommon.ProjectDVBuilder;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller; import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller; 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.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.common.portal.PortalContext; 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.GcubeIdentity;
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientIdentity; import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientIdentity;
@ -79,4 +82,17 @@ public class GeoportalServiceIdentityProxy {
* gCubeIdentity.resetIdentity(); } * 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();
}
}