Class Popup

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

@NullMarked public class Popup extends Option<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 String content)
      Create a popup rule.
      Parameters:
      content - popup content
  • Method Details

    • getContent

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

      If null, the popup rule is effectively disabled.

      Returns:
      popup content
    • setContent

      public Popup setContent(@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

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

      Defaults to 'popupPane' if null.

      Returns:
      map pane
    • setPane

      public Popup setPane(@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

      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

      public Popup setOffset(@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

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

      Defaults to '300' if null.

      Returns:
      max width
    • setMaxWidth

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

      Defaults to '300' if null.

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

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

      Defaults to '50' if null.

      Returns:
      min width
    • setMinWidth

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

      Defaults to '50' if null.

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

      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

      public Popup setMaxHeight(@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

      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

      public Popup setShouldAutoPan(@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

      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

      public Popup setAutoPanPaddingTopLeft(@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

      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

      public Popup setAutoPanPaddingBottomRight(@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

      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

      public Popup setAutoPanPadding(@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

      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

      public Popup setShouldKeepInView(@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

      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

      public Popup setCloseButton(@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

      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

      public Popup setShouldAutoClose(@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

      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

      public Popup setShouldCloseOnEscapeKey(@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

      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

      public Popup setShouldCloseOnClick(@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<Popup>
      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 Popup 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