Class Text
- java.lang.Object
- 
- com.inductiveautomation.rm.base.RMListenerList
- 
- com.inductiveautomation.rm.base.RMObject
- 
- com.inductiveautomation.snap.text.TextRect
- 
- com.inductiveautomation.snap.text.Text
 
 
 
 
- 
- All Implemented Interfaces:
- RMPropertyChanger,- RMTypes,- TextTypes,- java.lang.CharSequence,- java.lang.Cloneable
 
 public class Text extends TextRect implements TextTypes, java.lang.CharSequence, java.lang.Cloneable This class represents text.
- 
- 
Nested Class Summary- 
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
 
- 
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChars(java.lang.CharSequence theChars, TextStyle theStyle, int anIndex)Adds characters with attributes to this text at given index.protected TextLineaddLine(int anIndex)Adds a line at given index.voidaddLine(TextLine aLine, int anIndex)Adds a line at given index.charcharAt(int anIndex)Returns the char value at the specified index.Textclone()Standard clone implementation.protected doublecomputePrefHeight()Returns the preferred height.protected doublecomputePrefWidth()Compute the preferred width.protected TextLinecreateLine()Creates a new line for use in this text.intgetCharIndex(double anX, double aY)Returns the character index for the given x/y point.SnapColorgetColor()Returns the color for this line.java.lang.ObjectgetDefaultAttribute(java.lang.Object aKey)Returns the default for a given key.SnapColorgetDefaultColor()Returns the default color for this string.SnapFontgetDefaultFont()Returns the default font for this string.SnapFontgetFont()Returns the font for this line.doublegetFontScale()Returns the font scale of the text layout.TextLinegetLine(int anIndex)Returns the individual text line in this text.TextLinegetLineAt(int anIndex)Returns the TextLine at the given char index.intgetLineCount()Returns the number of lines in this text.TextLinegetLineFor(int anIndex)Returns the TextLine at the given char index or the last line if at end.TextLinegetLineForY(double aY)Returns the line for the given y value.TextLinegetLineLast()Returns the last line.TextLinegetLineLongest()Returns the longest line.java.util.List<TextLine>getLines()Returns the list of lines.doublegetPrefHeight()Returns the preferred height.doublegetPrefWidth()Returns the preferred width.TextRungetRunAt(int anIndex)Returns the TextRun that contains the given index.TextRungetRunFor(int anIndex)Returns the TextRun that contains the given index or the last line last run if at end.WebFilegetSourceFile()Returns the source file.WebURLgetSourceURL()Returns the source URL.java.lang.StringgetString()Returns the string for the text.TextStylegetStyleAt(int anIndex)Returns the TextStyle for the run at the given character index.TextTokengetTokenAt(int anIndex)Returns the token at given index.booleangetUseFractionalMetrics()Returns whether to use fractional character metrics.voidinvalidate()Invalidates text.booleanisMonofont()Whether this text only allows a single font, color, etc.booleanisPropertyChangeEnabled()Returns whether property change is enabled.intlength()Returns the number of characters in the text.voidremoveChars(int aStart, int anEnd)Removes characters in given range.TextLineremoveLine(int anIndex)Removes the line at given index.intremoveLine(TextLine aLine)Removes the given line.voidreplaceChars(java.lang.CharSequence theChars, TextStyle theStyle, int aStart, int anEnd)Replaces chars in given range, with given String, using the given attributes.protected voidsendPropertyChange(java.beans.PropertyChangeEvent anEvent)Implement so package can use protected method.voidsetAttribute(java.lang.String aKey, java.lang.Object aValue, int aStart, int anEnd)Sets a given attribute to a given value for a given range.voidsetColor(SnapColor aColor)Sets the color for this line.voidsetFont(SnapFont aFont)Sets the font for this line.voidsetFontScale(double aValue)Sets the font scale of the text layout.voidsetMonofont(boolean aValue)Sets whether this text only allows a single font, color, etc.voidsetPropertyChangeEnabled(boolean aValue)Sets whether property change is enabled.voidsetSource(java.lang.Object aSource)Loads the text from the given source.voidsetSourceURL(WebURL aURL)Sets the source URL.voidsetString(java.lang.String aString)Sets the text to the given string.voidsetUseFractionalMetrics(boolean aFlag)Sets whether to use fractional character metrics.java.lang.CharSequencesubSequence(int aStart, int anEnd)Returns a new char sequence that is a subsequence of this sequence.java.lang.StringtoString()Standard toString implementation.protected voidupdateLines(int anIndex)Updates lines from index.- 
Methods inherited from class com.inductiveautomation.snap.text.TextRectgetHeight, getMaxX, getMaxY, getWidth, getX, getY, setHeight, setRect, setSize, setWidth, setX, setY
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
 
- 
 
- 
- 
- 
Method Detail- 
setSourcepublic void setSource(java.lang.Object aSource) Loads the text from the given source.
 - 
getSourceURLpublic WebURL getSourceURL() Returns the source URL.
 - 
setSourceURLpublic void setSourceURL(WebURL aURL) Sets the source URL.
 - 
getSourceFilepublic WebFile getSourceFile() Returns the source file.
 - 
lengthpublic int length() Returns the number of characters in the text.- Specified by:
- lengthin interface- java.lang.CharSequence
 
 - 
