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 Summary
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypes
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignYNested classes/interfaces inherited from interface com.inductiveautomation.snap.text.TextTypes
TextTypes.TabType -
Field Summary
Fields inherited from interface com.inductiveautomation.snap.text.TextTypes
TEXT_CHAR_SPACING, TEXT_COLOR, TEXT_FONT, TEXT_FORMAT, TEXT_LINK, TEXT_OUTLINE, TEXT_SCRIPTING, TEXT_UNDERLINE -
Constructor Summary
ConstructorsConstructorDescriptionText()Creates a new text.Text(CharSequence theChars) Creates a Text initialized with the given String and no attributes. -
Method Summary
Modifier 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.TextRect
getHeight, getMaxX, getMaxY, getWidth, getX, getY, setHeight, setRect, setSize, setWidth, setX, setYMethods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListenerMethods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListenerMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
Text
public Text()Creates a new text. -
Text
Creates a Text initialized with the given String and no attributes.
-
-
Method Details
-
setSource
Loads the text from the given source. -
getSourceURL
Returns the source URL. -
setSourceURL
Sets the source URL. -
getSourceFile
Returns the source file. -
length
public int length()Returns the number of characters in the text.- Specified by:
lengthin interfaceCharSequence
-
charAt
public char charAt(int anIndex) Returns the char value at the specified index.- Specified by:
charAtin interfaceCharSequence
-
subSequence
Returns a new char sequence that is a subsequence of this sequence.- Specified by:
subSequencein interfaceCharSequence
-
getString
Returns the string for the text. -
setString
Sets the text to the given string. -
getFont
Returns the font for this line. -
setFont
Sets the font for this line. -
getDefaultFont
Returns the default font for this string. -
getFontScale
public double getFontScale()Returns the font scale of the text layout. -
setFontScale
public void setFontScale(double aValue) Sets the font scale of the text layout. -
getUseFractionalMetrics
public boolean getUseFractionalMetrics()Returns whether to use fractional character metrics. -
setUseFractionalMetrics
public void setUseFractionalMetrics(boolean aFlag) Sets whether to use fractional character metrics. -
getColor
Returns the color for this line. -
setColor
Sets the color for this line. -
getDefaultColor
Returns the default color for this string. -
getDefaultAttribute
Returns the default for a given key. -
isMonofont
public boolean isMonofont()Whether this text only allows a single font, color, etc. (defaults to false). -
setMonofont
public void setMonofont(boolean aValue) Sets whether this text only allows a single font, color, etc. -
addChars
Adds characters with attributes to this text at given index. -
removeChars
public void removeChars(int aStart, int anEnd) Removes characters in given range. -
replaceChars
Replaces chars in given range, with given String, using the given attributes. -
setAttribute
Sets a given attribute to a given value for a given range. -
getLineCount
public int getLineCount()Returns the number of lines in this text. -
getLine
Returns the individual text line in this text. -
getLines
Returns the list of lines. -
createLine
Creates a new line for use in this text. -
addLine
Adds a line at given index. -
addLine
Adds a line at given index. -
removeLine
Removes the line at given index. -
removeLine
Removes the given line. -
updateLines
protected void updateLines(int anIndex) Updates lines from index. -
getLineAt
Returns the TextLine at the given char index. -
getLineFor
Returns the TextLine at the given char index or the last line if at end. -
getLineLast
Returns the last line. -
getLineLongest
Returns the longest line. -
getTokenAt
Returns the token at given index. -
getRunAt
Returns the TextRun that contains the given index. -
getRunFor
Returns the TextRun that contains the given index or the last line last run if at end. -
getStyleAt
Returns the TextStyle for the run at the given character index. -
getLineForY
Returns the line for the given y value. -
getCharIndex
public int getCharIndex(double anX, double aY) Returns the character index for the given x/y point. -
invalidate
public void invalidate()Invalidates text. -
getPrefWidth
public double getPrefWidth()Returns the preferred width. -
getPrefHeight
public double getPrefHeight()Returns the preferred height. -
computePrefWidth
protected double computePrefWidth()Compute the preferred width. -
computePrefHeight
protected double computePrefHeight()Returns the preferred height. -
isPropertyChangeEnabled
public boolean isPropertyChangeEnabled()Returns whether property change is enabled. -
setPropertyChangeEnabled
public void setPropertyChangeEnabled(boolean aValue) Sets whether property change is enabled. -
sendPropertyChange
Implement so package can use protected method.- Overrides:
sendPropertyChangein classRMObject
-
clone
Standard clone implementation.- Overrides:
clonein classRMListenerList
-
toString
Standard toString implementation.- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classRMObject
-