Class Popup

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

public class Popup extends Option<@NotNull Popup>
Popup properties of a marker.
  • Field Details

    • DEFAULT_OFFSET

      public static final Point DEFAULT_OFFSET
    • DEFAULT_AUTO_PAN_PADDING

      public static final Point DEFAULT_AUTO_PAN_PADDING
  • Constructor Details

    • Popup

      public Popup()
      Create a popup rule with default options.
    • Popup

      public Popup(@Nullable @Nullable String content)
      Create a popup rule.
      Parameters:
      content - popup content
  • Method Details

    • getContent

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

      If null, the popup rule is effectively disabled.

      Returns:
      popup content
    • setContent

      @NotNull public @NotNull Popup setContent(@Nullable @Nullable String content)
      Set the content for this popup rule.

      HTML is valid here.

      If null, the popup rule is effectively disabled.

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

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

      Defaults to 'popupPane' if null.

      Returns:
      map pane
    • setPane

      @NotNull public @NotNull Popup setPane(@Nullable @Nullable String pane)
      Set the map pane where the popup will be added.

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

      Defaults to 'popupPane' if null.

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

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

      Defaults to 'new Point(0, 7)' if null.

      Returns:
      popup offset from marker point
    • setOffset

      @NotNull public @NotNull Popup setOffset(@Nullable @Nullable Point offset)
      Set offset of this popup rule from marker point

      Defaults to 'new Point(0, 7)' if null.

      Parameters:
      offset - popup offset
      Returns:
      this popup rule
    • getMaxWidth

      @Nullable public @Nullable Integer getMaxWidth()
      Get the max width of the popup.

      Defaults to '300' if null.

      Returns:
      max width
    • setMaxWidth

      @NotNull public @NotNull Popup setMaxWidth(@Nullable @Nullable Integer maxWidth)
      Set the max width of the popup.

      Defaults to '300' if null.

      Parameters:
      maxWidth - max width
      Returns:
      this popup rule
    • getMinWidth

      @Nullable public @Nullable Integer getMinWidth()
      Get the min width of the popup.

      Defaults to '50' if null.

      Returns:
      min width
    • setMinWidth

      @NotNull public @NotNull Popup setMinWidth(@Nullable @Nullable Integer minWidth)
      Set the min width of the popup.

      Defaults to '50' if null.

      Parameters:
      minWidth - min width
      Returns:
      this popup rule
    • getMaxHeight

      @Nullable public @Nullable Integer getMaxHeight()
      Get the max height of the popup.

      If set, creates a scrollable container of the given height inside a popup if its content exceeds it.

      Returns:
      max height
    • setMaxHeight

      @NotNull public @NotNull Popup setMaxHeight(@Nullable @Nullable Integer maxHeight)
      Set the max height of the popup.

      If set, creates a scrollable container of the given height inside a popup if its content exceeds it.

      Parameters:
      maxHeight - max height
      Returns:
      this popup rule
    • shouldAutoPan

      @Nullable public @Nullable Boolean shouldAutoPan()
      Get whether the map should automatically pan to fit the opened popup.

      Defaults to 'true' if null.

      Returns:
      true to auto pan
    • setShouldAutoPan

      @NotNull public @NotNull Popup setShouldAutoPan(@Nullable @Nullable Boolean autoPan)
      Set whether the map should automatically pan to fit the opened popup.

      Defaults to 'true' if null.

      Parameters:
      autoPan - true to auto pan
      Returns:
      this popup rule
    • getAutoPanPaddingTopLeft

      @Nullable public @Nullable Point getAutoPanPaddingTopLeft()
      Get the margin between the popup and the top left corner of the map view after auto panning was performed.

      If set, overrides the top left values of getAutoPanPadding().

      Returns:
      top left corner padding margins
    • setAutoPanPaddingTopLeft

      @NotNull public @NotNull Popup setAutoPanPaddingTopLeft(@Nullable @Nullable Point autoPanPaddingTopLeft)
      Set the margin between the popup and the top left corner of the map view after auto panning was performed.

      If set, overrides the top left values of getAutoPanPadding().

      Parameters:
      autoPanPaddingTopLeft - top left corner padding margins
      Returns:
      this popup rule
    • getAutoPanPaddingBottomRight

      @Nullable public @Nullable Point getAutoPanPaddingBottomRight()
      Get the margin between the popup and the bottom right corner of the map view after auto panning was performed.

      If set, overrides the bottom right values of getAutoPanPadding().

      Returns:
      bottom right corner padding margins
    • setAutoPanPaddingBottomRight

      @NotNull public @NotNull Popup setAutoPanPaddingBottomRight(@Nullable @Nullable Point autoPanPaddingBottomRight)
      Set the margin between the popup and the bottom right corner of the map view after auto panning was performed.

      If set, overrides the bottom right values of getAutoPanPadding().

      Parameters:
      autoPanPaddingBottomRight - bottom right corner padding margins
      Returns:
      this popup rule
    • getAutoPanPadding

      @Nullable public @Nullable Point getAutoPanPadding()
      Get the margin between the popup and the map view after auto panning was performed.

      This is the equivalent of the same values in both getAutoPanPaddingTopLeft() and getAutoPanPaddingBottomRight()

      Defaults to 'new Point(5, 5)' if null.

      Returns:
      padding margins
    • setAutoPanPadding

      @NotNull public @NotNull Popup setAutoPanPadding(@Nullable @Nullable Point autoPanPadding)
      Set the margin between the popup and the map view after auto panning was performed.

      This is the equivalent of the same values in both getAutoPanPaddingTopLeft() and getAutoPanPaddingBottomRight()

      Defaults to 'new Point(5, 5)' if null.

      Parameters:
      autoPanPadding - padding margins
      Returns:
      this popup rule
    • shouldKeepInView

      @Nullable public @Nullable Boolean shouldKeepInView()
      Get whether the popup should stay in view.

      If set to true it will prevent users from panning the popup off of the screen while it is open.

      Defaults to 'false' if null.

      Returns:
      true to keep popup in view
    • setShouldKeepInView

      @NotNull public @NotNull Popup setShouldKeepInView(@Nullable @Nullable Boolean keepInView)
      Set whether the popup should stay in view.

      If set to true it will prevent users from panning the popup off of the screen while it is open.

      Defaults to 'false' if null.

      Parameters:
      keepInView - true to keep popup in view
      Returns:
      this popup rule
    • hasCloseButton

      @Nullable public @Nullable Boolean hasCloseButton()
      Get whether the popup has a close button.

      Defaults to 'true' if null.

      Returns:
      true if popup has close button
    • setCloseButton

      @NotNull public @NotNull Popup setCloseButton(@Nullable @Nullable Boolean closeButton)
      Set whether the popup has a close button.

      Defaults to 'true' if null.

      Parameters:
      closeButton - true if popup has close button
      Returns:
      this popup rule
    • shouldAutoClose

      @Nullable public @Nullable Boolean shouldAutoClose()
      Get whether the popup automatically closes when another popup is opened.

      Defaults to 'true' if null.

      Returns:
      true if popup auto closes
    • setShouldAutoClose

      @NotNull public @NotNull Popup setShouldAutoClose(@Nullable @Nullable Boolean autoClose)
      Set whether the popup automatically closes when another popup is opened.

      Defaults to 'true' if null.

      Parameters:
      autoClose - true if popup auto closes
      Returns:
      this popup rule
    • shouldCloseOnEscapeKey

      @Nullable public @Nullable Boolean shouldCloseOnEscapeKey()
      Get whether the popup closes with the escape key.

      Defaults to 'true' if null.

      Returns:
      true to close with escape
    • setShouldCloseOnEscapeKey

      @NotNull public @NotNull Popup setShouldCloseOnEscapeKey(@Nullable @Nullable Boolean closeOnEscapeKey)
      Set whether the popup closes with the escape key.

      Defaults to 'true' if null.

      Parameters:
      closeOnEscapeKey - true to close with escape
      Returns:
      this popup rule
    • shouldCloseOnClick

      @Nullable public @Nullable Boolean shouldCloseOnClick()
      Get whether the popup closes when the map is clicked.

      Defaults to 'true' if null.

      Returns:
      true to close on map click
    • setShouldCloseOnClick

      @NotNull public @NotNull Popup setShouldCloseOnClick(@Nullable @Nullable Boolean closeOnClick)
      Set whether the popup closes when the map is clicked.

      Defaults to 'true' if null.

      Parameters:
      closeOnClick - true to close on map click
      Returns:
      this popup 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 Popup>
      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 Popup 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