Added init stage with git and gid parameters

This commit is contained in:
Francesco Mangiacrapa 2020-11-13 17:14:08 +01:00
parent 9d87dc8299
commit 2536912982
3 changed files with 36 additions and 65 deletions

View File

@ -55,9 +55,9 @@ public class GeoportalDataViewer implements EntryPoint {
private String paramWmsRequest;
/** The param UUID. */
private String paramUUID;
//private String paramUUID;
private String geonaItemType;
private String paramGeonaItemType;
/** The param layer title. */
private String paramLayerTitle;
@ -67,7 +67,7 @@ public class GeoportalDataViewer implements EntryPoint {
/** The layer manager. */
private LayerManager layerManager = new LayerManager(eventBus);
private String geonaItemID;
private String paramGeonaItemID;
private GeoNaDataViewerProfile geonaDataViewerProfile;
@ -109,16 +109,23 @@ public class GeoportalDataViewer implements EntryPoint {
// });
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
geonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
paramUUID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER);
geonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
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 + " = " + geonaItemType);
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + geonaItemID);
GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID);
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");
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@ -137,20 +144,31 @@ public class GeoportalDataViewer implements EntryPoint {
geonaDataViewerProfile = profile;
GWT.log("Profile: "+geonaDataViewerProfile);
Iterator<String> it;
if(geonaItemType==null) {
String theItemType = paramGeonaItemType;
if(theItemType==null) {
it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
it.hasNext();
geonaItemType= it.next();
theItemType= it.next();
}
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(geonaItemType);
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
if(layerItem==null) {
Window.alert("Not detected any layer with type: "+geonaItemType);
Window.alert("Not detected any layer with type: "+theItemType);
return;
}
GWT.log("The layerItem is: "+layerItem);
layerManager.addLayer(geonaItemType, null, null, layerItem.getWmsLink(), false, false, null, true);
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;
}
eventBus.fireEvent(new ShowDetailsEvent(paramGeonaItemType, new Long(paramGeonaItemID), null, null));
}
}
});
}
@ -163,55 +181,6 @@ public class GeoportalDataViewer implements EntryPoint {
* Bind events.
*/
private void bindEvents() {
// eventBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
//
// @Override
// public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
// GWT.log("Fired event: "+showDetailsEvent);
// FeatureRow fRow = showDetailsEvent.getFeatureRow();
// if(fRow!=null) {
// if(showDetailsEvent.getProductType().equals(ProductType.CONCESSIONE)) {
// List<String> productIds = fRow.getMapProperties().get("product_id");
// if(productIds!=null && productIds.size()>0) {
// long id = Long.parseLong(productIds.get(0));
// String tabName = "Dettagli Prodotto";
// List<String> listName = fRow.getMapProperties().get("nome");
// if(listName!=null && listName.size()>0) {
// tabName = listName.get(0);
// }
//
// boolean found = mainPanel.selectTabForProductId(id);
// GWT.log("Product with id: "+id+" found? "+found);
// if(!found) {
//
// final Tab theTab = mainPanel.addAsTab(tabName, true, null);
// GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(id, new AsyncCallback<ConcessioneDV>() {
//
// @Override
// public void onFailure(Throwable caught) {
// Window.alert(caught.getMessage());
// theTab.clear();
// theTab.setIcon(IconType.WARNING_SIGN);
// theTab.add(new HTML(caught.getMessage()));
//
// }
//
// @Override
// public void onSuccess(ConcessioneDV result) {
// GWT.log("Showing: "+result);
// mainPanel.renderProductIntoTab(theTab, result);
//
// }
// });
// }else
// Window.alert("No product id found");
// }
//
// }
// }
//
// }
// });
eventBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {

View File

@ -145,6 +145,8 @@ public class LayerManager {
flex.getElement().addClassName("popup-table");
boolean featureFound = false;
FeatureRow feature = null;
//TODO SWTCH FOR EARCH ITEM TYPE
for (GeoNaDataObject geoNaDataObject : listGeonaDataObjects) {
List<FeatureRow> features = geoNaDataObject.getFeatures();

View File

@ -28,7 +28,7 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
* @param itemName the item name
* @param featureRow the feature row
*/
public ShowDetailsEvent(String geonaItemType, long geonaID, String itemName, FeatureRow featureRow) {
public ShowDetailsEvent(String geonaItemType, Long geonaID, String itemName, FeatureRow featureRow) {
this.geonaItemType = geonaItemType;
this.geonaID = geonaID;
this.itemName = itemName;