Added Application Loader

This commit is contained in:
Francesco Mangiacrapa 2021-11-19 15:02:48 +01:00
parent 846a303ff2
commit 74e21e9962
2 changed files with 23 additions and 9 deletions

View File

@ -32,6 +32,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
@ -41,6 +42,10 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager;
@ -94,7 +99,7 @@ public class GeoportalDataViewer implements EntryPoint {
int attempt = 0;
//private LoaderIcon loaderApp = new LoaderIcon("Loading application....");
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait");
private HTML attributionDiv = new HTML();
@ -104,11 +109,9 @@ public class GeoportalDataViewer implements EntryPoint {
* This is the entry point method.
*/
public void onModuleLoad() {
// Style style = loaderApp.getElement().getStyle();
// style.setZIndex(300);
// style.setMarginTop(50,Unit.PX);
// style.setMarginLeft(50, Unit.PX);
loaderApp.getElement().addClassName("loader-gna-app");
RootPanel.get(APP_DIV).add(loaderApp);
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
@ -119,7 +122,7 @@ public class GeoportalDataViewer implements EntryPoint {
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
//RootPanel.get(APP_DIV).add(loaderApp);
RootPanel.get(APP_DIV).add(loaderApp);
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
RootPanel.get(APP_DIV).add(mainPanel);
@ -134,13 +137,17 @@ public class GeoportalDataViewer implements EntryPoint {
@Override
public void onFailure(Throwable caught) {
//RootPanel.get(APP_DIV).remove(loaderApp);
RootPanel.get(APP_DIV).remove(loaderApp);
Window.alert("Error occurred on instancing the GeoPortale Viewer. Please, contact the support");
}
@Override
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
//RootPanel.get(APP_DIV).remove(loaderApp);
try {
RootPanel.get(APP_DIV).remove(loaderApp);
}catch (Exception e) {
loaderApp.setVisible(false);
}
GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers;
//now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile
loadGeonaDataViewerProfile();

View File

@ -443,4 +443,11 @@ body {
background-color: #f3f3f3 !important;
text-decoration: none;
}
.loader-gna-app {
z-index: 50;
position: absolute;
top: 50%;
left: 50%;
}