Class GoogleMapMarker
java.lang.Object
com.vaadin.flow.component.Component
com.flowingcode.vaadin.addons.googlemaps.GoogleMapMarker
- All Implemented Interfaces:
AttachNotifier,DetachNotifier,HasElement,Serializable
@Tag("google-map-marker")
@JsModule("@flowingcode/google-map/google-map-marker.js")
@NpmPackage(value="@flowingcode/google-map",version="3.8.2") @NpmPackage(value="@googlemaps/markerclusterer",version="2.0.8")
public class GoogleMapMarker
extends Component
The class representing a marker of the Google Map.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent that is called on marker's drag end.static classEvent called on marker's click.static classEvent called on marker's right click. -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new GoogleMapMarker.GoogleMapMarker(String caption, LatLon position, boolean draggable) Instantiates a new GoogleMapMarkerGoogleMapMarker(String caption, LatLon position, boolean draggable, GoogleMapIcon icon) Instantiates a new GoogleMapMarkerGoogleMapMarker(String caption, LatLon position, boolean draggable, String iconUrl) Instantiates a new GoogleMapMarker -
Method Summary
Modifier and TypeMethodDescriptionAdds a click event listener to a marker.Adds a DragEndEvent listener.voidaddInfoWindow(String htmlContent) addRightClickListener(ComponentEventListener<GoogleMapMarker.GoogleMapMarkerRightClickEvent> listener) Adds a right click event listener to a marker.Gets the caption of the marker.Returns the url of the icon of the marker.longReturns the position of the marker.booleanChecks if marker animation is enabled.booleanChecks if the marker is draggable.booleanbooleanChecks if optimization is enabled.voidsetAnimationEnabled(boolean animationEnabled) Enables/disables marker animation.voidsetCaption(String caption) Sets the caption of the marker.voidsetDraggable(boolean draggable) Enables/disables dragging of the marker.voidsetIcon(GoogleMapIcon icon) Sets the icon image of the markervoidsetIconUrl(String iconUrl) Sets the url of the icon of the marker.voidsetIdentifier(long id) voidsetInfoWindowVisible(boolean visible) voidsetLabel(MarkerLabel label) Sets the label of the marker In order to set the label's position use MarkerIcon::setLabelOrigin property.voidsetOptimized(boolean optimized) Enables/disables marker optimization.voidsetPosition(LatLon position) Sets the position of the marker.Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, 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
addDetachListener
-
Constructor Details
-
GoogleMapMarker
public GoogleMapMarker()Instantiates a new GoogleMapMarker. -
GoogleMapMarker
Instantiates a new GoogleMapMarker- Parameters:
caption- The caption to use.position- The position of the markerdraggable- Can marker be dragged?
-
GoogleMapMarker
Instantiates a new GoogleMapMarker- Parameters:
caption- The caption to use.position- The position of the markerdraggable- Can marker be dragged?iconUrl- the icon url as a string
-
GoogleMapMarker
Instantiates a new GoogleMapMarker- Parameters:
caption- The caption to use.position- The position of the markerdraggable- Can marker be dragged?icon- the icon image for the marker
-
-
Method Details
-
addInfoWindow
-
isInfoWindowVisible
@Synchronize(value={"google-map-marker-open","google-map-marker-close"}, property="open") public boolean isInfoWindowVisible() -
setInfoWindowVisible
public void setInfoWindowVisible(boolean visible) -
getPosition
Returns the position of the marker.- Returns:
- The position of the marker.
-
setPosition
Sets the position of the marker.- Parameters:
position- The new position of the marker.
-
getCaption
Gets the caption of the marker.- Returns:
- The caption of the marker.
-
setCaption
Sets the caption of the marker.- Parameters:
caption- The new caption of the marker.
-
isDraggable
public boolean isDraggable()Checks if the marker is draggable.- Returns:
- true, if it is draggable
-
setDraggable
public void setDraggable(boolean draggable) Enables/disables dragging of the marker.- Parameters:
draggable- Set to true to enable dragging.
-
getIconUrl
Returns the url of the icon of the marker.- Returns:
- the url of the icon, default null.
-
setIconUrl
Sets the url of the icon of the marker.- Parameters:
iconUrl- The new url of the icon.
-
setIcon
Sets the icon image of the marker- Parameters:
icon- the icon image of the marker
-
setLabel
Sets the label of the marker In order to set the label's position use MarkerIcon::setLabelOrigin property.- Parameters:
label- the new marker's label
-
isAnimationEnabled
public boolean isAnimationEnabled()Checks if marker animation is enabled.- Returns:
- true, if enabled
-
setAnimationEnabled
public void setAnimationEnabled(boolean animationEnabled) Enables/disables marker animation.- Parameters:
animationEnabled- Set true to enable (default true).
-
isOptimized
public boolean isOptimized()Checks if optimization is enabled.- Returns:
- true, if enabled
-
setOptimized
public void setOptimized(boolean optimized) Enables/disables marker optimization. If enabled, many markers are rendered as a single static element. Disable if you want to use animated GIFs or PNGs.- Parameters:
optimized- Set true to enable (default true).
-
getIdentifier
public long getIdentifier() -
setIdentifier
public void setIdentifier(long id) -
addDragEndEventListener
public Registration addDragEndEventListener(ComponentEventListener<GoogleMapMarker.DragEndEvent> listener) Adds a DragEndEvent listener. The listener is called when a marker' drag ends.- Parameters:
listener-- Returns:
- a handle that can be used for removing the listener
-
addClickListener
public Registration addClickListener(ComponentEventListener<GoogleMapMarker.GoogleMapMarkerClickEvent> listener) Adds a click event listener to a marker.- Parameters:
listener-- Returns:
- a handle that can be used for removing the listener
-
addRightClickListener
public Registration addRightClickListener(ComponentEventListener<GoogleMapMarker.GoogleMapMarkerRightClickEvent> listener) Adds a right click event listener to a marker.- Parameters:
listener- a right click event listener- Returns:
- a handle for the listener
-