Class Options.Builder

java.lang.Object
net.pl3x.map.core.markers.option.Options.Builder
Enclosing class:
Options

public static class Options.Builder extends Object
Builder for Options.
  • Constructor Details

    • Builder

      public Builder()
      Create a new builder for Options.
  • Method Details

    • stroke

      @NotNull public @NotNull Options.Builder stroke(@Nullable @Nullable Stroke stroke)
      Set the stroke properties.
      Parameters:
      stroke - stroke properties
      Returns:
      this options builder
    • stroke

      @NotNull public @NotNull Options.Builder stroke(@Nullable @Nullable Boolean enabled)
      Set whether to draw stroke along the path.

      Setting to false will disable borders on polygons or circles.

      Defaults to 'true' if null.

      Parameters:
      enabled - whether stroke is enabled
      Returns:
      this options builder
    • strokeWeight

      @NotNull public @NotNull Options.Builder strokeWeight(@Nullable @Nullable Integer weight)
      Set the weight for this stroke rule.

      Defaults to '3' if null.

      Parameters:
      weight - new stroke weight
      Returns:
      this options builder
    • strokeColor

      @NotNull public @NotNull Options.Builder strokeColor(@Nullable @Nullable Integer color)
      Set the color of this stroke rule.

      Defaults to '#FF3388FF' if null.

      Parameters:
      color - argb color
      Returns:
      this options builder
    • strokeLineCapShape

      @NotNull public @NotNull Options.Builder strokeLineCapShape(@Nullable Stroke.LineCapShape lineCapShape)
      Set the shape to be used at the end of the stroke.

      Defaults to 'Stroke.LineCapShape.ROUND' if null.

      Parameters:
      lineCapShape - line cap shape
      Returns:
      this options builder
      See Also:
    • strokeLineJoinShape

      @NotNull public @NotNull Options.Builder strokeLineJoinShape(@Nullable Stroke.LineJoinShape lineJoinShape)
      Set the shape to be used at the corners of the stroke.

      Defaults to 'Stroke.LineJoinShape.ROUND' if null.

      Parameters:
      lineJoinShape - line join shape
      Returns:
      this options builder
      See Also:
    • strokeDashPattern

      @NotNull public @NotNull Options.Builder strokeDashPattern(@Nullable @Nullable String dashPattern)
      Set the stroke dash pattern.

      Note: Doesn't work in some old browsers.

      Parameters:
      dashPattern - dash pattern
      Returns:
      this options builder
      See Also:
    • strokeDashOffset

      @NotNull public @NotNull Options.Builder strokeDashOffset(@Nullable @Nullable String dashOffset)
      Set the distance into the dash pattern to start the dash.

      Note: Doesn't work in some old browsers.

      Parameters:
      dashOffset - dash offset
      Returns:
      this options builder
      See Also:
    • fill

      @NotNull public @NotNull Options.Builder fill(@Nullable @Nullable Fill fill)
      Set fill properties.
      Parameters:
      fill - fill properties
      Returns:
      this options builder
    • fill

      @NotNull public @NotNull Options.Builder fill(@Nullable @Nullable Boolean enabled)
      Set whether to fill the path with color.

      Setting to false will disable filling on polygons or circles.

      Defaults to 'true' if null.

      Parameters:
      enabled - whether fill is enabled
      Returns:
      this options builder
    • fillType

      @NotNull public @NotNull Options.Builder fillType(@Nullable Fill.Type type)
      Set a new fill type for this fill rule.

      Defaults to 'Fill.Type.EVENODD' if null.

      Parameters:
      type - new fill type
      Returns:
      this options builder
      See Also:
    • fillColor

      @NotNull public @NotNull Options.Builder fillColor(@Nullable @Nullable Integer color)
      Set a new color for this fill rule.

      Defaults to 'Stroke.getColor()' if null.

      Parameters:
      color - new argb color
      Returns:
      this options builder
    • tooltip

      @NotNull public @NotNull Options.Builder tooltip(@Nullable @Nullable Tooltip tooltip)
      Set tooltip properties.
      Parameters:
      tooltip - tooltip properties
      Returns:
      this options builder
    • tooltipContent

      @NotNull public @NotNull Options.Builder tooltipContent(@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 options builder
    • tooltipPane

      @NotNull public @NotNull Options.Builder tooltipPane(@Nullable @Nullable String pane)
      Set the map pane where the tooltip will be added.

      Defaults to 'tooltipPane' if null.

      Parameters:
      pane - map pane
      Returns:
      this options builder
    • tooltipOffset

      @NotNull public @NotNull Options.Builder tooltipOffset(@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 options builder
    • tooltipDirection

      @NotNull public @NotNull Options.Builder tooltipDirection(@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 options builder
    • tooltipPermanent

      @NotNull public @NotNull Options.Builder tooltipPermanent(@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 options builder
    • tooltipSticky

      @NotNull public @NotNull Options.Builder tooltipSticky(@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 options builder
    • tooltipOpacity

      @NotNull public @NotNull Options.Builder tooltipOpacity(@Nullable @Nullable Double opacity)
      Set the tooltip opacity percent.

      Defaults to '0.9D' if null.

      Parameters:
      opacity - tooltip opacity
      Returns:
      this options builder
    • popup

      @NotNull public @NotNull Options.Builder popup(@Nullable @Nullable Popup popup)
      Set popup properties.
      Parameters:
      popup - popup properties
      Returns:
      this options builder
    • popupContent

      @NotNull public @NotNull Options.Builder popupContent(@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 options builder
    • popupPane

      @NotNull public @NotNull Options.Builder popupPane(@Nullable @Nullable String pane)
      Set the map pane where the popup will be added.

      Defaults to 'popupPane' if null.

      Parameters:
      pane - map pane
      Returns:
      this options builder
    • popupOffset

      @NotNull public @NotNull Options.Builder popupOffset(@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 options builder
    • popupMaxWidth

      @NotNull public @NotNull Options.Builder popupMaxWidth(@Nullable @Nullable Integer maxWidth)
      Set the max width of the popup.

      Defaults to '300' if null.

      Parameters:
      maxWidth - max width
      Returns:
      this options builder
    • popupMinWidth

      @NotNull public @NotNull Options.Builder popupMinWidth(@Nullable @Nullable Integer minWidth)
      Set the min width of the popup.

      Defaults to '50' if null.

      Parameters:
      minWidth - min width
      Returns:
      this options builder
    • popupMaxHeight

      @NotNull public @NotNull Options.Builder popupMaxHeight(@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 options builder
    • popupShouldAutoPan

      @NotNull public @NotNull Options.Builder popupShouldAutoPan(@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 options builder
    • popupAutoPanPaddingTopLeft

      @NotNull public @NotNull Options.Builder popupAutoPanPaddingTopLeft(@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 Popup.getAutoPanPadding().

      Parameters:
      autoPanPaddingTopLeft - top left corner padding margins
      Returns:
      this options builder
    • popupAutoPanPaddingBottomRight

      @NotNull public @NotNull Options.Builder popupAutoPanPaddingBottomRight(@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 Popup.getAutoPanPadding().

      Parameters:
      autoPanPaddingBottomRight - bottom right corner padding margins
      Returns:
      this options builder
    • popupAutoPanPadding

      @NotNull public @NotNull Options.Builder popupAutoPanPadding(@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 Popup.getAutoPanPaddingTopLeft() and Popup.getAutoPanPaddingBottomRight()

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

      Parameters:
      autoPanPadding - padding margins
      Returns:
      this options builder
    • popupShouldKeepInView

      @NotNull public @NotNull Options.Builder popupShouldKeepInView(@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 options builder
    • popupCloseButton

      @NotNull public @NotNull Options.Builder popupCloseButton(@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 options builder
    • popupShouldAutoClose

      @NotNull public @NotNull Options.Builder popupShouldAutoClose(@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 options builder
    • popupShouldCloseOnEscapeKey

      @NotNull public @NotNull Options.Builder popupShouldCloseOnEscapeKey(@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 options builder
    • popupShouldCloseOnClick

      @NotNull public @NotNull Options.Builder popupShouldCloseOnClick(@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 options builder
    • build

      @NotNull public @NotNull Options build()
      Create a new Options instance from the current state of this Options.Builder.
      Returns:
      new options