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
,CharSequence
,Cloneable
A class to represent text with attributes.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypes
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
Nested classes/interfaces inherited from interface com.inductiveautomation.snap.text.TextTypes
TextTypes.TabType
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char
static final char
static final char
static final char
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChars
(CharSequence theChars, TextStyle theStyle, int anIndex) Adds characters with attributes to this line at given index.void
Adds a run to line.protected TextRun
Adds a new run at given index.char
charAt
(int anIndex) Returns the char value at the specified index.clone()
Standard clone implementation.protected TextRun
Creates a new run.protected List
Returns the tokens for this line.Returns the alignment associated with this paragraph.double
Returns the y position for this line (in same coords as the layout frame).int
getCharIndex
(double anX) Returns the character index for the given x/y point.int
getEnd()
Returns the end char index of this line in text.int
getIndex()
Returns the index of this line in text.char
Returns the last char.float
Returns the left side indentation of this paragraph.float
Returns the left side indentation of the first line in this paragraph (this can be set different than successive lines).double
Returns the vertical distance for any line below this line.float
Returns additional line spacing expressed as a constant amount in points.float
Returns the maximum line height in printer points associated with this paragraph.float
Returns the minimum line height in printer points associated with this paragraph.float
Returns the spacing of lines expressed as a factor of a given line's height.double
Returns the max ascent of the chars in this line.Returns the next line, if available.float
Returns the spacing between paragraphs in printer points associated with this paragraph.Returns the previous line if available.float
Returns the right side indentation of this paragraph.getRun
(int anIndex) Returns the individual run at given index.getRunAt
(int anIndex) Returns the head run for the line.int
Returns the number of runs for this line.getRunFor
(int anIndex) Returns the run for the given character index or last run if at end of line.Returns the last run.int
getStart()
Returns the start char index of this line in text.Returns the string for the line.float
getTab
(int anIndex) Returns the specific tab value for the given index in printer points.int
Returns the number of tabs associated with this paragraph.int
getTabIndex
(float aLocation) Returns the tab index for the given location.float[]
getTabs()
Returns the raw tab arrayReturns the values of all the tabs associated with this paragraph as a comma separated string.char
getTabType
(int anIndex) Returns the type of tab at the given index.char[]
Returns the raw tab type arraygetText()
Returns the text.getToken
(int anIndex) Returns the individual token at given index.getTokenAt
(int anIndex) Returns the token at character index.int
Returns the number of tokens.getTokenForPointX
(double anX) Returns the token at index.Returns the tokens for this line.double
getX()
Returns the line x.double
getXForChar
(int anIndex) Returns the x coord for the given character index.double
getY()
Returns the line y.void
Invalidates this line starting at given run.boolean
Returns whether run ends with newline.boolean
Returns whether line ends with space.protected void
Joins the given line to the end of this line.int
length()
Returns the length of this text line.void
removeChars
(int aStart, int anEnd) Removes characters in given range.removeRun
(int anIndex) Removes a run at given index.int
Removes the given run.void
setAlignX
(RMTypes.AlignX anAlign) Sets the alignment associated with this paragraph.void
setAttribute
(String aKey, Object aValue, int aStart, int anEnd) Sets a given attribute to a given value for a given range.void
setLineGap
(float aGap) Sets additional line spacing expressed as a constant amount in points.void
setLineHeightMax
(float aValue) Sets the maximum line height in printer points associated with this paragraph.void
setLineHeightMin
(float aValue) Sets the minimum line height in printer points associated with this paragraph.void
setLineSpacing
(float aSpacing) Sets the spacing of lines expressed as a factor of a given line's height.void
setParagraphSpacing
(float aValue) Returns the spacing between paragraphs in printer points associated with this paragraph.void
setTabsString
(String aString) Sets the value of tabs from the given tabs string.protected TextLine
split
(int anIndex) Splits the line at given index in line.subSequence
(int aStart, int anEnd) Returns a new char sequence that is a subsequence of this sequence.toString()
Standard toString implementation.protected void
updateRuns
(int aRunIndex) Updates length due to change in given run.void
validate()
Validates this line.Methods inherited from class com.inductiveautomation.snap.text.TextRect
getHeight, getMaxX, getMaxY, getWidth, setHeight, setRect, setSize, setWidth, setX, setY
Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
Methods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Field Details
-
TAB_LEFT
public static final char TAB_LEFT- See Also:
-
TAB_RIGHT
public static final char TAB_RIGHT- See Also:
-
TAB_CENTER
public static final char TAB_CENTER- See Also:
-
TAB_DECIMAL
public static final char TAB_DECIMAL- See Also:
-
-
Constructor Details
-
TextLine
public TextLine()Creates a new TextLine.
-
-
Method Details
-
getText
Returns the text. -
getIndex
public int getIndex()Returns the index of this line in text. -
getStart
public int getStart()Returns the start char index of this line in text. -
getEnd
public int getEnd()Returns the end char index of this line in text. -
length
public int length()Returns the length of this text line.- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int anIndex) Returns the char value at the specified index.- Specified by:
charAt
in interfaceCharSequence
-
subSequence
Returns a new char sequence that is a subsequence of this sequence.- Specified by:
subSequence
in interfaceCharSequence
-
getString
Returns the string for the line. -
addChars
Adds characters with attributes to this line at given index. -
removeChars
public void removeChars(int aStart, int anEnd) Removes characters in given range. -
setAttribute
Sets a given attribute to a given value for a given range. -
getRunCount
public int getRunCount()Returns the number of runs for this line. -
getRun
Returns the individual run at given index. -
createRun
Creates a new run. -
addRun
Adds a new run at given index. -
addRun
Adds a run to line. -
removeRun
Removes a run at given index. -
removeRun
Removes the given run. -
getRunLast
Returns the last run. -
getRunAt
Returns the head run for the line. -
getRunFor
Returns the run for the given character index or last run if at end of line. -
updateRuns
protected void updateRuns(int aRunIndex) Updates length due to change in given run. -
invalidate
public void invalidate()Invalidates this line starting at given run. -
validate
public void validate()Validates this line. -
getAlignX
Returns the alignment associated with this paragraph. -
setAlignX
Sets the alignment associated with this paragraph. -
getLeftIndent
public float getLeftIndent()Returns the left side indentation of this paragraph. -
getLeftIndentFirst
public float getLeftIndentFirst()Returns the left side indentation of the first line in this paragraph (this can be set different than successive lines). -
getRightIndent
public float getRightIndent()Returns the right side indentation of this paragraph. -
getLineSpacing
public float getLineSpacing()Returns the spacing of lines expressed as a factor of a given line's height. -
setLineSpacing
public void setLineSpacing(float aSpacing) Sets the spacing of lines expressed as a factor of a given line's height. -
getLineGap
public float getLineGap()Returns additional line spacing expressed as a constant amount in points. -
setLineGap
public void setLineGap(float aGap) Sets additional line spacing expressed as a constant amount in points. -
getLineHeightMin
public float getLineHeightMin()Returns the minimum line height in printer points associated with this paragraph. -
setLineHeightMin
public void setLineHeightMin(float aValue) Sets the minimum line height in printer points associated with this paragraph. -
getLineHeightMax
public float getLineHeightMax()Returns the maximum line height in printer points associated with this paragraph. -
setLineHeightMax
public void setLineHeightMax(float aValue) Sets the maximum line height in printer points associated with this paragraph. -
getParagraphSpacing
public float getParagraphSpacing()Returns the spacing between paragraphs in printer points associated with this paragraph. -
setParagraphSpacing
public void setParagraphSpacing(float aValue) Returns the spacing between paragraphs in printer points associated with this paragraph. -
getTabCount
public int getTabCount()Returns the number of tabs associated with this paragraph. -
getTab
public float getTab(int anIndex) Returns the specific tab value for the given index in printer points. -
getTabType
public char getTabType(int anIndex) Returns the type of tab at the given index. -
getTabs
public float[] getTabs()Returns the raw tab array -
getTabTypes
public char[] getTabTypes()Returns the raw tab type array -
getTabIndex
public int getTabIndex(float aLocation) Returns the tab index for the given location. -
getTabsString
Returns the values of all the tabs associated with this paragraph as a comma separated string. -
setTabsString
Sets the value of tabs from the given tabs string. -
getTokenCount
public int getTokenCount()Returns the number of tokens. -
getToken
Returns the individual token at given index. -
getTokens
Returns the tokens for this line. -
createTokens
Returns the tokens for this line. -
getX
public double getX()Returns the line x. -
getY
public double getY()Returns the line y. -
getBaselineY
public double getBaselineY()Returns the y position for this line (in same coords as the layout frame). -
getMaxAscent
public double getMaxAscent()Returns the max ascent of the chars in this line. -
getLineAdvance
public double getLineAdvance()Returns the vertical distance for any line below this line. -
getLastChar
public char getLastChar()Returns the last char. -
isLastCharWhiteSpace
public boolean isLastCharWhiteSpace()Returns whether line ends with space. -
isLastCharNewline
public boolean isLastCharNewline()Returns whether run ends with newline. -
getTokenAt
Returns the token at character index. -
getTokenForPointX
Returns the token at index. -
getCharIndex
public int getCharIndex(double anX) Returns the character index for the given x/y point. -
getXForChar
public double getXForChar(int anIndex) Returns the x coord for the given character index. -
getPreviousLine
Returns the previous line if available. -
getNextLine
Returns the next line, if available. -
split
Splits the line at given index in line. -
join
Joins the given line to the end of this line. -
clone
Standard clone implementation.- Overrides:
clone
in classRMListenerList
-
toString
Standard toString implementation.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classRMObject
-