Class Tooltip

java.lang.Object
net.pl3x.map.core.markers.option.Option<Tooltip>
net.pl3x.map.core.markers.option.Tooltip
All Implemented Interfaces:
JsonSerializable

@NullMarked public class Tooltip extends Option<Tooltip>
Tooltip properties of a marker.
  • Field Details

    • DEFAULT_OFFSET

      public static final Point DEFAULT_OFFSET
  • Constructor Details

    • Tooltip

      public Tooltip()
      Create a tooltip rule with default options.
    • Tooltip

      public Tooltip(@Nullable String string)
      Create a tooltip rule.
      Parameters:
      string - tooltip content
  • Method Details

    • getContent

      public @Nullable String getContent()
      Get the content of this tooltip rule.

      If null, the tooltip rule is effectively disabled.

      Returns:
      tooltip content
    • setContent

      public Tooltip setContent(@Nullable String content)
      Set the content for this tooltip rule.

      HTML is valid here.

      If null, the tooltip rule is effectively disabled.

      Parameters:
      content - tooltip content
      Returns:
      this tooltip rule
    • getPane

      public @Nullable String getPane()
      Get the map pane where the tooltip will be added.

      Defaults to 'tooltipPane' if null.

      Returns:
      map pane
    • setPane

      public Tooltip setPane(@Nullable String pane)
      Set the map pane where the tooltip will be added.

      If the pane does not exist, it will be created the first time it is used.

      Defaults to 'tooltipPane' if null.

      Parameters:
      pane - map pane
      Returns:
      this tooltip rule
    • getOffset

      public @Nullable Point getOffset()
      Get offset of this tooltip rule.

      Defaults to 'Point.ZERO' if null.

      Returns:
      tooltip offset from marker point
    • setOffset

      public Tooltip setOffset(@Nullable Point offset)
      Set offset of this tooltip rule from marker point.

      Defaults to 'Point.ZERO' if null.

      Parameters:
      offset - tooltip offset
      Returns:
      this tooltip rule
    • getDirection

      public @Nullable Tooltip.Direction getDirection()
      Get the direction where to open the tooltip.

      Defaults to 'Tooltip.Direction.AUTO' if null.

      Returns:
      opening direction
    • setDirection

      public Tooltip setDirection(@Nullable Tooltip.Direction direction)
      Set the direction where to open the tooltip.

      Defaults to 'Tooltip.Direction.AUTO' if null.

      Parameters:
      direction - opening direction
      Returns:
      this tooltip rule
    • isPermanent

      public @Nullable Boolean isPermanent()
      Get whether to open the tooltip permanently or only on mouseover.

      Defaults to 'false' if null.

      Returns:
      true if opened permanently
    • setPermanent

      public Tooltip setPermanent(@Nullable Boolean permanent)
      Set whether to open the tooltip permanently or only on mouseover

      Defaults to 'false' if null.

      Parameters:
      permanent - opened permanently
      Returns:
      this tooltip rule
    • isSticky

      public @Nullable Boolean isSticky()
      Get whether the tooltip is sticky or not.

      A sticky tooltip will stick to and follow the mouse instead of the anchor.

      Defaults to 'false' if null.

      Returns:
      sticky state
    • setSticky

      public Tooltip setSticky(@Nullable Boolean sticky)
      Set whether the tooltip is sticky or not.

      A sticky tooltip will stick to and follow the mouse instead of the anchor.

      Defaults to 'false' if null.

      Parameters:
      sticky - sticky state
      Returns:
      this tooltip rule
    • getOpacity

      public @Nullable Double getOpacity()
      Get the tooltip opacity percent.

      Defaults to '0.9D' if null.

      Returns:
      tooltip opacity
    • setOpacity

      public Tooltip setOpacity(@Nullable Double opacity)
      Set the tooltip opacity percent.

      Defaults to '0.9D' if null.

      Parameters:
      opacity - tooltip opacity
      Returns:
      this tooltip rule
    • isDefault

      public boolean isDefault()
      Description copied from class: Option
      Check whether all options are defaults (all are null)
      Specified by:
      isDefault in class Option<Tooltip>
      Returns:
      true if all options are null
    • toJson

      public com.google.gson.JsonObject toJson()
      Description copied from interface: JsonSerializable
      Jsonify this object.
      Returns:
      object as json element
    • fromJson

      public static Tooltip fromJson(com.google.gson.JsonObject obj)
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object