Package com.inductiveautomation.rm.text
Class RMTextLayout
java.lang.Object
java.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double
com.inductiveautomation.rm.text.RMTextLayout
- All Implemented Interfaces:
RMTypes
,RMTextTypes
,Shape
,Serializable
,CharSequence
,Cloneable
- Direct Known Subclasses:
RMTextLayoutInPath
A class to layout text.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.text.RMTextTypes
RMTextTypes.TabType
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypes
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
-
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
Fields inherited from interface com.inductiveautomation.rm.text.RMTextTypes
TEXT_CHAR_SPACING, TEXT_COLOR, TEXT_EMBEDDED_SHAPE, TEXT_FONT, TEXT_FORMAT, TEXT_OUTLINE, TEXT_PARAGRAPH, TEXT_SCRIPTING, TEXT_UNDERLINE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addChar
(char aChar) Adds a char to the layout.int
addChars
(RMXStringRun aRun, int aStart, int anEnd) Adds chars to text layout.addLine
(RMXStringRun aRun) Adds a new line and returns it.addRun
(RMXStringRun aRun, RMTextLine aLine) Adds a new run.char
charAt
(int anIndex) Returns the char value at the specified index.protected RMTextLine
Creates a new text line.Creates a new run.void
deleteChars
(int anIndex) Deletes chars from index.Returns the vertical alignment of this layout.int
getCharIndex
(double anX, double aY) Returns the character index for the given x/y point.int
getCharIndex
(Point2D aPoint) Returns the character index for the given x/y point.int
getEnd()
Returns the end char index of the layout in XString.double
Returns the font scale of the text layout.double
Returns the height to fit.double
getIndent
(RMXStringRun aRun) Returns the indent for this line.getLine()
Returns the head line of line linked list.getLine
(int anIndex) Returns the individual line at given index.int
Returns the number of lines.getLineForChar
(int anIndex) Returns the line for the given character index.getLineForPointY
(double aY) Returns the line for the given y value.Returns the last line.boolean
Returns whether a word was found that over-ran a whole line by itself.boolean
Returns whether text needs to perform layout.Returns what this line thinks is the next line's x.getPathForChars
(int aStart, int anEnd) Returns a path for two char indexes - it will be a a simple box with extensions for first/last lines.getPointForChar
(int anIndex) Returns the text origin for the given character index.boolean
Returns whether layout ran out of room trying to render chars.getRun()
Returns the head run in linked list of runs for the layout.getRun
(int anIndex) Returns the text run at the given index.int
Returns the number of runs in this line.getRunForPoint
(double anX, double aY) Returns the run for given x/y.Returns the last run.int
getStart()
Returns the start char index of the layout in XString.boolean
Returns whether to use fractional character metrics.double
Returns the width to fit.boolean
Returns whether layout had to wrap a line.Returns the RMXString.boolean
isLocked()
Returns whether text layout is full.void
layout()
Performs text layout if needed.protected void
Performs text layout.void
Scales font sizes of all text in an RMText shape to fit in bounds.int
length()
Returns the length of this text layout.protected void
pathlineTo
(GeneralPath path, double x, double y) protected void
pathmoveTo
(GeneralPath path, double x, double y) protected void
Perform vertical alignment - this needs to move to RMTextShape!void
Removes a line.void
setAlignHeight
(double aValue) Bogus!void
setAlignmentY
(RMTypes.AlignY anAlignment) Sets the vertical alignment of this layout.void
setFontScale
(double aValue) Sets the font scale of the text layout.void
setLocked
(boolean aFlag) Sets whether text layout can add more characters.void
setNeedsLayout
(boolean aValue) Sets whether text needs to perform layout.void
setStart
(int aStart) Sets the start char index of the layout in XString.void
setUseFractionalMetrics
(boolean aFlag) Sets whether to use fractional character metrics.void
setXString
(RMXString anXString) Sets the RMXString.subSequence
(int aStart, int anEnd) Returns a new char sequence that is a sub-sequence of this sequence.toString()
Standard toString implementation.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
-
RMTextLayout
public RMTextLayout()
-
-
Method Details
-
getXString
Returns the RMXString. -
setXString
Sets the RMXString. -
getStart
public int getStart()Returns the start char index of the layout in XString. -
setStart
public void setStart(int aStart) Sets the start char index of the layout in XString. -
getEnd
public int getEnd()Returns the end char index of the layout in XString. -
getNeedsLayout
public boolean getNeedsLayout()Returns whether text needs to perform layout. -
setNeedsLayout
public void setNeedsLayout(boolean aValue) Sets whether text needs to perform layout. -
layout
public void layout()Performs text layout if needed. -
layoutText
protected void layoutText()Performs text layout. -
addChars
Adds chars to text layout. -
addChar
protected void addChar(char aChar) Adds a char to the layout. -
deleteChars
public void deleteChars(int anIndex) Deletes chars from index. -
length
public int length()Returns the length of this text layout.- 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 sub-sequence of this sequence.- Specified by:
subSequence
in interfaceCharSequence
-
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. -
getAlignmentY
Returns the vertical alignment of this layout. -
setAlignmentY
Sets the vertical alignment of this layout. -
getWidthToFit
public double getWidthToFit()Returns the width to fit. -
getHeightToFit
public double getHeightToFit()Returns the height to fit. -
getLine
Returns the head line of line linked list. -
getLineCount
public int getLineCount()Returns the number of lines. -
getLine
Returns the individual line at given index. -
getLineLast
Returns the last line. -
createLine
Creates a new text line. -
addLine
Adds a new line and returns it. -
removeLine
public void removeLine()Removes a line. -
getRun
Returns the head run in linked list of runs for the layout. -
getRunCount
public int getRunCount()Returns the number of runs in this line. -
getRun
Returns the text run at the given index. -
getRunLast
Returns the last run. -
createRun
Creates a new run. -
addRun
Adds a new run. -
getCharIndex
Returns the character index for the given x/y point. -
getCharIndex
public int getCharIndex(double anX, double aY) Returns the character index for the given x/y point. -
getPointForChar
Returns the text origin for the given character index. -
getLineForChar
Returns the line for the given character index. -
getLineForPointY
Returns the line for the given y value. -
getRunForPoint
Returns the run for given x/y. -
getNextLineStartPoint
Returns what this line thinks is the next line's x. Override if not infinity. -
getIndent
Returns the indent for this line. -
getWrapped
public boolean getWrapped()Returns whether layout had to wrap a line. -
getLongWordFound
public boolean getLongWordFound()Returns whether a word was found that over-ran a whole line by itself. -
getRanOutOfRoom
public boolean getRanOutOfRoom()Returns whether layout ran out of room trying to render chars. -
getPathForChars
Returns a path for two char indexes - it will be a a simple box with extensions for first/last lines. -
pathmoveTo
-
pathlineTo
-
isLocked
public boolean isLocked()Returns whether text layout is full. -
setLocked
public void setLocked(boolean aFlag) Sets whether text layout can add more characters. -
performAlignmentY
protected void performAlignmentY()Perform vertical alignment - this needs to move to RMTextShape! -
setAlignHeight
public void setAlignHeight(double aValue) Bogus! -
layoutToFit
public void layoutToFit()Scales font sizes of all text in an RMText shape to fit in bounds. Caches font scale factor in xstring. -
toString
Standard toString implementation.- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classRectangle2D.Double
-