Package com.inductiveautomation.rm.text
Class RMXStringRun
- java.lang.Object
-
- com.inductiveautomation.rm.text.RMXStringRun
-
- All Implemented Interfaces:
RMTypes
,RMTextTypes
,java.lang.CharSequence
,java.lang.Cloneable
public class RMXStringRun extends java.lang.Object implements RMTextTypes, java.lang.Cloneable, java.lang.CharSequence
The Run class represents a range of characters in an xstring that share common attributes.This class makes a point to treat its attributes map as read-only so they can be shared among multiple runs.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.text.RMTextTypes
RMTextTypes.TabType
-
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypes
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
-
-
Field Summary
-
Fields inherited from interface com.inductiveautomation.rm.text.RMTextTypes
TEXT_CHAR_SPACING, TEXT_COLOR, TEXT_EMBEDDED_SHAPE, TEXT_FONT, TEXT_FORMAT, TEXT_OUTLINE, TEXT_PARAGRAPH, TEXT_SCRIPTING, TEXT_UNDERLINE
-
-
Constructor Summary
Constructors Constructor Description RMXStringRun(RMXString anXString)
Creates a new run.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLength(int aLength, int anIndex)
Adds length to run for char index.char
charAt(int anIndex)
CharSequence method returning character at given index.RMXStringRun
clone()
Returns a basic clone of this object.RMXStringRun
cloneDeep(RMXString anXString)
Returns a clone of this run, including a clone of the next run(s) if present.int
end()
Returns the end character index for this run.boolean
equals(java.lang.Object anObj)
Returns whether this run is equal to the given object.java.lang.Object
getAttribute(java.lang.String aKey)
Returns a specific attribute for the given key.float
getCharSpacing()
Returns the char spacing.RMColor
getColor()
Returns the color for this run.RMDateFormat
getDateFormat()
RMFont
getFont()
Returns the font for this run.RMFormat
getFormat()
Returns the format for this run.RMXStringRun
getNext()
Return next run.RMNumberFormat
getNumberFormat()
RMXString.Outline
getOutline()
Returns the outline info for this run (null for none).static RMXString.Outline
getOutline(java.util.Map attrs)
Returns the Outline record for the given attributes map (or null for none).RMParagraph
getParagraph()
Returns the paragraph for this run.RMXStringRun
getRun(int anIndex)
Returns the run at given index.RMXStringRun
getRunAt(int anIndex, boolean isInclusive)
Returns the XString run that contains or ends (if given option is true) at given index.int
getRunCount()
Returns the run count.RMXStringRun
getRunLast()
Returns the last run.int
getScripting()
Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).RMTextStyle
getStyle()
Returns the text style.int
getUnderlineStyle()
Returns the underline style of this run.boolean
isUnderlined()
Returns whether this run is underlined.int
length()
Returns the length in characters for this run.void
removeLength(int aLength, int anIndex)
Removes a length from run(s) for char index.protected void
setStyle(RMTextStyle aStyle)
Sets the text style.void
shift(int anAmount)
Shifts run by given amound.RMXStringRun
split(int anIndex)
Splits the run at the given index and returns a run containing the remaining characters (and identical attributes).int
start()
Returns the start character index for this run.java.lang.CharSequence
subSequence(int aStart, int anEnd)
CharSequence method return character sequence for range.java.lang.String
toString()
Returns a string representation of this run.
-
-
-
Constructor Detail
-
RMXStringRun
public RMXStringRun(RMXString anXString)
Creates a new run.
-
-
Method Detail
-
start
public int start()
Returns the start character index for this run.
-
end
public int end()
Returns the end character index for this run.
-
length
public int length()
Returns the length in characters for this run.- Specified by:
length
in interfacejava.lang.CharSequence
-
charAt
public char charAt(int anIndex)
CharSequence method returning character at given index.- Specified by:
charAt
in interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int aStart, int anEnd)
CharSequence method return character sequence for range.- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
getStyle
public RMTextStyle getStyle()
Returns the text style.
-
setStyle
protected void setStyle(RMTextStyle aStyle)
Sets the text style.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String aKey)
Returns a specific attribute for the given key.
-
getFont
public RMFont getFont()
Returns the font for this run.
-
getColor
public RMColor getColor()
Returns the color for this run.
-
getParagraph
public RMParagraph getParagraph()
Returns the paragraph for this run.
-
isUnderlined
public boolean isUnderlined()
Returns whether this run is underlined.
-
getUnderlineStyle
public int getUnderlineStyle()
Returns the underline style of this run.
-
getOutline
public RMXString.Outline getOutline()
Returns the outline info for this run (null for none).
-
getOutline
public static RMXString.Outline getOutline(java.util.Map attrs)
Returns the Outline record for the given attributes map (or null for none).
-
getFormat
public RMFormat getFormat()
Returns the format for this run.
-
getNumberFormat
@Nonnull public RMNumberFormat getNumberFormat()
-
getDateFormat
@Nonnull public RMDateFormat getDateFormat()
-
getScripting
public int getScripting()
Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).
-
getCharSpacing
public float getCharSpacing()
Returns the char spacing.
-
getNext
public RMXStringRun getNext()
Return next run.
-
getRunCount
public int getRunCount()
Returns the run count.
-
getRun
public RMXStringRun getRun(int anIndex)
Returns the run at given index.
-
getRunLast
public RMXStringRun getRunLast()
Returns the last run.
-
getRunAt
public RMXStringRun getRunAt(int anIndex, boolean isInclusive)
Returns the XString run that contains or ends (if given option is true) at given index.
-
addLength
public void addLength(int aLength, int anIndex)
Adds length to run for char index.
-
removeLength
public void removeLength(int aLength, int anIndex)
Removes a length from run(s) for char index.
-
shift
public void shift(int anAmount)
Shifts run by given amound.
-
split
public RMXStringRun split(int anIndex)
Splits the run at the given index and returns a run containing the remaining characters (and identical attributes).
-
equals
public boolean equals(java.lang.Object anObj)
Returns whether this run is equal to the given object.- Overrides:
equals
in classjava.lang.Object
-
clone
@Nullable public RMXStringRun clone()
Returns a basic clone of this object.- Overrides:
clone
in classjava.lang.Object
-
cloneDeep
public RMXStringRun cloneDeep(RMXString anXString)
Returns a clone of this run, including a clone of the next run(s) if present.
-
toString
public java.lang.String toString()
Returns a string representation of this run.- Specified by:
toString
in interfacejava.lang.CharSequence
- Overrides:
toString
in classjava.lang.Object
-
-