Using the cdnjs.cloudflare.com/ajax/libs/nanogallery2

This commit is contained in:
Francesco Mangiacrapa 2021-07-21 17:08:45 +02:00
parent 260aca4036
commit 3939cddf73
3 changed files with 74 additions and 70 deletions

View File

@ -89,20 +89,17 @@ public class GeoportalDataViewer implements EntryPoint {
RootPanel.get(APP_DIV).add(mainPanel); RootPanel.get(APP_DIV).add(mainPanel);
Timer t = new Timer() {
@Override
public void run() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() { Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override @Override
public void execute() { public void execute() {
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),layerManager.getLayerManagerBus()); olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
layerManager.getLayerManagerBus());
layerManager.setOlMap(olMapMng.getOLOSMMap()); layerManager.setOlMap(olMapMng.getOLOSMMap());
mainPanel.setMap(olMapMng.getOLOSMMap()); mainPanel.setMap(olMapMng.getOLOSMMap());
updateSize(); updateSize();
ScriptInjector.fromUrl("//cdn.jsdelivr.net/npm/nanogallery2@3/dist/jquery.nanogallery2.min.js") ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
.setWindow(ScriptInjector.TOP_WINDOW).inject(); .setWindow(ScriptInjector.TOP_WINDOW).inject();
} }
}); });
@ -116,7 +113,8 @@ public class GeoportalDataViewer implements EntryPoint {
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER); paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE); paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
//paramUUID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER); // paramUUID =
// Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID); paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE); paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest); GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
@ -130,7 +128,8 @@ public class GeoportalDataViewer implements EntryPoint {
if (paramGeonaItemID != null) if (paramGeonaItemID != null)
Long.parseLong(paramGeonaItemID); Long.parseLong(paramGeonaItemID);
} catch (Exception e) { } catch (Exception e) {
Window.alert("Bad format for parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_ID+". It must be a Long"); Window.alert("Bad format for parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_ID
+ ". It must be a Long");
paramGeonaItemID = null; paramGeonaItemID = null;
} }
@ -138,7 +137,8 @@ public class GeoportalDataViewer implements EntryPoint {
@Override @Override
public void execute() { public void execute() {
GeoportalDataViewerServiceAsync.Util.getInstance().getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() { GeoportalDataViewerServiceAsync.Util.getInstance()
.getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -166,11 +166,15 @@ public class GeoportalDataViewer implements EntryPoint {
} }
GWT.log("The layerItem is: " + layerItem); GWT.log("The layerItem is: " + layerItem);
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false, null, true); layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
null, true);
if (paramGeonaItemID != null) { if (paramGeonaItemID != null) {
if (paramGeonaItemType == null) { if (paramGeonaItemType == null) {
Window.alert("Missing parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE +" (GeoNa Data Type) where to search the item id: "+paramGeonaItemID); Window.alert(
"Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
+ " (GeoNa Data Type) where to search the item id: "
+ paramGeonaItemID);
return; return;
} }
GeoNaItemRef gir = new GeoNaItemRef(new Long(paramGeonaItemID), paramGeonaItemType); GeoNaItemRef gir = new GeoNaItemRef(new Long(paramGeonaItemID), paramGeonaItemType);
@ -185,12 +189,8 @@ public class GeoportalDataViewer implements EntryPoint {
bindEvents(); bindEvents();
} }
};
t.schedule(3000);
}
/** /**
* Update window size. * Update window size.

View File

@ -22,7 +22,7 @@
type="text/javascript"></script> type="text/javascript"></script>
<link <link
href="https://cdn.jsdelivr.net/npm/nanogallery2@3/dist/css/nanogallery2.min.css" href="//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/css/nanogallery2.min.css"
rel="stylesheet" type="text/css"> rel="stylesheet" type="text/css">
<!-- --> <!-- -->
<!-- Any title is fine --> <!-- Any title is fine -->

View File

@ -29,4 +29,8 @@
<script type="text/javascript" <script type="text/javascript"
src="<%=request.getContextPath()%>/GeoportalDataViewer/GeoportalDataViewer.nocache.js"></script> src="<%=request.getContextPath()%>/GeoportalDataViewer/GeoportalDataViewer.nocache.js"></script>
<link
href="cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/css/nanogallery2.min.css"
rel="stylesheet" type="text/css">
<div id="geoportal-data-viewer"></div> <div id="geoportal-data-viewer"></div>