Class Layer
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.LeafletObject
org.vaadin.addons.componentfactory.leaflet.layer.Layer
- All Implemented Interfaces:
Serializable,Evented,Identifiable,LayerPopupFunctions,LayerTooltipFunctions,ExecutableFunctions
- Direct Known Subclasses:
DivOverlay,EsriLeafletLayer,GridLayer,HeatLayer,InteractiveLayer,KmzLayer,LayerGroup
public abstract class Layer
extends LeafletObject
implements Evented, LayerPopupFunctions, LayerTooltipFunctions
A set of methods from the Layer base class that all Leaflet layers use.
Inherits all methods, options and events from L.Evented.
- Since:
- 2020-02-06
- Version:
- 1.0
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe event types fired when a layer is added to or removed from a map. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the default map pane (overlayPane) used to render a layer. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLayer()Creates a new layer rendered in the defaultDEFAULT_PANEmap pane. -
Method Summary
Modifier and TypeMethodDescription<T extends LeafletEvent>
voidaddEventListener(LeafletEventType eventType, LeafletEventListener<T> listener) Registers a listener for the given event type on this layer.voidaddTo(LayerGroup layerGroup) Adds the layer to the given layer groupvoidaddTo(LeafletMap leafletMap) Adds the layer to the given mapvoidBinds a popup with the given HTML content to this layer.voidBinds the given popup to this layer.voidbindTooltip(String tooltipContent) Binds a tooltip with the given content to this layer.voidbindTooltip(Tooltip tooltip) Binds the given tooltip to this layer.voidRemoves all event listeners registered on this layer.<T extends LeafletEvent>
voidfireEvent(T leafletEvent) Dispatches the given event to all listeners registered for its event type.Returns the attribution string shown for this layer.Returns the Leaflet event names this layer currently listens to.getPane()Returns the name of the map pane in which this layer is rendered.getPopup()Returns the popup bound to this layer.Returns the tooltip bound to this layer.booleanhasEventListeners(LeafletEventType eventType) Returns whether at least one listener is registered for the given event type.voidonAdd(LeafletEventListener<LeafletEvent> listener) Fired after the layer is added to a mapvoidonPopupClose(LeafletEventListener<PopupEvent> listener) Fired when a popup bound to this layer is closedvoidonPopupOpen(LeafletEventListener<PopupEvent> listener) Fired when a popup bound to this layer is openedvoidonRemove(LeafletEventListener<LeafletEvent> listener) Fired after the layer is removed from a mapvoidonTooltipClose(LeafletEventListener<TooltipEvent> listener) Fired when a tooltip bound to this layer is closed.voidonTooltipOpen(LeafletEventListener<TooltipEvent> listener) Fired when a tooltip bound to this layer is opened.voidremove()Removes the layer from the map it is currently active onvoidremoveEventListener(LeafletEventType eventType) Removes all listeners registered for the given event type.<T> voidset(Supplier<CompletableFuture<T>> futureResult, Consumer<T> handler) Resolves the given asynchronous result and passes it to the handler once it becomes available.voidsetAttribution(String attribution) Sets the attribution string shown for this layer.voidSets the name of the map pane in which this layer is rendered.voidUnbinds the popup previously bound to this layer and removes it.voidUnbinds the tooltip previously bound to this layer and removes it.Methods inherited from class org.vaadin.addons.componentfactory.leaflet.LeafletObject
call, configureObjectMapper, executeJs, getConstructorArgumentNames, getJson, getLeafletType, getParent, getUuid, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.Evented
listens, off, off, onMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.ExecutableFunctions
call, call, executeJs, executeJsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.Identifiable
getUuidMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerPopupFunctions
closePopup, isPopupOpen, openPopup, openPopup, setPopupContent, setPopupContent, togglePopupMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerTooltipFunctions
closeTooltip, isTooltipOpen, openTooltip, openTooltip, setTooltipContent, setTooltipContent, toggleTooltip
-
Field Details
-
DEFAULT_PANE
The name of the default map pane (overlayPane) used to render a layer.- See Also:
-
-
Constructor Details
-
Layer
protected Layer()Creates a new layer rendered in the defaultDEFAULT_PANEmap pane.
-
-
Method Details
-
unbindTooltip
public void unbindTooltip()Unbinds the tooltip previously bound to this layer and removes it.- Specified by:
unbindTooltipin interfaceLayerTooltipFunctions
-
unbindPopup
public void unbindPopup()Unbinds the popup previously bound to this layer and removes it.- Specified by:
unbindPopupin interfaceLayerPopupFunctions
-
onAdd
Fired after the layer is added to a map- Parameters:
listener- the event listener
-
onRemove
Fired after the layer is removed from a map- Parameters:
listener- the event listener
-
onTooltipOpen
Fired when a tooltip bound to this layer is opened.- Parameters:
listener- the event listener
-
onTooltipClose
Fired when a tooltip bound to this layer is closed.- Parameters:
listener- the event listener
-
onPopupOpen
Fired when a popup bound to this layer is opened- Parameters:
listener- the event listener
-
onPopupClose
Fired when a popup bound to this layer is closed- Parameters:
listener- the event listener
-
fireEvent
Dispatches the given event to all listeners registered for its event type.- Type Parameters:
T- the type of the Leaflet event- Parameters:
leafletEvent- the event to fire
-
addTo
Adds the layer to the given layer group- Parameters:
layerGroup- the layer group
-
addTo
Adds the layer to the given map- Parameters:
leafletMap- the leaflet map
-
getEvents
Returns the Leaflet event names this layer currently listens to.- Returns:
- the list of registered event names
-
getAttribution
Returns the attribution string shown for this layer.- Returns:
- the attribution text, or
nullif none is set
-
setAttribution
Sets the attribution string shown for this layer.- Parameters:
attribution- the attribution text to set
-
getPane
Returns the name of the map pane in which this layer is rendered.- Returns:
- the pane name
-
setPane
Sets the name of the map pane in which this layer is rendered.- Parameters:
pane- the pane name to set
-
getPopup
Returns the popup bound to this layer.- Specified by:
getPopupin interfaceLayerPopupFunctions- Returns:
- the bound popup, or
nullif none is bound
-
bindPopup
Binds a popup with the given HTML content to this layer.- Specified by:
bindPopupin interfaceLayerPopupFunctions- Parameters:
popupContent- the HTML content of the popup
-
bindPopup
Binds the given popup to this layer.- Specified by:
bindPopupin interfaceLayerPopupFunctions- Parameters:
popup- the popup to bind
-
getTooltip
Returns the tooltip bound to this layer.- Specified by:
getTooltipin interfaceLayerTooltipFunctions- Returns:
- the bound tooltip, or
nullif none is bound
-
bindTooltip
Binds a tooltip with the given content to this layer.- Specified by:
bindTooltipin interfaceLayerTooltipFunctions- Parameters:
tooltipContent- the content of the tooltip
-
bindTooltip
Binds the given tooltip to this layer.- Specified by:
bindTooltipin interfaceLayerTooltipFunctions- Parameters:
tooltip- the tooltip to bind
-
set
Resolves the given asynchronous result and passes it to the handler once it becomes available.- Type Parameters:
T- the type of the asynchronous result- Parameters:
futureResult- a supplier of the future resulthandler- the consumer invoked with the resolved result
-
addEventListener
public <T extends LeafletEvent> void addEventListener(LeafletEventType eventType, LeafletEventListener<T> listener) Registers a listener for the given event type on this layer.- Specified by:
addEventListenerin interfaceEvented- Type Parameters:
T- the type of the Leaflet event- Parameters:
eventType- the event type to listen forlistener- the listener to invoke when the event occurs
-
clearAllEventListeners
public void clearAllEventListeners()Removes all event listeners registered on this layer.- Specified by:
clearAllEventListenersin interfaceEvented
-
hasEventListeners
Returns whether at least one listener is registered for the given event type.- Specified by:
hasEventListenersin interfaceEvented- Parameters:
eventType- the event type to check- Returns:
trueif a listener is registered for the event type
-
removeEventListener
Removes all listeners registered for the given event type.- Specified by:
removeEventListenerin interfaceEvented- Parameters:
eventType- the event type whose listeners should be removed
-
remove
public void remove()Removes the layer from the map it is currently active on
-