Package com.inductiveautomation.rm.text
Class RMTextLine
java.lang.Object
java.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double
com.inductiveautomation.rm.text.RMTextRun
com.inductiveautomation.rm.text.RMTextLine
- All Implemented Interfaces:
Shape
,Serializable
,CharSequence
,Cloneable
A class to represent a line of text in a layout.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
-
Field Summary
Fields inherited from class java.awt.geom.Rectangle2D.Double
height, width, x, y
Fields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addChar
(char aChar, double aWidth) Adds a char to text line.int
addChars
(RMXStringRun aRun, int aStart, int anEnd) Adds chars to text line.char
charAt
(int anIndex) Returns the char value at the specified index.protected int
deleteFromLastWord
(CharSequence anInput, int aStart) Rewind last word from line.int
getCharIndex
(double anX) Returns the character index for the given x/y point.double
Returns the max x position possible for layout's path.double
Returns the vertical distance for any line below this line.double
Returns the max ascent of the chars in this line.getNext()
Returns the next run.getPointForChar
(int anIndex) Returns the text origin for the given character index.getRun
(int anIndex) Returns the text run at the given index.int
Returns the number of runs in this line.getRunForPointX
(double anX) Returns the line index for the given y value.Returns the last run.double
Returns the total height of line runs.double
Returns the max stroke width of any underlined chars in this line.double
Returns the Y position of any underlined chars in this line.double
getXForChar
(int anIndex) Returns the x coord for the given character index.double
Returns the y position for this line (in same coords as the layout frame).protected void
Performs alignment.void
If line has any non-left tabs this method adjusts the width of the tab runs (and the positions of successive runs to correct for shift of these tabs).protected void
setBounds
(double anX, double aY, double aWidth, double aHeight) Sets the bounds of this layout.void
setLocked
(boolean aFlag) Sets whether text layout can add more characters.subSequence
(int aStart, int anEnd) Returns a new char sequence that is a subsequence of this sequence.toString()
Standard toString implementation.Methods inherited from class com.inductiveautomation.rm.text.RMTextRun
getCharAdvance, getCharSpacing, getColor, getColorChanged, getEnd, getEndsWithNewline, getEndsWithWhiteSpace, getFont, getFontChanged, getIndex, getLastChar, getLayout, getLine, getOutline, getParagraph, getRun, getRunAt, getScripting, getStart, getTab, getTabType, getUnderlineStyle, getXString, glyphVector, isHyphenated, isLocked, isTab, isUnderlined, length, setHyphenated
Methods inherited from class java.awt.geom.Rectangle2D.Double
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty
-
Constructor Details
-
RMTextLine
public RMTextLine()
-
-
Method Details
-
addChars
Adds chars to text line. -
addChar
protected void addChar(char aChar, double aWidth) Adds a char to text line. -
charAt
public char charAt(int anIndex) Returns the char value at the specified index.- Specified by:
charAt
in interfaceCharSequence
- Overrides:
charAt
in classRMTextRun
-
subSequence
Returns a new char sequence that is a subsequence of this sequence.- Specified by:
subSequence
in interfaceCharSequence
- Overrides:
subSequence
in classRMTextRun
-
setBounds
protected void setBounds(double anX, double aY, double aWidth, double aHeight) Sets the bounds of this layout. -
getYBaseline
public double getYBaseline()Returns the y position for this line (in same coords as the layout frame).- Overrides:
getYBaseline
in classRMTextRun
-
getHitMaxX
public double getHitMaxX()Returns the max x position possible for layout's path. Override if not just layout max. -
getNext
Returns the next run. -
getRunCount
public int getRunCount()Returns the number of runs in this line.- Overrides:
getRunCount
in classRMTextRun
-
getRun
Returns the text run at the given index. -
getRunLast
Returns the last run.- Overrides:
getRunLast
in classRMTextRun
-
getRunsHeight
public double getRunsHeight()Returns the total height of line runs. -
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. -
getXForChar
public double getXForChar(int anIndex) Returns the x coord for the given character index.- Overrides:
getXForChar
in classRMTextRun
-
getPointForChar
Returns the text origin for the given character index.- Overrides:
getPointForChar
in classRMTextRun
-
getRunForPointX
Returns the line index for the given y value. -
getCharIndex
public int getCharIndex(double anX) Returns the character index for the given x/y point.- Overrides:
getCharIndex
in classRMTextRun
-
getUnderlineStroke
public double getUnderlineStroke()Returns the max stroke width of any underlined chars in this line.- Overrides:
getUnderlineStroke
in classRMTextRun
-
getUnderlineY
public double getUnderlineY()Returns the Y position of any underlined chars in this line.- Overrides:
getUnderlineY
in classRMTextRun
-
deleteFromLastWord
Rewind last word from line. -
setLocked
public void setLocked(boolean aFlag) Sets whether text layout can add more characters. -
performTabShift
public void performTabShift()If line has any non-left tabs this method adjusts the width of the tab runs (and the positions of successive runs to correct for shift of these tabs). -
performAlignment
protected void performAlignment()Performs alignment. -
toString
Standard toString implementation.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classRMTextRun
-