layer_switcher #3

Closed
francesco.mangiacrapa wants to merge 12 commits from layer_switcher into master
4 changed files with 61 additions and 15 deletions
Showing only changes of commit f693ca0e52 - Show all commits

View File

@ -363,13 +363,18 @@ public class GeoportalDataViewer implements EntryPoint {
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
@Override
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doActionOnDetailLayersEvent) {
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doLayerActionEvent) {
DO_LAYER_ACTION doAction = doActionOnDetailLayersEvent.getDoAction();
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
GWT.log("event: "+doAction);
GWT.log("layer source: "+doLayerActionEvent.getLayerSource().getName());
GWT.log("layer target: "+doLayerActionEvent.getLayerTarget());
switch (doAction) {
case OPACITY:
olMapMng.getOLOSMMap().setWMSDetailLayerOpacity(doActionOnDetailLayersEvent.getLayerSource(),
doActionOnDetailLayersEvent.getOpacity());
GWT.log("opacity: "+doLayerActionEvent.getOpacity());
olMapMng.getOLOSMMap().setWMSDetailLayerOpacity(doLayerActionEvent.getLayerSource(),
doLayerActionEvent.getOpacity());
break;
case SWAP:
@ -377,8 +382,9 @@ public class GeoportalDataViewer implements EntryPoint {
break;
case VISIBILITY:
olMapMng.getOLOSMMap().setWMSDetailLayerVisible(doActionOnDetailLayersEvent.getLayerSource(),
doActionOnDetailLayersEvent.getVisibility());
GWT.log("visibility: "+doLayerActionEvent.getVisibility());
olMapMng.getOLOSMMap().setWMSDetailLayerVisible(doLayerActionEvent.getLayerSource(),
doLayerActionEvent.getVisibility());
break;
default:

View File

@ -93,4 +93,23 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
return visibility;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DoActionOnDetailLayersEvent [doAction=");
builder.append(doAction);
builder.append(", layerSource=");
builder.append(layerSource);
builder.append(", layerTarget=");
builder.append(layerTarget);
builder.append(", opacity=");
builder.append(opacity);
builder.append(", visibility=");
builder.append(visibility);
builder.append("]");
return builder.toString();
}
}

View File

@ -422,7 +422,7 @@ public abstract class OpenLayerOSM {
Image wmsLayer = new Image(layerOptions);
map.addLayer(wmsLayer);
wmsDetailsLayerMap.put(key, wmsLayer);
GWT.log("Added WMSDetailLayer for layer name: " + layerItem.getName());
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem, LAYER_TYPE.OVERLAY));
} else {
@ -774,6 +774,7 @@ public abstract class OpenLayerOSM {
public void setWMSDetailLayerVisible(LayerItem layerItem, boolean visible) {
String key = layerItem.getName();
GWT.log("current layers: "+wmsDetailsLayerMap.keySet());
Image layer = wmsDetailsLayerMap.get(key);
layer.setVisible(visible);
}

View File

@ -2,8 +2,13 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.DragStartEvent;
import com.google.gwt.event.dom.client.DragStartHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
@ -13,18 +18,33 @@ public class RangeSlider extends Composite {
interface RangeSliderUiBinder extends UiBinder<Widget, RangeSlider> {
}
@UiField
Element theSlider;
private String sliderId;
public RangeSlider() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiField
Element theSlider;
public RangeSlider(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
String sliderId = "slider-" +Random.nextInt();
theSlider.addClassName("slider");
theSlider.setId(sliderId);
Event.sinkEvents(theSlider, Event.ONMOUSEUP);
Event.setEventListener(theSlider, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
System.out.println("ok");
if(Event.ONMOUSEUP == event.getTypeInt()) {
GWT.log("Event.ONMOUSEUP");
GWT.log("obj"+theSlider.getPropertyObject("value"));
GWT.log("attr"+theSlider.getAttribute("value"));
}
}
});
}
}