Class TextLine
- java.lang.Object
- 
- com.inductiveautomation.rm.base.RMListenerList
- 
- com.inductiveautomation.rm.base.RMObject
- 
- com.inductiveautomation.snap.text.TextRect
- 
- com.inductiveautomation.snap.text.TextLine
 
 
 
 
- 
- All Implemented Interfaces:
- RMPropertyChanger,- RMTypes,- TextTypes,- java.lang.CharSequence,- java.lang.Cloneable
 
 public class TextLine extends TextRect implements java.lang.CharSequence, TextTypes A class to represent text with attributes.
- 
- 
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 SummaryFields Modifier and Type Field Description static charTAB_CENTERstatic charTAB_DECIMALstatic charTAB_LEFTstatic charTAB_RIGHT- 
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 TextLine()Creates a new TextLine.
 - 
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 line at given index.voidaddRun(TextRun aRun, int anIndex)Adds a run to line.protected TextRunaddRun(TextStyle theStyle, int anIndex)Adds a new run at given index.charcharAt(int anIndex)Returns the char value at the specified index.TextLineclone()Standard clone implementation.protected TextRuncreateRun()Creates a new run.protected java.util.ListcreateTokens()Returns the tokens for this line.RMTypes.AlignXgetAlignX()Returns the alignment associated with this paragraph.doublegetBaselineY()Returns the y position for this line (in same coords as the layout frame).intgetCharIndex(double anX)Returns the character index for the given x/y point.intgetEnd()Returns the end char index of this line in text.intgetIndex()Returns the index of this line in text.chargetLastChar()Returns the last char.floatgetLeftIndent()Returns the left side indentation of this paragraph.floatgetLeftIndentFirst()Returns the left side indentation of the first line in this paragraph (this can be set different than successive lines).doublegetLineAdvance()Returns the vertical distance for any line below this line.floatgetLineGap()Returns additional line spacing expressed as a constant amount in points.floatgetLineHeightMax()Returns the maximum line height in printer points associated with this paragraph.floatgetLineHeightMin()Returns the minimum line height in printer points associated with this paragraph.floatgetLineSpacing()Returns the spacing of lines expressed as a factor of a given line's height.doublegetMaxAscent()Returns the max ascent of the chars in this line.TextLinegetNextLine()Returns the next line, if available.floatgetParagraphSpacing()Returns the spacing between paragraphs in printer points associated with this paragraph.TextLinegetPreviousLine()Returns the previous line if available.floatgetRightIndent()Returns the right side indentation of this paragraph.TextRungetRun(int anIndex)Returns the individual run at given index.TextRungetRunAt(int anIndex)Returns the head run for the line.intgetRunCount()Returns the number of runs for this line.TextRungetRunFor(int anIndex)Returns the run for the given character index or last run if at end of line.TextRungetRunLast()Returns the last run.intgetStart()Returns the start char index of this line in text.java.lang.StringgetString()Returns the string for the line.floatgetTab(int anIndex)Returns the specific tab value for the given index in printer points.intgetTabCount()Returns the number of tabs associated with this paragraph.intgetTabIndex(float aLocation)Returns the tab index for the given location.float[]getTabs()Returns the raw tab arrayjava.lang.StringgetTabsString()Returns the values of all the tabs associated with this paragraph as a comma separated string.chargetTabType(int anIndex)Returns the type of tab at the given index.char[]getTabTypes()Returns the raw tab type arrayTextgetText()Returns the text.TextTokengetToken(int anIndex)Returns the individual token at given index.TextTokengetTokenAt(int anIndex)Returns the token at character index.intgetTokenCount()Returns the number of tokens.TextTokengetTokenForPointX(double anX)Returns the token at index.java.util.List<TextToken>getTokens()Returns the tokens for this line.doublegetX()Returns the line x.doublegetXForChar(int anIndex)Returns the x coord for the given character index.doublegetY()Returns the line y.voidinvalidate()Invalidates this line starting at given run.booleanisLastCharNewline()Returns whether run ends with newline.booleanisLastCharWhiteSpace()Returns whether line ends with space.protected voidjoin(TextLine aLine)Joins the given line to the end of this line.intlength()Returns the length of this text line.voidremoveChars(int aStart, int anEnd)Removes characters in given range.TextRunremoveRun(int anIndex)Removes a run at given index.intremoveRun(TextRun aRun)Removes the given run.voidsetAlignX(RMTypes.AlignX anAlign)Sets the alignment associated with this paragraph.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.voidsetLineGap(float aGap)Sets additional line spacing expressed as a constant amount in points.voidsetLineHeightMax(float aValue)Sets the maximum line height in printer points associated with this paragraph.voidsetLineHeightMin(float aValue)Sets the minimum line height in printer points associated with this paragraph.voidsetLineSpacing(float aSpacing)Sets the spacing of lines expressed as a factor of a given line's height.voidsetParagraphSpacing(float aValue)Returns the spacing between paragraphs in printer points associated with this paragraph.voidsetTabsString(java.lang.String aString)Sets the value of tabs from the given tabs string.protected TextLinesplit(int anIndex)Splits the line at given index in line.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 voidupdateRuns(int aRunIndex)Updates length due to change in given run.voidvalidate()Validates this line.- 
Methods inherited from class com.inductiveautomation.snap.text.TextRectgetHeight, getMaxX, getMaxY, getWidth, setHeight, setRect, setSize, setWidth, setX, setY
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
 - 
