Class TextRun
- java.lang.Object
- 
- com.inductiveautomation.snap.text.TextRun
 
- 
 public class TextRun extends java.lang.Object implements java.lang.Cloneable, TextTypes, java.lang.CharSequence 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 Classes Modifier and Type Class Description classTextRun.CharsChangeA property change event for addChars/removeChars.- 
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypesRMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
 - 
Nested classes/interfaces inherited from interface com.inductiveautomation.snap.text.TextTypesTextTypes.TabType
 
- 
 - 
Field Summary- 
Fields 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 Constructor Description TextRun()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChars(java.lang.CharSequence theChars, int anIndex)Adds characters with style to this line at given index.charcharAt(int anIndex)CharSequence method returning character at given index.TextRunclone()Returns a basic clone of this object.booleanequals(java.lang.Object anObj)Returns whether this run is equal to the given object.protected voidfirePropertyChangeEvent(java.lang.String aPropName, java.lang.Object oldVal, java.lang.Object newVal, int anIndex)Fires a property change event.doublegetCharAdvance(char aChar)Returns the char advance for a given character.floatgetCharSpacing()Returns the char spacing.SnapColorgetColor()Returns the color for this run.intgetEnd()Returns the end character index for this run.SnapFontgetFont()Returns the font for this run.intgetIndex()Returns the run index.doublegetLeading()Returns the default distance between lines for this font.TextLinegetLine()Returns the line that this run works for.doublegetMaxAscent()Returns the max distance above the baseline for this run font.doublegetMaxDescent()Returns the max distance below the baseline that this font goes.TextRungetNext()Returns the next run.intgetScripting()Returns the scripting for this run (1=SuperScripting, -1=Subscripting, 0=none).intgetStart()Returns the start character index for this run.java.lang.StringgetString()Returns the string for this run.TextStylegetStyle()Returns the run style.intgetUnderlineStyle()Returns the underline style of this run.static intgetUnderlineStyle(java.util.Map attrs)Returns the underline style of this run.inthashCode()Standard hashCode implementation.booleanisUnderlined()Returns 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(java.beans.PropertyChangeEvent anEvent)Sends a property change event.voidsetStyle(TextStyle aStyle)Sets the run style.TextRunsplit(int anIndex)Splits the run at the given index and returns a run containing the remaining characters (and identical attributes).java.lang.CharSequencesubSequence(int aStart, int anEnd)CharSequence method return character sequence for range.java.lang.StringtoString()Returns a string representation of this run.
 
- 
- 
- 
Method Detail- 
getLinepublic TextLine getLine() Returns 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- java.lang.CharSequence
 
 - 
charAtpublic char charAt(int anIndex) CharSequence method returning character at given index.- Specified by:
- charAtin interface- java.lang.CharSequence
 
 - 
subSequencepublic java.lang.CharSequence subSequence(int aStart, int anEnd)CharSequence method return character sequence for range.- Specified by:
- subSequencein interface- java.lang.CharSequence
 
 - 
getStringpublic java.lang.String getString() Returns the string for this run.
 - 
addCharspublic void addChars(java.lang.CharSequence theChars, int anIndex)Adds characters with style to this line at given index.
 - 
removeCharspublic void removeChars(int aStart, int anEnd)Removes characters in given range.
 - 
getStylepublic TextStyle getStyle() Returns the run style.
 - 
setStylepublic void setStyle(TextStyle aStyle) Sets the run style.
 - 
getFontpublic SnapFont getFont() Returns the font for this run.
 - 
getColorpublic SnapColor getColor() Returns the color for this run.
 - 
isUnderlinedpublic boolean isUnderlined() Returns whether this run is underlined.
 - 
getUnderlineStylepublic int getUnderlineStyle() Returns the underline style of this run.
 - 
getUnderlineStylepublic static int getUnderlineStyle(java.util.Map attrs) Returns 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.
 - 
getNextpublic TextRun getNext() Returns the next run.
 - 
splitpublic TextRun split(int anIndex) Splits the run at the given index and returns a run containing the remaining characters (and identical attributes).
 - 
firePropertyChangeEventprotected void firePropertyChangeEvent(java.lang.String aPropName, java.lang.Object oldVal, java.lang.Object newVal, int anIndex)Fires a property change event.
 - 
sendPropertyChangeprotected void sendPropertyChange(java.beans.PropertyChangeEvent anEvent) Sends a property change event.
 - 
equalspublic boolean equals(java.lang.Object anObj) Returns whether this run is equal to the given object.- Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() Standard hashCode implementation.- Overrides:
- hashCodein class- java.lang.Object
 
 - 
clone@Nullable public TextRun clone() Returns a basic clone of this object.- Overrides:
- clonein class- java.lang.Object
 
 - 
toStringpublic java.lang.String toString() Returns a string representation of this run.- Specified by:
- toStringin interface- java.lang.CharSequence
- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-