Hi, I am using the onOverlayRemove method to register a listener. Now I noticed that when the map loads and the layer was preselected to be active = true, then this method is called even though the layer is NOT being removed. Is this a bug?
I have got a PolygonMap where I override the on OverlayRemove method.
@Override
public void onOverlayRemove(LeafletOverlayRemoveEvent event)
{
for (Layer layer : layers.getOverlays())
{
if (layer.getCaption().equals(event.getName()))
{
layer.setActiveIndicator(false);
}
}
}
And I got Layers like this one, where I keep track wether the layer is active or not.
import org.vaadin.addon.leaflet.LWmsLayer;
public class LMTBLayer extends LWmsLayer implements Layer
{
private String name;
private boolean active;
Hi, I am using the onOverlayRemove method to register a listener. Now I noticed that when the map loads and the layer was preselected to be active = true, then this method is called even though the layer is NOT being removed. Is this a bug?
I have got a PolygonMap where I override the on OverlayRemove method.
@Override public void onOverlayRemove(LeafletOverlayRemoveEvent event) { for (Layer layer : layers.getOverlays()) { if (layer.getCaption().equals(event.getName())) { layer.setActiveIndicator(false); } } }
And I got Layers like this one, where I keep track wether the layer is active or not. import org.vaadin.addon.leaflet.LWmsLayer;
public class LMTBLayer extends LWmsLayer implements Layer { private String name; private boolean active;
LMTBLayer(String geoserverURL) { setUrl(geoserverURL); setLayers("werbeo:mtb"); setTransparent(true); setFormat("image/png"); setActive(true); setEnabled(true); name = "MTB"; setCaption("Messtischblatt"); }
@Override public boolean isActive() { return active; }
@Override public void setActive(boolean active) { setActiveIndicator(active); super.setActive(active); }
@Override public void setActiveIndicator(boolean active) { this.active = active; }
@Override public boolean isActiveIndicator() { return active; }
@Override public String getName() { return name; }
}