Class LeafletMap
java.lang.Object
com.vaadin.flow.component.Component
org.vaadin.addons.componentfactory.leaflet.LeafletMap
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasTheme,Serializable,Evented,SupportsKeyboardEvents,SupportsLayerEvents,SupportsLocationEvents,SupportsMapEvents,SupportsMouseEvents,Identifiable,ExecutableFunctions,GeolocationFunctions,MapConversionFunctions,MapGetStateFunctions,MapModifyStateFunctions
@Tag("leaflet-map")
@NpmPackage(value="leaflet",
version="1.9.4")
@JsModule("./leaflet-map.js") @JsModule("leaflet/dist/leaflet-src.js")
@CssImport(value="leaflet/dist/leaflet.css",themeFor="leaflet-map") @CssImport(value="./styles/leaflet-lumo-theme.css",themeFor="leaflet-map")
public final class LeafletMap
extends com.vaadin.flow.component.Component
implements MapModifyStateFunctions, MapGetStateFunctions, GeolocationFunctions, MapConversionFunctions, SupportsMouseEvents, SupportsMapEvents, SupportsLocationEvents, SupportsKeyboardEvents, SupportsLayerEvents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasStyle
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMap event which fired when map gets initialized on client side -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddControl(LeafletControl leafletControl) Adds the given control to the map<T extends LeafletEvent>
voidaddEventListener(LeafletEventType eventType, LeafletEventListener<T> listener) Adds a listener function (fn) to a particular event type of the object.voidAdds the given layer to the mapvoidaddThemeVariants(LeafletMapVariant... variants) Adds theme variants to the map component.<T extends Serializable>
CompletableFuture<T>call(Identifiable target, String functionName, Class<T> resultType, Serializable... arguments) voidAlias to off()voidexecuteJs(Identifiable target, String functionName, Serializable... arguments) Returns the layer with the given internal ID.getUuid()booleanhasEventListeners(LeafletEventType eventType) Alias to listens(?)booleanisReady()protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) voidremoveControl(LeafletControl leafletControl) Removes the given control from the mapvoidremoveEventListener(LeafletEventType eventType) Alias to off(?)voidremoveLayer(Layer layer) Removes the given layer from the map.voidsetBaseUrl(String baseUrl) com.vaadin.flow.shared.RegistrationwhenReady(com.vaadin.flow.component.ComponentEventListener<LeafletMap.MapReadyEvent> listener) Fired when the map gets initialized with a view (center and zoom) and at least one layer, or immediately if it's already initialized.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods 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, executeJsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.GeolocationFunctions
locate, locate, stopLocateMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.MapConversionFunctions
containerPointToLatLng, containerPointToLayerPoint, distance, latLngToContainerPoint, latLngToLayerPoint, layerPointToContainerPoint, layerPointToLatLng, mouseEventToContainerPoint, mouseEventToLatLng, mouseEventToLayerPoint, project, unproject, wrapLatLng, wrapLatLngBoundsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.MapGetStateFunctions
getBounds, getBoundsZoom, getCenter, getMaxZoom, getMinZoom, getPixelBounds, getPixelOrigin, getPixelWorldBounds, getSize, getZoomMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.MapModifyStateFunctions
fitBounds, fitBounds, fitWorld, fitWorld, flyTo, flyTo, flyTo, flyTo, flyToBounds, flyToBounds, invalidateSize, invalidateSize, invalidateSize, invalidateSize, panBy, panBy, panInside, panInside, panInsideBounds, panInsideBounds, panTo, panTo, setMaxBounds, setMaxZoom, setMinZoom, setView, setView, setView, setZoom, setZoom, setZoomAround, setZoomAround, stop, zoomIn, zoomIn, zoomOut, zoomOutMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.supports.SupportsKeyboardEvents
onKeyDown, onKeyPress, onKeyUpMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.supports.SupportsLayerEvents
onLayerAdd, onLayerRemoveMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.supports.SupportsLocationEvents
onLocationError, onLocationFoundMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.supports.SupportsMapEvents
onLoad, onMove, onMoveEnd, onMoveStart, onResize, onUnload, onViewReset, onZoom, onZoomAnim, onZoomEnd, onZoomLevelsChange, onZoomStartMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.supports.SupportsMouseEvents
onClick, onContextMenuOpened, onDoubleClick, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp
-
Constructor Details
-
LeafletMap
public LeafletMap() -
LeafletMap
-
-
Method Details
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
getLayer
Returns the layer with the given internal ID.- Parameters:
layerId- the id of the layer to be looking for- Returns:
- the layer with the given internal ID
-
findLayer
-
addLayer
Adds the given layer to the map- Parameters:
layer- the layer to add
-
removeLayer
Removes the given layer from the map.- Parameters:
layer- the layer to remove
-
setBaseUrl
-
addControl
Adds the given control to the map- Parameters:
leafletControl- the control to add
-
removeControl
Removes the given control from the map- Parameters:
leafletControl- the control to remove
-
whenReady
public com.vaadin.flow.shared.Registration whenReady(com.vaadin.flow.component.ComponentEventListener<LeafletMap.MapReadyEvent> listener) Fired when the map gets initialized with a view (center and zoom) and at least one layer, or immediately if it's already initialized.- Parameters:
listener- the listener to call when the event occurs, notnull- Returns:
- a handle that can be used for removing the listener
-
addThemeVariants
Adds theme variants to the map component.- Parameters:
variants- theme variants to add
-
executeJs
- Specified by:
executeJsin interfaceExecutableFunctions
-
call
public <T extends Serializable> CompletableFuture<T> call(Identifiable target, String functionName, Class<T> resultType, Serializable... arguments) - Specified by:
callin interfaceExecutableFunctions
-
addEventListener
public <T extends LeafletEvent> void addEventListener(LeafletEventType eventType, LeafletEventListener<T> listener) Description copied from interface:EventedAdds a listener function (fn) to a particular event type of the object.- Specified by:
addEventListenerin interfaceEvented- Type Parameters:
T- the generic type of the leaflet object- Parameters:
eventType- type of the event to be listeninglistener- the event listener
-
getUuid
- Specified by:
getUuidin interfaceIdentifiable
-
removeEventListener
Description copied from interface:EventedAlias to off(?)- Specified by:
removeEventListenerin interfaceEvented- Parameters:
eventType- the event type
-
clearAllEventListeners
public void clearAllEventListeners()Description copied from interface:EventedAlias to off()- Specified by:
clearAllEventListenersin interfaceEvented
-
hasEventListeners
Description copied from interface:EventedAlias to listens(?)- Specified by:
hasEventListenersin interfaceEvented- Parameters:
eventType- the event type- Returns:
- true if a particular event type has any listeners attached to it
-
isReady
public boolean isReady()- Returns:
- the ready
-