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,- java.awt.Shape,- java.io.Serializable,- java.lang.CharSequence,- java.lang.Cloneable
 - Direct Known Subclasses:
- RMTextLayoutInPath
 
 public class RMTextLayout extends java.awt.geom.Rectangle2D.Double implements java.lang.CharSequence, RMTextTypes A class to layout text.- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2Djava.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float
 - 
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.text.RMTextTypesRMTextTypes.TabType
 - 
Nested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypesRMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
 
- 
 - 
Field Summary- 
Fields inherited from interface com.inductiveautomation.rm.text.RMTextTypesTEXT_CHAR_SPACING, TEXT_COLOR, TEXT_EMBEDDED_SHAPE, TEXT_FONT, TEXT_FORMAT, TEXT_OUTLINE, TEXT_PARAGRAPH, TEXT_SCRIPTING, TEXT_UNDERLINE
 
- 
 - 
Constructor SummaryConstructors Constructor Description RMTextLayout()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddChar(char aChar)Adds a char to the layout.intaddChars(RMXStringRun aRun, int aStart, int anEnd)Adds chars to text layout.RMTextLineaddLine(RMXStringRun aRun)Adds a new line and returns it.RMTextRunaddRun(RMXStringRun aRun, RMTextLine aLine)Adds a new run.charcharAt(int anIndex)Returns the char value at the specified index.protected RMTextLinecreateLine()Creates a new text line.RMTextRuncreateRun()Creates a new run.voiddeleteChars(int anIndex)Deletes chars from index.RMTypes.AlignYgetAlignmentY()Returns the vertical alignment of this layout.intgetCharIndex(double anX, double aY)Returns the character index for the given x/y point.intgetCharIndex(java.awt.geom.Point2D aPoint)Returns the character index for the given x/y point.intgetEnd()Returns the end char index of the layout in XString.doublegetFontScale()Returns the font scale of the text layout.doublegetHeightToFit()Returns the height to fit.doublegetIndent(RMXStringRun aRun)Returns the indent for this line.RMTextLinegetLine()Returns the head line of line linked list.RMTextLinegetLine(int anIndex)Returns the individual line at given index.intgetLineCount()Returns the number of lines.RMTextLinegetLineForChar(int anIndex)Returns the line for the given character index.RMTextLinegetLineForPointY(double aY)Returns the line for the given y value.RMTextLinegetLineLast()Returns the last line.booleangetLongWordFound()Returns whether a word was found that over-ran a whole line by itself.booleangetNeedsLayout()Returns whether text needs to perform layout.java.awt.geom.Point2DgetNextLineStartPoint(RMXStringRun aRun)Returns what this line thinks is the next line's x.java.awt.geom.GeneralPathgetPathForChars(int aStart, int anEnd)Returns a path for two char indexes - it will be a a simple box with extensions for first/last lines.java.awt.geom.Point2DgetPointForChar(int anIndex)Returns the text origin for the given character index.booleangetRanOutOfRoom()Returns whether layout ran out of room trying to render chars.RMTextRungetRun()Returns the head run in linked list of runs for the layout.RMTextRungetRun(int anIndex)Returns the text run at the given index.intgetRunCount()Returns the number of runs in this line.RMTextRungetRunForPoint(double anX, double aY)Returns the run for given x/y.RMTextRungetRunLast()Returns the last run.intgetStart()Returns the start char index of the layout in XString.booleangetUseFractionalMetrics()Returns whether to use fractional character metrics.doublegetWidthToFit()Returns the width to fit.booleangetWrapped()Returns whether layout had to wrap a line.RMXStringgetXString()Returns the RMXString.booleanisLocked()Returns whether text layout is full.voidlayout()Performs text layout if needed.protected voidlayoutText()Performs text layout.voidlayoutToFit()Scales font sizes of all text in an RMText shape to fit in bounds.intlength()Returns the length of this text layout.protected voidpathlineTo(java.awt.geom.GeneralPath path, double x, double y)protected voidpathmoveTo(java.awt.geom.GeneralPath path, double x, double y)protected voidperformAlignmentY()Perform vertical alignment - this needs to move to RMTextShape!voidremoveLine()Removes a line.voidsetAlignHeight(double aValue)Bogus!voidsetAlignmentY(RMTypes.AlignY anAlignment)Sets the vertical alignment of this layout.voidsetFontScale(double aValue)Sets the font scale of the text layout.voidsetLocked(boolean aFlag)Sets whether text layout can add more characters.voidsetNeedsLayout(boolean aValue)Sets whether text needs to perform layout.voidsetStart(int aStart)Sets the start char index of the layout in XString.voidsetUseFractionalMetrics(boolean aFlag)Sets whether to use fractional character metrics.voidsetXString(RMXString anXString)Sets the RMXString.java.lang.CharSequencesubSequence(int aStart, int anEnd)Returns a new char sequence that is a sub-sequence of this sequence.java.lang.StringtoString()Standard toString implementation.- 
Methods inherited from class java.awt.geom.Rectangle2D.DoublecreateIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect
 - 
Methods inherited from class java.awt.geom.Rectangle2Dadd, add, add, contains, contains, equals, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union
 - 
Methods inherited from class java.awt.geom.RectangularShapeclone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
 
- 
 
- 
- 
- 
Method Detail- 
getXStringpublic RMXString getXString() Returns the RMXString.
 - 
setXStringpublic void setXString(RMXString anXString) Sets the RMXString.
 - 
