Class Tooltip

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

public class Tooltip extends Option<@NotNull 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 @Nullable String string)
      Create a tooltip rule.
      Parameters:
      string - tooltip content
  • Method Details

    • getContent

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

      If null, the tooltip rule is effectively disabled.

      Returns:
      tooltip content
    • setContent

      @NotNull public @NotNull Tooltip setContent(@Nullable @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

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

      Defaults to 'tooltipPane' if null.

      Returns:
      map pane
    • setPane

      @NotNull public @NotNull Tooltip setPane(@Nullable @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

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

      Defaults to 'Point.ZERO' if null.

      Returns:
      tooltip offset from marker point
    • setOffset

      @NotNull public @NotNull Tooltip setOffset(@Nullable @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

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

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

      Returns:
      opening direction
    • setDirection

      @NotNull public @NotNull Tooltip setDirection(@Nullable @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

      @Nullable 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

      @NotNull public @NotNull Tooltip setPermanent(@Nullable @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

      @Nullable 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

      @NotNull public @NotNull Tooltip setSticky(@Nullable @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

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

      Defaults to '0.9D' if null.

      Returns:
      tooltip opacity
    • setOpacity

      @NotNull public @NotNull Tooltip setOpacity(@Nullable @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<@NotNull Tooltip>
      Returns:
      true if all options are null
    • toJson

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

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

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

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

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Object