public class RMXString extends java.lang.Object implements java.lang.Cloneable, java.lang.CharSequence, RMTypes
RMXString xstring = new RMXString("Hello World", RMColor.red); xstring.addAttribute(RMFont.getFont("Arial Bold", 12), 0, 5); xstring.addAttribute(RMFont.getFont("Arial BoldItalic", 12), 6, xstring.length());
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
Constructor and Description |
---|
RMXString()
Creates an empty RMXString.
|
RMXString(java.lang.CharSequence theChars,
java.lang.Object... theAttrs)
Creates an RMXString initialized with the given String with all characters set to the given attributes.
|
RMXString(RichText aRT)
Creates an empty RMXString.
|
Modifier and Type | Method and Description |
---|---|
void |
addChars(java.lang.CharSequence theChars)
Appends the given String to the end of this XString.
|
void |
addChars(java.lang.CharSequence theChars,
int anIndex)
Adds chars at index.
|
void |
addChars(java.lang.CharSequence theChars,
java.util.Map theAttrs)
Appends the given string to the end of this XString, with the given attributes.
|
void |
addChars(java.lang.CharSequence theChars,
java.lang.Object... theAttrs)
Appends the given chars with the given attribute(s).
|
void |
addChars(java.lang.CharSequence theChars,
TextStyle aStyle,
int anIndex)
Appends the given string to this XString, with the given attributes, at the given index.
|
void |
addString(RMXString xStr,
int anIndex)
Adds an XString to this string at given index.
|
char |
charAt(int anIndex)
Returns the char at given index.
|
RMXString |
clone()
Returns a clone of this RMXString.
|
void |
coalesceNewlines()
Replaces any occurrence of consecutive newlines with a single newline.
|
boolean |
equals(java.lang.Object anObj)
Standard Object equals implementation.
|
RMXString |
fromXML(XMLArchiver anArch,
XMLElement anElmt)
XML unarchival.
|
RMTypes.AlignX |
getAlignX()
Returns the horizontal alignment of the first paragraph of the xstring.
|
RMFont |
getFontAt(int anIndex)
Returns the current font at the given character index.
|
RMParagraph |
getParagraphAt(int anIndex)
Returns the current paragraph at the given character index.
|
RichText |
getRichText()
Returns the RichText.
|
RMXStringRun |
getRun()
Returns the XString head run.
|
RMXStringRun |
getRun(int anIndex)
Returns the specific Run at the given index in this XString.
|
RMXStringRun |
getRunAt(int anIndex)
Returns the XString run that contains or ends at given index.
|
int |
getRunCount()
Returns the number of runs in this XString.
|
RMXStringRun |
getRunLast()
Returns the last run in this XString (convenience).
|
RMTextStyle |
getStyleAt(int anIndex)
Returns the text style for the run at the given character index.
|
java.lang.String |
getText()
Returns the simple String represented by this RMXString.
|
int |
indexOf(java.lang.String aString)
Returns the index within this string of the first occurrence of the given substring.
|
int |
indexOf(java.lang.String aString,
int aStart)
Returns the index within this string of first occurrence of given substring, starting at given index.
|
int |
length()
The length.
|
void |
removeChars(int aStart,
int anEnd)
Removes characters in given range.
|
void |
replaceChars(java.lang.CharSequence theChars,
int aStart,
int anEnd)
Replaces chars in given range, with given String.
|
void |
replaceChars(java.lang.CharSequence theChars,
RMTextStyle aStyle,
int aStart,
int anEnd)
Replaces chars in given range, with given String, using the given attributes.
|
void |
replaceString(RMXString xStr,
int aStart,
int aEnd)
Replaces the chars in given range, with given XString.
|
RMXString |
rpgClone(ReportOwner anRptOwner,
java.lang.Object userInfo,
RMShape aShape,
boolean doCopy)
Performs @key@ substitution on an xstring.
|
void |
setAlignX(RMTypes.AlignX anAlignX)
Sets the horizontal alignment of the xstring.
|
void |
setAttribute(java.lang.Object anAttr)
Applies the given attribute to whole xstring, assuming it's a basic attr types (font, color, etc.).
|
void |
setAttribute(java.lang.Object anAttr,
int aStart,
int anEnd)
Applies the given attribute to the given character range, assuming it's a basic attr type (font, color, etc.).
|
void |
setAttribute(java.lang.String aKey,
java.lang.Object anAttr)
Adds a given attribute of given type to the whole string.
|
void |
setAttribute(java.lang.String aKey,
java.lang.Object aVal,
int aStart,
int aEnd)
Sets a given attribute to a given value for a given range.
|
void |
setParagraph(RMParagraph aPG,
int aStart,
int anEnd)
Sets the paragraph for the given character index range.
|
void |
setStyle(RMTextStyle aStyle,
int aStart,
int anEnd)
Sets the text style for given range.
|
void |
setText(java.lang.String aString)
Sets the simple String represented by this RMXString.
|
void |
setUnderlined(boolean aFlag)
Sets the xstring to be underlined.
|
java.lang.CharSequence |
subSequence(int aStart,
int anEnd)
Returns a subsequence.
|
RMXString |
substring(int aStart,
int aEnd)
Returns an XString for given char range.
|
java.lang.String |
toString()
Standard toString implementation.
|
XMLElement |
toXML(XMLArchiver anArchiver)
XML archival.
|
public RMXString()
public RMXString(RichText aRT)
public RMXString(java.lang.CharSequence theChars, java.lang.Object... theAttrs)
public RichText getRichText()
public java.lang.String getText()
public int length()
length
in interface java.lang.CharSequence
public char charAt(int anIndex)
charAt
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int aStart, int anEnd)
subSequence
in interface java.lang.CharSequence
public void setText(java.lang.String aString)
public int indexOf(java.lang.String aString)
public int indexOf(java.lang.String aString, int aStart)
public void addChars(java.lang.CharSequence theChars)
public void addChars(java.lang.CharSequence theChars, int anIndex)
public void addChars(java.lang.CharSequence theChars, TextStyle aStyle, int anIndex)
public void addChars(java.lang.CharSequence theChars, java.lang.Object... theAttrs)
public void addChars(java.lang.CharSequence theChars, java.util.Map theAttrs)
public void removeChars(int aStart, int anEnd)
public void replaceChars(java.lang.CharSequence theChars, int aStart, int anEnd)
public void replaceChars(java.lang.CharSequence theChars, RMTextStyle aStyle, int aStart, int anEnd)
public void addString(RMXString xStr, int anIndex)
public void replaceString(RMXString xStr, int aStart, int aEnd)
public RMXStringRun getRun()
public int getRunCount()
public RMXStringRun getRun(int anIndex)
public RMXStringRun getRunLast()
public RMXStringRun getRunAt(int anIndex)
public RMTextStyle getStyleAt(int anIndex)
public void setStyle(RMTextStyle aStyle, int aStart, int anEnd)
public void setAttribute(java.lang.Object anAttr)
public void setAttribute(java.lang.Object anAttr, int aStart, int anEnd)
public void setAttribute(java.lang.String aKey, java.lang.Object anAttr)
public void setAttribute(java.lang.String aKey, java.lang.Object aVal, int aStart, int aEnd)
public RMFont getFontAt(int anIndex)
public RMParagraph getParagraphAt(int anIndex)
public void setParagraph(RMParagraph aPG, int aStart, int anEnd)
public void setUnderlined(boolean aFlag)
public RMTypes.AlignX getAlignX()
public void setAlignX(RMTypes.AlignX anAlignX)
public RMXString substring(int aStart, int aEnd)
public void coalesceNewlines()
public XMLElement toXML(XMLArchiver anArchiver)
public RMXString fromXML(XMLArchiver anArch, XMLElement anElmt)
public boolean equals(java.lang.Object anObj)
equals
in class java.lang.Object
public RMXString clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
public RMXString rpgClone(ReportOwner anRptOwner, java.lang.Object userInfo, RMShape aShape, boolean doCopy)