Package com.inductiveautomation.rm.text
Class RMXStringRun
java.lang.Object
com.inductiveautomation.rm.text.RMXStringRun
- All Implemented Interfaces:
RMTypes
,RMTextTypes
,CharSequence
,Cloneable
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLength
(int aLength, int anIndex) Adds length to run for char index.char
charAt
(int anIndex) CharSequence method returning character at given index.clone()
Returns a basic clone of this object.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
Returns whether this run is equal to the given object.getAttribute
(String aKey) Returns a specific attribute for the given key.float
Returns the char spacing.getColor()
Returns the color for this run.getFont()
Returns the font for this run.Returns the format for this run.getNext()
Return next run.Returns the outline info for this run (null for none).static RMXString.Outline
getOutline
(Map attrs) Returns the Outline record for the given attributes map (or null for none).Returns the paragraph for this run.getRun
(int anIndex) Returns the run at given index.getRunAt
(int anIndex, boolean isInclusive) Returns the XString run that contains or ends (if given option is true) at given index.int
Returns the run count.Returns the last run.int
Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).getStyle()
Returns the text style.int
Returns the underline style of this run.boolean
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.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.subSequence
(int aStart, int anEnd) CharSequence method return character sequence for range.toString()
Returns a string representation of this run.Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
RMXStringRun
Creates a new run.
-
-
Method Details
-
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 interfaceCharSequence
-
charAt
public char charAt(int anIndex) CharSequence method returning character at given index.- Specified by:
charAt
in interfaceCharSequence
-
subSequence
CharSequence method return character sequence for range.- Specified by:
subSequence
in interfaceCharSequence
-
getStyle
Returns the text style. -
setStyle
Sets the text style. -
getAttribute
Returns a specific attribute for the given key. -
getFont
Returns the font for this run. -
getColor
Returns the color for this run. -
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
Returns the outline info for this run (null for none). -
getOutline
Returns the Outline record for the given attributes map (or null for none). -
getFormat
Returns the format for this run. -
getNumberFormat
-
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
Return next run. -
getRunCount
public int getRunCount()Returns the run count. -
getRun
Returns the run at given index. -
getRunLast
Returns the last run. -
getRunAt
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
Splits the run at the given index and returns a run containing the remaining characters (and identical attributes). -
equals
Returns whether this run is equal to the given object. -
clone
Returns a basic clone of this object. -
cloneDeep
Returns a clone of this run, including a clone of the next run(s) if present. -
toString
Returns a string representation of this run.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-