Class LabelStackSeparator

java.lang.Object
com.esri.arcgisruntime.mapping.labeling.LabelStackSeparator
All Implemented Interfaces:
JsonSerializable

public final class LabelStackSeparator extends Object implements JsonSerializable
A separator character in a label, where a line break may be inserted in long text.

A single separator consists of:

  • the separator character that should potentially be replaced by a line break
  • if the separator should always be used for line break
  • if the separator should remain visible
  • if the separator should appear at the end of one row, or the beginning of the next.
Since:
100.11.0
  • Constructor Details

    • LabelStackSeparator

      public LabelStackSeparator()
      Creates a label stack separator with default values.

      The default separator has an empty getSeparator() and will be ignored.

      Since:
      100.11.0
  • Method Details

    • getBreakPosition

      public LabelStackSeparatorBreakPosition getBreakPosition()
      Gets the position where the separator will be written, if used and remaining visible.

      Whether the separator code point should appear at the end of one row, or the beginning of the next, if chosen as a line break position. This does not matter if the separator is not to be visible when used.

      The default value is LabelStackSeparatorBreakPosition.AUTOMATIC which will give the same behavior as LabelStackSeparatorBreakPosition.AFTER.

      Returns:
      the position where the separator will be written, if used and remaining visible
      Since:
      100.11.0
    • setBreakPosition

      public void setBreakPosition(LabelStackSeparatorBreakPosition breakPosition)
      Sets the position where the separator will be written, if used and remaining visible.

      Whether the separator code point should appear at the end of one row, or the beginning of the next, if chosen as a line break position. This does not matter if the separator is not to be visible when used.

      Parameters:
      breakPosition - the position where the separator will be written, if used and remaining visible
      Throws:
      IllegalArgumentException - if breakPosition is null
      Since:
      100.11.0
    • isForced

      public boolean isForced()
      Indicates whether a line break must be inserted when the getSeparator() is encountered.

      The default value is false.

      Returns:
      true if a line break must be inserted, false if not
      Since:
      100.11.0
    • setForced

      public void setForced(boolean forced)
      Sets whether a line break must be inserted when the getSeparator() is encountered.
      Parameters:
      forced - true if a line break must be inserted, false if not
      Since:
      100.11.0
    • getSeparator

      public String getSeparator()
      Gets a String intended to describe one code point.

      Each LabelStackSeparator specifies a code point to be looked for in the text. A code point is often thought of as a single character in the text, but may need several chars in a String to describe it. For example:

      • to use a comma as a separator, the String would be just ","
      • to use a Hebrew punctuation Paseq as a separator, the String would need to encode the code point with the UTF16 value "\u05c0".

      The default value is an empty string, meaning that the LabelStackSeparator will be ignored.

      Returns:
      a String intended to describe one code point
      Since:
      100.11.0
    • setSeparator

      public void setSeparator(String separator)
      Sets a String intended to describe one code point.

      Each LabelStackSeparator specifies a code point to be looked for in the text. A code point is often thought of as a single character in the text, but may need several chars in a String to describe it. For example:

      • to use a comma as a separator, the String would be just ","
      • to use a Hebrew punctuation Paseq as a separator, the String would need to encode the code point with the UTF16 value "\u05c0".
      Parameters:
      separator - a String intended to describe one code point
      Throws:
      IllegalArgumentException - if separator is null
      Since:
      100.11.0
    • isVisible

      public boolean isVisible()
      Indicates whether the separator should still be visible, if chosen as a line break position.

      For example, a user may wish to keep a hyphenation mark at the end of a row of text, but hide a comma. The default value is false.

      Returns:
      true if the separator should still be visible, false if not
      Since:
      100.11.0
    • setVisible

      public void setVisible(boolean visible)
      Gets whether the separator should still be visible, if chosen as a line break position.

      For example, a user may wish to keep a hyphenation mark at the end of a row of text, but hide a comma.

      Parameters:
      visible - true if the separator should still be visible, false if not
      Since:
      100.11.0
    • fromJson

      public static LabelStackSeparator fromJson(String json)
      Creates a LabelStackSeparator instance from a JSON string.
      Parameters:
      json - a JSON string that represents a LabelStackSeparator
      Returns:
      a LabelStackSeparator instance
      Throws:
      IllegalArgumentException - if json is null or empty
      Since:
      100.11.0
    • toJson

      public String toJson()
      Description copied from interface: JsonSerializable
      Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.
      Specified by:
      toJson in interface JsonSerializable
      Returns:
      a JSON string
    • getUnknownJson

      public Map<String,Object> getUnknownJson()
      Description copied from interface: JsonSerializable
      Gets unknown data from the source JSON.

      Unknown JSON is a Map of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.

      Specified by:
      getUnknownJson in interface JsonSerializable
      Returns:
      an unmodifiable Map containing unknown data from the source JSON
    • getUnsupportedJson

      public Map<String,Object> getUnsupportedJson()
      Description copied from interface: JsonSerializable
      Gets unsupported data from the source JSON.

      Unsupported JSON is a Map of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.

      Specified by:
      getUnsupportedJson in interface JsonSerializable
      Returns:
      an unmodifiable Map containing unsupported data from the source JSON