charAtpublic char charAt(int anIndex) Returns the char value at the specified index.- Specified by:
- charAtin interface- java.lang.CharSequence
 
 - 
subSequencepublic java.lang.CharSequence subSequence(int aStart, int anEnd)Returns a new char sequence that is a subsequence of this sequence.- Specified by:
- subSequencein interface- java.lang.CharSequence
 
 - 
getStringpublic java.lang.String getString() Returns the string for the text.
 - 
setStringpublic void setString(java.lang.String aString) Sets the text to the given string.
 - 
getFontpublic SnapFont getFont() Returns the font for this line.
 - 
setFontpublic void setFont(SnapFont aFont) Sets the font for this line.
 - 
getDefaultFontpublic SnapFont getDefaultFont() Returns the default font for this string.
 - 
getFontScalepublic double getFontScale() Returns the font scale of the text layout.
 - 
setFontScalepublic void setFontScale(double aValue) Sets the font scale of the text layout.
 - 
getUseFractionalMetricspublic boolean getUseFractionalMetrics() Returns whether to use fractional character metrics.
 - 
setUseFractionalMetricspublic void setUseFractionalMetrics(boolean aFlag) Sets whether to use fractional character metrics.
 - 
getColorpublic SnapColor getColor() Returns the color for this line.
 - 
setColorpublic void setColor(SnapColor aColor) Sets the color for this line.
 - 
getDefaultColorpublic SnapColor getDefaultColor() Returns the default color for this string.
 - 
getDefaultAttributepublic java.lang.Object getDefaultAttribute(java.lang.Object aKey) Returns the default for a given key.
 - 
isMonofontpublic boolean isMonofont() Whether this text only allows a single font, color, etc. (defaults to false).
 - 
setMonofontpublic void setMonofont(boolean aValue) Sets whether this text only allows a single font, color, etc.
 - 
addCharspublic void addChars(java.lang.CharSequence theChars, TextStyle theStyle, int anIndex)Adds characters with attributes to this text at given index.
 - 
removeCharspublic void removeChars(int aStart, int anEnd)Removes characters in given range.
 - 
replaceCharspublic void replaceChars(java.lang.CharSequence theChars, TextStyle theStyle, int aStart, int anEnd)Replaces chars in given range, with given String, using the given attributes.
 - 
setAttributepublic void setAttribute(java.lang.String aKey, java.lang.Object aValue, int aStart, int anEnd)Sets a given attribute to a given value for a given range.
 - 
getLineCountpublic int getLineCount() Returns the number of lines in this text.
 - 
getLinepublic TextLine getLine(int anIndex) Returns the individual text line in this text.
 - 
getLinespublic java.util.List<TextLine> getLines() Returns the list of lines.
 - 
createLineprotected TextLine createLine() Creates a new line for use in this text.
 - 
addLineprotected TextLine addLine(int anIndex) Adds a line at given index.
 - 
addLinepublic void addLine(TextLine aLine, int anIndex) Adds a line at given index.
 - 
removeLinepublic TextLine removeLine(int anIndex) Removes the line at given index.
 - 
removeLinepublic int removeLine(TextLine aLine) Removes the given line.
 - 
updateLinesprotected void updateLines(int anIndex) Updates lines from index.
 - 
getLineAtpublic TextLine getLineAt(int anIndex) Returns the TextLine at the given char index.
 - 
getLineForpublic TextLine getLineFor(int anIndex) Returns the TextLine at the given char index or the last line if at end.
 - 
getLineLastpublic TextLine getLineLast() Returns the last line.
 - 
getLineLongestpublic TextLine getLineLongest() Returns the longest line.
 - 
getTokenAtpublic TextToken getTokenAt(int anIndex) Returns the token at given index.
 - 
getRunAtpublic TextRun getRunAt(int anIndex) Returns the TextRun that contains the given index.
 - 
getRunForpublic TextRun getRunFor(int anIndex) Returns the TextRun that contains the given index or the last line last run if at end.
 - 
getStyleAtpublic TextStyle getStyleAt(int anIndex) Returns the TextStyle for the run at the given character index.
 - 
getLineForYpublic TextLine getLineForY(double aY) Returns the line for the given y value.
 - 
getCharIndexpublic int getCharIndex(double anX, double aY)Returns the character index for the given x/y point.
 - 
invalidatepublic void invalidate() Invalidates text.
 - 
getPrefWidthpublic double getPrefWidth() Returns the preferred width.
 - 
getPrefHeightpublic double getPrefHeight() Returns the preferred height.
 - 
computePrefWidthprotected double computePrefWidth() Compute the preferred width.
 - 
computePrefHeightprotected double computePrefHeight() Returns the preferred height.
 - 
isPropertyChangeEnabledpublic boolean isPropertyChangeEnabled() Returns whether property change is enabled.
 - 
setPropertyChangeEnabledpublic void setPropertyChangeEnabled(boolean aValue) Sets whether property change is enabled.
 - 
sendPropertyChangeprotected void sendPropertyChange(java.beans.PropertyChangeEvent anEvent) Implement so package can use protected method.- Overrides:
- sendPropertyChangein class- RMObject
 
 - 
clonepublic Text clone() Standard clone implementation.- Overrides:
- clonein class- RMListenerList
 
 
- 
 
-