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.9.0") @NpmPackage(value="@googlemaps/markerclusterer",version="2.0.8") public class GoogleMapMarker extends Component
The class representing a marker of the Google Map.
See Also:
  • Constructor Details

    • GoogleMapMarker

      public GoogleMapMarker()
      Instantiates a new GoogleMapMarker.
    • GoogleMapMarker

      public GoogleMapMarker(String caption, LatLon position, boolean draggable)
      Instantiates a new GoogleMapMarker
      Parameters:
      caption - The caption to use.
      position - The position of the marker
      draggable - Can marker be dragged?
    • GoogleMapMarker

      public GoogleMapMarker(String caption, LatLon position, boolean draggable, String iconUrl)
      Instantiates a new GoogleMapMarker
      Parameters:
      caption - The caption to use.
      position - The position of the marker
      draggable - Can marker be dragged?
      iconUrl - the icon url as a string
    • GoogleMapMarker

      public GoogleMapMarker(String caption, LatLon position, boolean draggable, GoogleMapIcon icon)
      Instantiates a new GoogleMapMarker
      Parameters:
      caption - The caption to use.
      position - The position of the marker
      draggable - Can marker be dragged?
      icon - the icon image for the marker
  • Method Details

    • addInfoWindow

      public void addInfoWindow(String htmlContent)
    • isInfoWindowVisible

      @Synchronize(value={"google-map-marker-open","google-map-marker-close"}, property="open") public boolean isInfoWindowVisible()
    • setInfoWindowVisible

      public void setInfoWindowVisible(boolean visible)
    • getPosition

      public LatLon getPosition()
      Returns the position of the marker.
      Returns:
      The position of the marker.
    • setPosition

      public void setPosition(LatLon position)
      Sets the position of the marker.
      Parameters:
      position - The new position of the marker.
    • getCaption

      public String getCaption()
      Gets the caption of the marker.
      Returns:
      The caption of the marker.
    • setCaption

      public void setCaption(String caption)
      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

      public String getIconUrl()
      Returns the url of the icon of the marker.
      Returns:
      the url of the icon, default null.
    • setIconUrl

      public void setIconUrl(String iconUrl)
      Sets the url of the icon of the marker.
      Parameters:
      iconUrl - The new url of the icon.
    • setIcon

      public void setIcon(GoogleMapIcon icon)
      Sets the icon image of the marker
      Parameters:
      icon - the icon image of the marker
    • setLabel

      public void setLabel(MarkerLabel label)
      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

      Adds a click event listener to a marker.
      Parameters:
      listener -
      Returns:
      a handle that can be used for removing the listener
    • addRightClickListener

      Adds a right click event listener to a marker.
      Parameters:
      listener - a right click event listener
      Returns:
      a handle for the listener