You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
3.3 KiB
Java
130 lines
3.3 KiB
Java
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
|
|
|
import com.github.gwtbootstrap.client.ui.Button;
|
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
|
import com.github.gwtbootstrap.client.ui.Tab;
|
|
import com.github.gwtbootstrap.client.ui.TabPanel;
|
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|
import com.google.gwt.core.client.GWT;
|
|
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.uibinder.client.UiBinder;
|
|
import com.google.gwt.uibinder.client.UiField;
|
|
import com.google.gwt.user.client.ui.Composite;
|
|
import com.google.gwt.user.client.ui.HTML;
|
|
import com.google.gwt.user.client.ui.Widget;
|
|
|
|
public class GeonaDataViewMainPanel extends Composite {
|
|
|
|
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
|
|
|
|
interface GeonaDataViewMainPanelUiBinder extends UiBinder<Widget, GeonaDataViewMainPanel> {
|
|
}
|
|
|
|
@UiField
|
|
Tab mapTabPanel;
|
|
|
|
@UiField
|
|
NavLink dataPointSelection;
|
|
|
|
@UiField
|
|
NavLink dataBoxSelection;
|
|
|
|
@UiField
|
|
Button removeQuery;
|
|
|
|
@UiField
|
|
TabPanel mainTabPanel;
|
|
|
|
// @UiField
|
|
// ButtonGroup buttonGroup;
|
|
|
|
private MapPanel mapPanel;
|
|
|
|
private OpenLayerOSM map;
|
|
|
|
private HandlerManager eventBus;
|
|
|
|
public GeonaDataViewMainPanel(HandlerManager eventBus) {
|
|
initWidget(uiBinder.createAndBindUi(this));
|
|
this.eventBus = eventBus;
|
|
mapPanel = new MapPanel("600px");
|
|
mapTabPanel.add(mapPanel);
|
|
bindHandlers();
|
|
dataPointSelection.setIcon(IconType.SCREENSHOT);
|
|
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
|
|
|
removeQuery.setIcon(IconType.REMOVE);
|
|
}
|
|
|
|
public void setMapHeight(int height) {
|
|
mapPanel.setHeight(height + "px");
|
|
}
|
|
|
|
public MapPanel getMapPanel() {
|
|
return mapPanel;
|
|
}
|
|
|
|
public void setMap(OpenLayerOSM map) {
|
|
this.map = map;
|
|
}
|
|
|
|
public void bindHandlers() {
|
|
|
|
dataPointSelection.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
map.removeQueryInteractions();
|
|
GWT.log("dataPointSelection.isActive() " + dataPointSelection.isActive());
|
|
if (!dataPointSelection.isActive()) {
|
|
map.addPointVectorSource();
|
|
}
|
|
removeQuery.setVisible(true);
|
|
//dataBoxSelection.setActive(false);
|
|
//dataBoxSelection.getElement().removeClassName("active");
|
|
}
|
|
});
|
|
|
|
dataBoxSelection.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
map.removeQueryInteractions();
|
|
GWT.log("dataBoxSelection.isActive() " + dataBoxSelection.isActive());
|
|
if (!dataBoxSelection.isActive()) {
|
|
map.addExtentInteraction();
|
|
}
|
|
removeQuery.setVisible(true);
|
|
//dataPointSelection.setActive(false);
|
|
//dataPointSelection.getElement().removeClassName("active");
|
|
}
|
|
});
|
|
|
|
removeQuery.addClickHandler(new ClickHandler() {
|
|
|
|
@Override
|
|
public void onClick(ClickEvent event) {
|
|
map.removeQueryInteractions();
|
|
removeQuery.setVisible(false);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
public void addNewTab(ConcessioneDV cdv) {
|
|
Tab tab = new Tab();
|
|
String nome = cdv.getNome();
|
|
tab.setHeading(nome);
|
|
|
|
tab.add(new HTML(cdv.toString()));
|
|
mainTabPanel.add(tab);
|
|
tab.asWidget().getElement().focus();
|
|
}
|
|
|
|
}
|