Methods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
 
- 
 
- 
- 
- 
Field Detail- 
TAB_LEFTpublic static final char TAB_LEFT - See Also:
- Constant Field Values
 
 - 
TAB_RIGHTpublic static final char TAB_RIGHT - See Also:
- Constant Field Values
 
 - 
TAB_CENTERpublic static final char TAB_CENTER - See Also:
- Constant Field Values
 
 - 
TAB_DECIMALpublic static final char TAB_DECIMAL - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getTextpublic Text getText() Returns the text.
 - 
getIndexpublic int getIndex() Returns the index of this line in text.
 - 
getStartpublic int getStart() Returns the start char index of this line in text.
 - 
getEndpublic int getEnd() Returns the end char index of this line in text.
 - 
lengthpublic int length() Returns the length of this text line.- 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 line.
 - 
addCharspublic void addChars(java.lang.CharSequence theChars, TextStyle theStyle, int anIndex)Adds characters with attributes to this line at given index.
 - 
removeCharspublic void removeChars(int aStart, int anEnd)Removes characters in given range.
 - 
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.
 - 
getRunCountpublic int getRunCount() Returns the number of runs for this line.
 - 
getRunpublic TextRun getRun(int anIndex) Returns the individual run at given index.
 - 
createRunprotected TextRun createRun() Creates a new run.
 - 
addRunpublic void addRun(TextRun aRun, int anIndex) Adds a run to line.
 - 
removeRunpublic TextRun removeRun(int anIndex) Removes a run at given index.
 - 
removeRunpublic int removeRun(TextRun aRun) Removes the given run.
 - 
getRunLastpublic TextRun getRunLast() Returns the last run.
 - 
getRunAtpublic TextRun getRunAt(int anIndex) Returns the head run for the line.
 - 
getRunForpublic TextRun getRunFor(int anIndex) Returns the run for the given character index or last run if at end of line.
 - 
updateRunsprotected void updateRuns(int aRunIndex) Updates length due to change in given run.
 - 
invalidatepublic void invalidate() Invalidates this line starting at given run.
 - 
validatepublic void validate() Validates this line.
 - 
getAlignXpublic RMTypes.AlignX getAlignX() Returns the alignment associated with this paragraph.
 - 
setAlignXpublic void setAlignX(RMTypes.AlignX anAlign) Sets the alignment associated with this paragraph.
 - 
getLeftIndentpublic float getLeftIndent() Returns the left side indentation of this paragraph.
 - 
getLeftIndentFirstpublic float getLeftIndentFirst() Returns the left side indentation of the first line in this paragraph (this can be set different than successive lines).
 - 
