Class AttributedString


  • @API(type=EXTENDABLE,
         src=PRIVATE)
    public class AttributedString
    extends java.lang.Object
    A string annotated with attributes. For instance an interval can have a red foreground, other one a specific font, etc.. Similar to AttributedString.
    • Constructor Detail

      • AttributedString

        public AttributedString​(java.lang.String string)
        Constructor.
        Parameters:
        string - The string
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • addAttribute

        public void addAttribute​(TextAttribute attribute,
                                 java.lang.Object value,
                                 int beginIndex,
                                 int endIndex)
        Adds an attribute to a subrange of the string.
        Parameters:
        attribute - the attribute key
        value - The value of the attribute. Should not be null.
        beginIndex - Index of the first character of the range.
        endIndex - Index of the character following the last character of the range.
      • addAttributedInterval

        public void addAttributedInterval​(AttributedString.AttributedInterval interval)
        Adds an attribute to a subrange of the string.
        Parameters:
        interval - the attributed interval.
      • getString

        public java.lang.String getString()
        Returns:
        Returns the string.
      • length

        public int length()
        Returns:
        The length of the inner string.
      • addAttribute

        public void addAttribute​(TextAttribute textAttribute,
                                 java.lang.Object value)
        Adds an attribute on the entire string.
        Parameters:
        textAttribute - The text attribute.
        value - The value of the attribute.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • removeAllAttributes

        public void removeAllAttributes​(TextAttribute attrribute)
        Remove all intervals having a value for the specified attribute key.
        Parameters:
        attrribute - The attribute key.
      • toMultiLineAttributeStrings

        public AttributedString[] toMultiLineAttributeStrings()
        Convert this attributed string to an array of attributed strings, one for each line of content.
        Returns:
        an array of attributed strings, one for each line of content.
      • isDisableDrawSpacesAndTabs

        public boolean isDisableDrawSpacesAndTabs()
        Returns:
        true if drawing spaces and tabs is disabled.
      • setDisableDrawSpacesAndTabs

        public void setDisableDrawSpacesAndTabs​(boolean disableDrawSpacesAndTabs)
        Set disable drawing spaces and tabs.
        Parameters:
        disableDrawSpacesAndTabs - true if drawing spaces and tabs is disabled.