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,- CharSequence,- Cloneable
This class represents text.
- 
Nested Class SummaryNested 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 SummaryConstructorsConstructorDescriptionText()Creates a new text.Text(CharSequence theChars) Creates a Text initialized with the given String and no attributes.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddChars(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.voidAdds a line at given index.charcharAt(int anIndex) Returns the char value at the specified index.clone()Standard clone implementation.protected doubleReturns the preferred height.protected doubleCompute the preferred width.protected TextLineCreates a new line for use in this text.intgetCharIndex(double anX, double aY) Returns the character index for the given x/y point.getColor()Returns the color for this line.getDefaultAttribute(Object aKey) Returns the default for a given key.Returns the default color for this string.Returns the default font for this string.getFont()Returns the font for this line.doubleReturns the font scale of the text layout.getLine(int anIndex) Returns the individual text line in this text.getLineAt(int anIndex) Returns the TextLine at the given char index.intReturns the number of lines in this text.getLineFor(int anIndex) Returns the TextLine at the given char index or the last line if at end.getLineForY(double aY) Returns the line for the given y value.Returns the last line.Returns the longest line.getLines()Returns the list of lines.doubleReturns the preferred height.doubleReturns the preferred width.getRunAt(int anIndex) Returns the TextRun that contains the given index.getRunFor(int anIndex) Returns the TextRun that contains the given index or the last line last run if at end.Returns the source file.Returns the source URL.Returns the string for the text.getStyleAt(int anIndex) Returns the TextStyle for the run at the given character index.getTokenAt(int anIndex) Returns the token at given index.booleanReturns whether to use fractional character metrics.voidInvalidates text.booleanWhether this text only allows a single font, color, etc.booleanReturns whether property change is enabled.intlength()Returns the number of characters in the text.voidremoveChars(int aStart, int anEnd) Removes characters in given range.removeLine(int anIndex) Removes the line at given index.intremoveLine(TextLine aLine) Removes the given line.voidreplaceChars(CharSequence theChars, TextStyle theStyle, int aStart, int anEnd) Replaces chars in given range, with given String, using the given attributes.protected voidsendPropertyChange(PropertyChangeEvent anEvent) Implement so package can use protected method.voidsetAttribute(String aKey, Object aValue, int aStart, int anEnd) Sets a given attribute to a given value for a given range.voidSets the color for this line.voidSets 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.voidLoads the text from the given source.voidsetSourceURL(WebURL aURL) Sets the source URL.voidSets the text to the given string.voidsetUseFractionalMetrics(boolean aFlag) Sets whether to use fractional character metrics.subSequence(int aStart, int anEnd) Returns a new char sequence that is a subsequence of this sequence.toString()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, setYMethods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListenerMethods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListenerMethods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequencechars, codePoints, isEmpty
- 
Constructor Details- 
Textpublic Text()Creates a new text.
- 
TextCreates a Text initialized with the given String and no attributes.
 
- 
- 
Method Details- 
setSourceLoads the text from the given source.
- 
getSourceURLReturns the source URL.
- 
setSourceURLSets the source URL.
- 
getSourceFileReturns the source file.
- 
lengthpublic int length()Returns the number of characters in the text.- Specified by:
- lengthin interface- CharSequence
 
- 
charAtpublic char charAt(int anIndex) Returns the char value at the specified index.- Specified by:
- charAtin interface- CharSequence
 
- 
subSequenceReturns a new char sequence that is a subsequence of this sequence.- Specified by:
- subSequencein interface- CharSequence
 
- 
getStringReturns the string for the text.
- 
setStringSets the text to the given string.
- 
getFontReturns the font for this line.
- 
setFontSets the font for this line.
- 
getDefaultFontReturns 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.
- 
getColorReturns the color for this line.
- 
setColorSets the color for this line.
- 
getDefaultColorReturns the default color for this string.
- 
getDefaultAttributeReturns 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.
- 
addCharsAdds characters with attributes to this text at given index.
- 
removeCharspublic void removeChars(int aStart, int anEnd) Removes characters in given range.
- 
replaceCharsReplaces chars in given range, with given String, using the given attributes.
- 
setAttributeSets a given attribute to a given value for a given range.
- 
getLineCountpublic int getLineCount()Returns the number of lines in this text.
- 
getLineReturns the individual text line in this text.
- 
getLinesReturns the list of lines.
- 
createLineCreates a new line for use in this text.
- 
addLineAdds a line at given index.
- 
addLineAdds a line at given index.
- 
removeLineRemoves the line at given index.
- 
removeLineRemoves the given line.
- 
updateLinesprotected void updateLines(int anIndex) Updates lines from index.
- 
getLineAtReturns the TextLine at the given char index.
- 
getLineForReturns the TextLine at the given char index or the last line if at end.
- 
getLineLastReturns the last line.
- 
getLineLongestReturns the longest line.
- 
getTokenAtReturns the token at given index.
- 
getRunAtReturns the TextRun that contains the given index.
- 
getRunForReturns the TextRun that contains the given index or the last line last run if at end.
- 
getStyleAtReturns the TextStyle for the run at the given character index.
- 
getLineForYReturns 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.
- 
sendPropertyChangeImplement so package can use protected method.- Overrides:
- sendPropertyChangein class- RMObject
 
- 
cloneStandard clone implementation.- Overrides:
- clonein class- RMListenerList
 
- 
toStringStandard toString implementation.- Specified by:
- toStringin interface- CharSequence
- Overrides:
- toStringin class- RMObject
 
 
-