Class AttributedString

java.lang.Object
ro.sync.exml.view.graphics.AttributedString

@API(type=EXTENDABLE, src=PRIVATE) public class AttributedString extends 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 Details

    • AttributedString

      public AttributedString(String string)
      Constructor.
      Parameters:
      string - The string
  • Method Details

    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • addAttribute

      public void addAttribute(TextAttribute attribute, 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 String getString()
      Returns:
      Returns the string.
    • getIntervals

      public List<AttributedString.AttributedInterval> getIntervals()
      Returns:
      Returns the intervals.
    • length

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

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

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • 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.