Class 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 Detail

      • 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 Detail

      • 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
        If this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.
        Specified by:
        getUnknownJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON
      • getUnsupportedJson

        public Map<String,​Object> getUnsupportedJson()
        Description copied from interface: JsonSerializable
        If this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webmaps and known to the version of the webmap specification the API supports (see system requirements), but are not explicitly exposed through the Runtime API.
        Specified by:
        getUnsupportedJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON