Class TextRun
java.lang.Object
com.inductiveautomation.snap.text.TextRun
- All Implemented Interfaces:
- RMTypes,- TextTypes,- CharSequence,- Cloneable
The Run class represents a range of characters in an TextLine 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 SummaryNested ClassesModifier and TypeClassDescriptionclassA property change event for addChars/removeChars.Nested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypesRMTypes.Align, RMTypes.AlignX, RMTypes.AlignYNested classes/interfaces inherited from interface com.inductiveautomation.snap.text.TextTypesTextTypes.TabType
- 
Field SummaryFields inherited from interface com.inductiveautomation.snap.text.TextTypesTEXT_CHAR_SPACING, TEXT_COLOR, TEXT_FONT, TEXT_FORMAT, TEXT_LINK, TEXT_OUTLINE, TEXT_SCRIPTING, TEXT_UNDERLINE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddChars(CharSequence theChars, int anIndex) Adds characters with style to this line at given index.charcharAt(int anIndex) CharSequence method returning character at given index.clone()Returns a basic clone of this object.booleanReturns whether this run is equal to the given object.protected voidfirePropertyChangeEvent(String aPropName, Object oldVal, Object newVal, int anIndex) Fires a property change event.doublegetCharAdvance(char aChar) Returns the char advance for a given character.floatReturns the char spacing.getColor()Returns the color for this run.intgetEnd()Returns the end character index for this run.getFont()Returns the font for this run.intgetIndex()Returns the run index.doubleReturns the default distance between lines for this font.getLine()Returns the line that this run works for.doubleReturns the max distance above the baseline for this run font.doubleReturns the max distance below the baseline that this font goes.getNext()Returns the next run.intReturns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).intgetStart()Returns the start character index for this run.Returns the string for this run.getStyle()Returns the run style.intReturns the underline style of this run.static intgetUnderlineStyle(Map attrs) Returns the underline style of this run.inthashCode()Standard hashCode implementation.booleanReturns whether this run is underlined.intlength()Returns the length in characters for this run.voidremoveChars(int aStart, int anEnd) Removes characters in given range.protected voidsendPropertyChange(PropertyChangeEvent anEvent) Sends a property change event.voidSets the run style.split(int anIndex) Splits the run at the given index and returns a run containing the remaining characters (and identical attributes).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.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequencechars, codePoints, isEmpty
- 
Constructor Details- 
TextRunpublic TextRun()
 
- 
- 
Method Details- 
getLineReturns the line that this run works for.
- 
getIndexpublic int getIndex()Returns the run index.
- 
getStartpublic int getStart()Returns the start character index for this run.
- 
getEndpublic int getEnd()Returns the end character index for this run.
- 
lengthpublic int length()Returns the length in characters for this run.- Specified by:
- lengthin interface- CharSequence
 
- 
charAtpublic char charAt(int anIndex) CharSequence method returning character at given index.- Specified by:
- charAtin interface- CharSequence
 
- 
subSequenceCharSequence method return character sequence for range.- Specified by:
- subSequencein interface- CharSequence
 
- 
getStringReturns the string for this run.
- 
addCharsAdds characters with style to this line at given index.
- 
removeCharspublic void removeChars(int aStart, int anEnd) Removes characters in given range.
- 
getStyleReturns the run style.
- 
setStyleSets the run style.
- 
getFontReturns the font for this run.
- 
getColorReturns the color for this run.
- 
isUnderlinedpublic boolean isUnderlined()Returns whether this run is underlined.
- 
getUnderlineStylepublic int getUnderlineStyle()Returns the underline style of this run.
- 
getUnderlineStyleReturns the underline style of this run.
- 
getScriptingpublic int getScripting()Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).
- 
getCharSpacingpublic float getCharSpacing()Returns the char spacing.
- 
getCharAdvancepublic double getCharAdvance(char aChar) Returns the char advance for a given character.
- 
getMaxAscentpublic double getMaxAscent()Returns the max distance above the baseline for this run font.
- 
getMaxDescentpublic double getMaxDescent()Returns the max distance below the baseline that this font goes.
- 
getLeadingpublic double getLeading()Returns the default distance between lines for this font.
- 
getNextReturns the next run.
- 
splitSplits the run at the given index and returns a run containing the remaining characters (and identical attributes).
- 
firePropertyChangeEventFires a property change event.
- 
sendPropertyChangeSends a property change event.
- 
equalsReturns whether this run is equal to the given object.
- 
hashCodepublic int hashCode()Standard hashCode implementation.
- 
cloneReturns a basic clone of this object.
- 
toStringReturns a string representation of this run.- Specified by:
- toStringin interface- CharSequence
- Overrides:
- toStringin class- Object
 
 
-