|
|
|
@ -23,13 +23,20 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Button;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
|
|
|
|
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.event.dom.client.ClickEvent;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
|
|
import com.google.gwt.event.shared.HandlerManager;
|
|
|
|
|
import com.google.gwt.user.client.DOM;
|
|
|
|
|
import com.google.gwt.user.client.Element;
|
|
|
|
|
import com.google.gwt.user.client.Event;
|
|
|
|
|
import com.google.gwt.user.client.EventListener;
|
|
|
|
|
import com.google.gwt.user.client.Window;
|
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
|
import com.google.gwt.user.client.ui.FlexTable;
|
|
|
|
|
import com.google.gwt.user.client.ui.HTML;
|
|
|
|
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
|
|
|
|
|
|
|
|
import ol.Coordinate;
|
|
|
|
|
|
|
|
|
@ -131,10 +138,12 @@ public class LayerManager {
|
|
|
|
|
flex.setCellSpacing(1);
|
|
|
|
|
flex.getElement().addClassName("popup-table");
|
|
|
|
|
boolean featureFound = false;
|
|
|
|
|
FeatureRow feature = null;
|
|
|
|
|
for (GeoNaDataObject geoNaDataObject : result) {
|
|
|
|
|
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
|
|
|
|
|
|
|
|
|
if(features!=null && features.size()>0) {
|
|
|
|
|
feature = features.get(0);
|
|
|
|
|
Map<String, List<String>> entries = features.get(0).getMapProperties();
|
|
|
|
|
|
|
|
|
|
for (String key : entries.keySet()) {
|
|
|
|
@ -147,27 +156,56 @@ public class LayerManager {
|
|
|
|
|
flex.setHTML(2, 0, new HTML("<code>"+entries.get(key).get(0)).toString()+"</code>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Button button = new Button("Open Details");
|
|
|
|
|
button.setType(ButtonType.LINK);
|
|
|
|
|
button.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
|
applicationBus.fireEvent(new ShowDetailsEvent(ProductType.CONCESSIONE, features.get(0)));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
flex.add(button);
|
|
|
|
|
|
|
|
|
|
featureFound = true;
|
|
|
|
|
break; //Only the first one
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FeatureRow theFeature = feature;
|
|
|
|
|
Button button = null;
|
|
|
|
|
if(!featureFound) {
|
|
|
|
|
flex.setHTML(0, 0, new HTML("No data available").toString());
|
|
|
|
|
}else {
|
|
|
|
|
button = new Button("Open Details");
|
|
|
|
|
button.getElement().setId("open-details");
|
|
|
|
|
button.setType(ButtonType.LINK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
olMap.showPopup(flex.toString(), queryEvent.getoLCoordinate());
|
|
|
|
|
VerticalPanel vpPanel = new VerticalPanel();
|
|
|
|
|
vpPanel.add(flex);
|
|
|
|
|
|
|
|
|
|
if(button!=null)
|
|
|
|
|
vpPanel.add(button);
|
|
|
|
|
|
|
|
|
|
olMap.showPopup(vpPanel.toString(), queryEvent.getoLCoordinate());
|
|
|
|
|
|
|
|
|
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void execute() {
|
|
|
|
|
Element buttonElement = DOM.getElementById("open-details");
|
|
|
|
|
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
|
|
|
|
Event.setEventListener(buttonElement, new EventListener() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBrowserEvent(Event event) {
|
|
|
|
|
if(Event.ONCLICK == event.getTypeInt()) {
|
|
|
|
|
applicationBus.fireEvent(new ShowDetailsEvent(ProductType.CONCESSIONE, theFeature));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
button.setType(ButtonType.LINK);
|
|
|
|
|
button.addClickHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
|
GWT.log("qui");
|
|
|
|
|
applicationBus.fireEvent(new ShowDetailsEvent(ProductType.CONCESSIONE, theFeature));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|