getRightIndentpublic float getRightIndent() Returns the right side indentation of this paragraph.
 - 
getLineSpacingpublic float getLineSpacing() Returns the spacing of lines expressed as a factor of a given line's height.
 - 
setLineSpacingpublic void setLineSpacing(float aSpacing) Sets the spacing of lines expressed as a factor of a given line's height.
 - 
getLineGappublic float getLineGap() Returns additional line spacing expressed as a constant amount in points.
 - 
setLineGappublic void setLineGap(float aGap) Sets additional line spacing expressed as a constant amount in points.
 - 
getLineHeightMinpublic float getLineHeightMin() Returns the minimum line height in printer points associated with this paragraph.
 - 
setLineHeightMinpublic void setLineHeightMin(float aValue) Sets the minimum line height in printer points associated with this paragraph.
 - 
getLineHeightMaxpublic float getLineHeightMax() Returns the maximum line height in printer points associated with this paragraph.
 - 
setLineHeightMaxpublic void setLineHeightMax(float aValue) Sets the maximum line height in printer points associated with this paragraph.
 - 
getParagraphSpacingpublic float getParagraphSpacing() Returns the spacing between paragraphs in printer points associated with this paragraph.
 - 
setParagraphSpacingpublic void setParagraphSpacing(float aValue) Returns the spacing between paragraphs in printer points associated with this paragraph.
 - 
getTabCountpublic int getTabCount() Returns the number of tabs associated with this paragraph.
 - 
getTabpublic float getTab(int anIndex) Returns the specific tab value for the given index in printer points.
 - 
getTabTypepublic char getTabType(int anIndex) Returns the type of tab at the given index.
 - 
getTabspublic float[] getTabs() Returns the raw tab array
 - 
getTabTypespublic char[] getTabTypes() Returns the raw tab type array
 - 
getTabIndexpublic int getTabIndex(float aLocation) Returns the tab index for the given location.
 - 
getTabsStringpublic java.lang.String getTabsString() Returns the values of all the tabs associated with this paragraph as a comma separated string.
 - 
setTabsStringpublic void setTabsString(java.lang.String aString) Sets the value of tabs from the given tabs string.
 - 
getTokenCountpublic int getTokenCount() Returns the number of tokens.
 - 
getTokenpublic TextToken getToken(int anIndex) Returns the individual token at given index.
 - 
getTokenspublic java.util.List<TextToken> getTokens() Returns the tokens for this line.
 - 
createTokensprotected java.util.List createTokens() Returns the tokens for this line.
 - 
getBaselineYpublic double getBaselineY() Returns the y position for this line (in same coords as the layout frame).
 - 
getMaxAscentpublic double getMaxAscent() Returns the max ascent of the chars in this line.
 - 
getLineAdvancepublic double getLineAdvance() Returns the vertical distance for any line below this line.
 - 
getLastCharpublic char getLastChar() Returns the last char.
 - 
isLastCharWhiteSpacepublic boolean isLastCharWhiteSpace() Returns whether line ends with space.
 - 
isLastCharNewlinepublic boolean isLastCharNewline() Returns whether run ends with newline.
 - 
getTokenAtpublic TextToken getTokenAt(int anIndex) Returns the token at character index.
 - 
getTokenForPointXpublic TextToken getTokenForPointX(double anX) Returns the token at index.
 - 
getCharIndexpublic int getCharIndex(double anX) Returns the character index for the given x/y point.
 - 
getXForCharpublic double getXForChar(int anIndex) Returns the x coord for the given character index.
 - 
getPreviousLinepublic TextLine getPreviousLine() Returns the previous line if available.
 - 
getNextLinepublic TextLine getNextLine() Returns the next line, if available.
 - 
splitprotected TextLine split(int anIndex) Splits the line at given index in line.
 - 
joinprotected void join(TextLine aLine) Joins the given line to the end of this line.
 - 
clonepublic TextLine clone() Standard clone implementation.- Overrides:
- clonein class- RMListenerList
 
 
- 
 
-