Package ro.sync.exml.view.graphics
Class AttributedString
java.lang.Object
ro.sync.exml.view.graphics.AttributedString
A string annotated with attributes. For instance an interval can
have a red foreground, other one a specific font, etc..
Similar to
AttributedString
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A text interval from the string, with a specific attribute. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(TextAttribute textAttribute, Object value) Adds an attribute on the entire string.void
addAttribute
(TextAttribute attribute, Object value, int beginIndex, int endIndex) Adds an attribute to a subrange of the string.void
Adds an attribute to a subrange of the string.boolean
int
hashCode()
boolean
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.Convert this attributed string to an array of attributed strings, one for each line of content.toString()
-
Constructor Details
-
AttributedString
Constructor.- Parameters:
string
- The string
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
addAttribute
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
Adds an attribute to a subrange of the string.- Parameters:
interval
- the attributed interval.
-
getString
- Returns:
- Returns the string.
-
getIntervals
- Returns:
- Returns the intervals.
-
length
public int length()- Returns:
- The length of the inner string.
-
addAttribute
Adds an attribute on the entire string.- Parameters:
textAttribute
- The text attribute.value
- The value of the attribute.
-
toString
-
removeAllAttributes
Remove all intervals having a value for the specified attribute key.- Parameters:
attrribute
- The attribute key.
-
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.
-