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

task_21847
Francesco Mangiacrapa 3 years ago
parent 260aca4036
commit 3939cddf73

@ -88,109 +88,109 @@ public class GeoportalDataViewer implements EntryPoint {
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
RootPanel.get(APP_DIV).add(mainPanel);
Timer t = new Timer() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void run() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
@Override
public void execute() {
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),layerManager.getLayerManagerBus());
layerManager.setOlMap(olMapMng.getOLOSMMap());
mainPanel.setMap(olMapMng.getOLOSMMap());
updateSize();
ScriptInjector.fromUrl("//cdn.jsdelivr.net/npm/nanogallery2@3/dist/jquery.nanogallery2.min.js")
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
layerManager.getLayerManagerBus());
layerManager.setOlMap(olMapMng.getOLOSMMap());
mainPanel.setMap(olMapMng.getOLOSMMap());
updateSize();
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
.setWindow(ScriptInjector.TOP_WINDOW).inject();
}
});
}
});
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
updateSize();
}
});
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
//paramUUID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType);
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
//GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID);
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
//VALIDATING THE LONG FORMAT FOR GID
try {
if(paramGeonaItemID!=null)
Long.parseLong(paramGeonaItemID);
}catch (Exception e) {
Window.alert("Bad format for parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_ID+". It must be a Long");
paramGeonaItemID = null;
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
updateSize();
}
});
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
// paramUUID =
// Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType);
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
// GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID);
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
// VALIDATING THE LONG FORMAT FOR GID
try {
if (paramGeonaItemID != null)
Long.parseLong(paramGeonaItemID);
} catch (Exception e) {
Window.alert("Bad format for parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_ID
+ ". It must be a Long");
paramGeonaItemID = null;
}
@Override
public void execute() {
GeoportalDataViewerServiceAsync.Util.getInstance().getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
GeoportalDataViewerServiceAsync.Util.getInstance()
.getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(GeoNaDataViewerProfile profile) {
geonaDataViewerProfile = profile;
GWT.log("Profile: "+geonaDataViewerProfile);
GWT.log("Profile: " + geonaDataViewerProfile);
Iterator<String> it;
String theItemType = paramGeonaItemType;
if(theItemType==null) {
if (theItemType == null) {
it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
it.hasNext();
theItemType= it.next();
theItemType = it.next();
}
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
if(layerItem==null) {
Window.alert("Not detected any layer with type: "+theItemType);
if (layerItem == null) {
Window.alert("Not detected any layer with type: " + theItemType);
return;
}
GWT.log("The layerItem is: "+layerItem);
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false, null, true);
if(paramGeonaItemID!=null) {
if(paramGeonaItemType==null) {
Window.alert("Missing parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE +" (GeoNa Data Type) where to search the item id: "+paramGeonaItemID);
GWT.log("The layerItem is: " + layerItem);
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
null, true);
if (paramGeonaItemID != null) {
if (paramGeonaItemType == null) {
Window.alert(
"Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
+ " (GeoNa Data Type) where to search the item id: "
+ paramGeonaItemID);
return;
}
GeoNaItemRef gir = new GeoNaItemRef(new Long(paramGeonaItemID), paramGeonaItemType);
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
}
}
});
}
});
bindEvents();
}
};
t.schedule(3000);
});
bindEvents();
}
/**
* Update window size.

@ -22,7 +22,7 @@
type="text/javascript"></script>
<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">
<!-- -->
<!-- Any title is fine -->

@ -29,4 +29,8 @@
<script type="text/javascript"
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>
Loading…
Cancel
Save