Package ro.sync.exml.view.graphics
Class AttributedString
- java.lang.Object
-
- ro.sync.exml.view.graphics.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 toAttributedString
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AttributedString.AttributedInterval
A text interval from the string, with a specific attribute.
-
Constructor Summary
Constructors Constructor Description AttributedString(java.lang.String string)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(TextAttribute textAttribute, java.lang.Object value)
Adds an attribute on the entire string.void
addAttribute(TextAttribute attribute, java.lang.Object value, int beginIndex, int endIndex)
Adds an attribute to a subrange of the string.void
addAttributedInterval(AttributedString.AttributedInterval interval)
Adds an attribute to a subrange of the string.boolean
equals(java.lang.Object obj)
java.util.List<AttributedString.AttributedInterval>
getIntervals()
java.lang.String
getString()
int
hashCode()
boolean
isDisableDrawSpacesAndTabs()
int
length()
void
removeAllAttributes(TextAttribute attrribute)
Remove all intervals having a value for the specified attribute key.void
setDisableDrawSpacesAndTabs(boolean disableDrawSpacesAndTabs)
Set disable drawing spaces and tabs.AttributedString[]
toMultiLineAttributeStrings()
Convert this attributed string to an array of attributed strings, one for each line of content.java.lang.String
toString()
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.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 keyvalue
- The value of the attribute. Should not benull
.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.
-
getIntervals
public java.util.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, 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 classjava.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.
-
-