getStartpublic int getStart() Returns the start char index of the layout in XString.
 - 
setStartpublic void setStart(int aStart) Sets the start char index of the layout in XString.
 - 
getEndpublic int getEnd() Returns the end char index of the layout in XString.
 - 
getNeedsLayoutpublic boolean getNeedsLayout() Returns whether text needs to perform layout.
 - 
setNeedsLayoutpublic void setNeedsLayout(boolean aValue) Sets whether text needs to perform layout.
 - 
layoutpublic void layout() Performs text layout if needed.
 - 
layoutTextprotected void layoutText() Performs text layout.
 - 
addCharspublic int addChars(RMXStringRun aRun, int aStart, int anEnd) Adds chars to text layout.
 - 
addCharprotected void addChar(char aChar) Adds a char to the layout.
 - 
deleteCharspublic void deleteChars(int anIndex) Deletes chars from index.
 - 
lengthpublic int length() Returns the length of this text layout.- 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 sub-sequence of this sequence.- Specified by:
- subSequencein interface- java.lang.CharSequence
 
 - 
getFontScalepublic double getFontScale() Returns the font scale of the text layout.
 - 
setFontScalepublic void setFontScale(double aValue) Sets the font scale of the text layout.
 - 
getUseFractionalMetricspublic boolean getUseFractionalMetrics() Returns whether to use fractional character metrics.
 - 
setUseFractionalMetricspublic void setUseFractionalMetrics(boolean aFlag) Sets whether to use fractional character metrics.
 - 
getAlignmentYpublic RMTypes.AlignY getAlignmentY() Returns the vertical alignment of this layout.
 - 
setAlignmentYpublic void setAlignmentY(RMTypes.AlignY anAlignment) Sets the vertical alignment of this layout.
 - 
getWidthToFitpublic double getWidthToFit() Returns the width to fit.
 - 
getHeightToFitpublic double getHeightToFit() Returns the height to fit.
 - 
getLinepublic RMTextLine getLine() Returns the head line of line linked list.
 - 
getLineCountpublic int getLineCount() Returns the number of lines.
 - 
getLinepublic RMTextLine getLine(int anIndex) Returns the individual line at given index.
 - 
getLineLastpublic RMTextLine getLineLast() Returns the last line.
 - 
createLineprotected RMTextLine createLine() Creates a new text line.
 - 
addLinepublic RMTextLine addLine(RMXStringRun aRun) Adds a new line and returns it.
 - 
removeLinepublic void removeLine() Removes a line.
 - 
getRunpublic RMTextRun getRun() Returns the head run in linked list of runs for the layout.
 - 
getRunCountpublic int getRunCount() Returns the number of runs in this line.
 - 
getRunpublic RMTextRun getRun(int anIndex) Returns the text run at the given index.
 - 
getRunLast@Nullable public RMTextRun getRunLast() Returns the last run.
 - 
createRunpublic RMTextRun createRun() Creates a new run.
 - 
addRunpublic RMTextRun addRun(RMXStringRun aRun, @Nonnull RMTextLine aLine) Adds a new run.
 - 
getCharIndexpublic int getCharIndex(java.awt.geom.Point2D aPoint) Returns the character index for the given x/y point.
 - 
getCharIndexpublic int getCharIndex(double anX, double aY)Returns the character index for the given x/y point.
 - 
getPointForCharpublic java.awt.geom.Point2D getPointForChar(int anIndex) Returns the text origin for the given character index.
 - 
getLineForCharpublic RMTextLine getLineForChar(int anIndex) Returns the line for the given character index.
 - 
getLineForPointYpublic RMTextLine getLineForPointY(double aY) Returns the line for the given y value.
 - 
getRunForPointpublic RMTextRun getRunForPoint(double anX, double aY) Returns the run for given x/y.
 - 
getNextLineStartPointpublic java.awt.geom.Point2D getNextLineStartPoint(RMXStringRun aRun) Returns what this line thinks is the next line's x. Override if not infinity.
 - 
getIndentpublic double getIndent(RMXStringRun aRun) Returns the indent for this line.
 - 
getWrappedpublic boolean getWrapped() Returns whether layout had to wrap a line.
 - 
getLongWordFoundpublic boolean getLongWordFound() Returns whether a word was found that over-ran a whole line by itself.
 - 
getRanOutOfRoompublic boolean getRanOutOfRoom() Returns whether layout ran out of room trying to render chars.
 - 
getPathForCharspublic java.awt.geom.GeneralPath 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.
 - 
pathmoveToprotected void pathmoveTo(java.awt.geom.GeneralPath path, double x, double y)
 - 
pathlineToprotected void pathlineTo(java.awt.geom.GeneralPath path, double x, double y)
 - 
isLockedpublic boolean isLocked() Returns whether text layout is full.
 - 
setLockedpublic void setLocked(boolean aFlag) Sets whether text layout can add more characters.
 - 
performAlignmentYprotected void performAlignmentY() Perform vertical alignment - this needs to move to RMTextShape!
 - 
setAlignHeightpublic void setAlignHeight(double aValue) Bogus!
 - 
layoutToFitpublic void layoutToFit() Scales font sizes of all text in an RMText shape to fit in bounds. Caches font scale factor in xstring.
 - 
toStringpublic java.lang.String toString() Standard toString implementation.- Specified by:
- toStringin interface- java.lang.CharSequence
- Overrides:
- toStringin class- java.awt.geom.Rectangle2D.Double
 
 
- 
 
-