Package com.inductiveautomation.rm.shape
Class RMTextShape
java.lang.Object
com.inductiveautomation.rm.base.RMListenerList
com.inductiveautomation.rm.base.RMObject
com.inductiveautomation.rm.shape.RMShape
com.inductiveautomation.rm.shape.RMRectShape
com.inductiveautomation.rm.shape.RMTextShape
- All Implemented Interfaces:
- Archivable,- DeepChangeListener,- RMPropertyChanger,- RMTypes,- PropertyChangeListener,- Cloneable,- EventListener
- Direct Known Subclasses:
- RMCrossTabCell,- RMGraphPartLabelAxis,- RMGraphPartValueAxis,- RMLinkedText,- RMTableRowCellTextShape,- RMText
This class is an RMShape subclass for handling rich text. Text is probably the most common and useful element in a
 ReportMill template. You might use this class to programmatically build or modify a template, like this:
 
RMXString xstring = new RMXString("Hello world!", RMFont.getFont("Arial", 12), RMColor.red); RMText text = new RMText(xstring); template.getPage(0).addChild(text); text.setXY(36, 36); text.setSizeToFit();
- 
Nested Class SummaryNested classes/interfaces inherited from interface com.inductiveautomation.rm.base.RMTypesRMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final bytestatic final bytestatic final byteFields inherited from class com.inductiveautomation.rm.shape.RMShapeBINDING_PROP_NAME, STROKE_BORDER, STROKE_DOUBLE, STROKE_HIDDEN, STROKE_SHAPE
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an empty text instance.RMTextShape(RMXString string) Creates a text instance initialized with the given RMXString.RMTextShape(String plainText) Creates a text instance initialized with the given plain text String.
- 
Method SummaryModifier and TypeMethodDescriptionclone()Standard clone implementation.protected doublecomputePrefHeight(double aWidth) Override to compute from RMTextLayout.protected doublecomputePrefWidth(double aHeight) Override to compute from RMTextLayout.voidcopyText(RMTextShape aText) Copies attributes from given object.protected RMShapecreateDivideShapeRemainder(byte anEdge) Creates a shape suitable for the "remainder" portion of a divideShape call (just a clone by default).Creates a new layout.protected RMXStringCreates the xstring for this text.fromXML(RXArchiver anArchiver, RXElement anElement) XML unarchival.voidfromXMLFinish(RXArchiver anArchiver, RXElement anElement) XML reference unarchival - to unarchive linked text.Returns the alignment for char 0.Returns the vertical alignment.Returns the alignment as a string, one of: "left", "center" or "right".Returns the autosizing default.floatReturns the char spacing at char 0.booleanReturns whether text should coalesce consecutive newlines in rpgClone.booleanReturns whether text should always draw at least a light gray border (useful when editing).getFont()Returns the font for char 0.floatReturns the line gap at char 0.floatReturns the maximum line height at char 0.floatReturns the minimum line height at char 0.floatReturns the line spacing at char 0.Returns the linked text for this text (if any).Returns margin.intReturns the bottom margin of the text (defaults to 0).Returns the default margin of the text (top=1, left=2, right=2, bottom=0).intReturns the left margin of the text (default to 2).intReturns the right margin of the text (defaults to 2).Returns the margin as a string.intReturns the top margin of the text (defaults to 1).Overridden from RMShape to provide the outlines of all the glyphsbooleanReturns the outline for char 0.getPath()Returns the path for this shape (might be PathShape).Overrides shape implementation to pass through getPathInBounds(inset).getPathInBounds(int anInset) Returns the shape's path scaled to the shape's current bounds.Returns the shape that provides the path for this text to wrap text to.booleanReturns whether text should wrap around other shapes that cause wrap.protected voidgetPropertyNames(List<String> aList) Returns the property names for RMShape.getText()Returns the text associated with this RMText as a plain String.Returns the color of the first character of the xstring associated with this RMText.Returns a text layout.intReturns the last character index visible in this text.intReturns the first character index visible in this text.bytegetWraps()Returns the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK).Returns the XString associated with this RMText.booleanReturns whether all characters can be visibly rendered in text bounds.booleanOverride this for shapes (like a table row) that don't don't make sense to delete by themselves.booleanEditor method.booleanReturns if char 0 is underlined.intlength()Returns the length, in characters, of the XString associated with this RMText.protected List<RMTextShape>paginate()Paginates this text by creating linked texts to show all text and returns a list of this text and the linked texts.voidpaintShape(RMShapePainter aPntr) Paints a text shape.voidpaintShapeBack(RMShapePainter aPntr) Paints the text shape background.voidpaintShapeText(RMShapePainter aPntr) Paints the text shape text.protected voidpaintTextRun(RMShapePainter aPntr, RMTextRun aRun) Paints the layout in a given graphics.voidpeerDidChange(RMShape aShape) This notification method is called when any peer is changed.voidpropertyChange(PropertyChangeEvent anEvent) Override to catch XString changes.protected voidresolvePageReferences(ReportOwner aRptOwner, Object userInfo) Re-does the RPG clone to resolve any @Page@ keys (assumed to be present in userInfo).voidOverride to do home-brew layout.protected RMShaperpgShape(ReportOwner anRptOwner, RMShape aParent) Generate report.voidscaleFonts(double aFactor) Resizes all the fonts in text string by given factor.voidsetAlignmentX(RMTypes.AlignX anAlignmentX) Sets the align for all chars.voidsetAlignmentY(RMTypes.AlignY anAlignment) Sets the vertical alignment.voidsetCharSpacing(float aValue) Sets the char spacing for the text string.voidsetCoalesceNewlines(boolean aFlag) Sets whether text should coalesce consecutive newlines in rpgClone.voidsetDateFormat(String dateFormatStr) Applies the given date format.voidsetDrawsSelectionRect(boolean aValue) Sets whether text should always draw at least a light-gray border (useful when editing).voidSets the font for all characters.voidDeprecated.voidsetHeight(double aValue) Override to revalidate.voidsetLineGap(float aHeight) Sets the line gap for all chars.voidsetLineHeightMax(float aHeight) Sets the maximum line height for all chars.voidsetLineHeightMin(float aHeight) Sets the minimum line height for all chars.voidsetLineSpacing(float aHeight) Sets the line spacing for all chars.voidsetLinkedText(RMLinkedText aLinkedText) Sets the linked text for this text (if any).voidSets margin.voidsetMarginString(String aString) Sets the margin as a string.voidsetNegativeInRed(boolean negativeInRed) voidsetNullFormat(String nullFormat) voidsetNumberFormat(String numberFormatStr) Applies the given number format.voidsetOutline(RMXString.Outline anOutline) Sets the Outline for all characters.voidsetPathShape(RMShape aShape) Sets the shape that provides the path for this text to wrap text to.voidsetPerformsWrap(boolean aFlag) Sets whether text should wrap around other shapes that cause wrap.voidsetRadius(float aValue) Overrides rectangle implementation to potentially clear path shape.voidReplaces the current text associated with this RMText with the given String.voidsetTextColor(RMColor aColor) Sets the color of the characters in the XString associated with this RMText.voidsetUnderlined(boolean aFlag) Sets all chars to be underlined.voidsetWidth(double aValue) Override to revalidate.voidsetWraps(byte aValue) Sets the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK).voidsetXString(RMXString xString) Sets the XString associated with this RMText.booleanEditor method - indicates that this shape can be super selected.toString()Standard toString implementation.toXML(RXArchiver anArchiver) XML archival.Methods inherited from class com.inductiveautomation.rm.shape.RMRectShapegetRadiusMethods inherited from class com.inductiveautomation.rm.shape.RMShapeacceptsChildren, acceptsMouse, addBinding, addBinding, addDeepChangeListener, addMouseListener, animUpdate, bounds, childrenSuperSelectImmediately, cloneDeep, contains, convertedPointFromShape, convertedPointToShape, convertedRectFromShape, convertedRectToShape, convertedVectorFromShape, convertedVectorToShape, convertFromShape, convertPathFromShape, convertPathToShape, convertPointFromShape, convertPointToShape, convertRectFromShape, convertRectToShape, convertToShape, convertVectorFromShape, convertVectorToShape, copyShape, deepChange, divideShapeFromEdge, divideShapeFromTop, get, get, getAlignment, getAncestor, getAncestorCount, getAncestorInCommon, getAnimator, getAnimator, getAutosizing, getBestHeight, getBestHeight, getBestWidth, getBestWidth, getBinding, getBinding, getBindingCount, getBindings, getBounds, getBoundsInside, getBoundsMarked, getBoundsMarkedDeep, getChild, getChildAnimator, getChildAnimator, getChildClipShape, getChildCount, getChildren, getClipShape, getColor, getDashArrayString, getDashPhase, getDatasetEntity, getDatasetKey, getDisplayedFill, getDisplayedStroke, getDocument, getEffect, getEventAdapter, getFill, getFormat, getFrame, getFrameHeight, getFrameMaxX, getFrameMaxY, getFrameWidth, getFrameX, getFrameXY, getFrameY, getHeight, getHover, getLayoutInfo, getMaxX, getMaxY, getMinHeight, getMinHeight, getMinWidth, getMinWidth, getName, getOpacity, getOpacityDeep, getPageBreak, getPageBreakMax, getPageBreakPage, getPageBreakPageMax, getPageShape, getParent, getParent, getPrefHeight, getPrefHeight, getPrefWidth, getPrefWidth, getPropertyNameMapped, getPropertyNames, getRoll, getRootShape, getRSS, getScaleX, getScaleY, getShapesToAncestor, getShapesToDescendant, getShapesToShape, getSize, getSkewX, getSkewY, getStroke, getStrokeColor, getStrokeOnTop, getStrokeStyle, getStrokeWidth, getTimeline, getTimeline, getTransform, getTransformFromShape, getTransformInverse, getTransformToShape, getUndoer, getURL, getVisbileBounds, getVisibleBounds, getVisibleBounds, getVisibleBounds, getWidth, getX, getXY, getXYP, getY, height, indexOf, intersects, isAncestor, isAnimProperty, isDescendant, isEditing, isEnabled, isFontSet, isHittable, isLocked, isMinHeightSet, isMinWidthSet, isPrefHeightSet, isPrefWidthSet, isRoot, isRSS, isShowing, isUseFill, isUseStroke, isViewing, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, offsetXY, page, pageMax, paint, paintShapeAll, paintShapeChildren, paintShapeOver, put, removeBinding, removeBinding, removeDeepChangeListener, removeFromParent, removeMouseListener, repaint, repaint, rpgAll, rpgBindings, setAlignment, setAutosizing, setBestHeight, setBestSize, setBounds, setBounds, setColor, setDashArrayString, setDashPhase, setEffect, setEnabled, setFill, setFrame, setFrame, setFrameSize, setFrameX, setFrameXY, setFrameXY, setFrameY, setHover, setLayoutInfo, setLocked, setMinHeight, setMinSize, setMinWidth, setName, setOpacity, setParent, setPrefHeight, setPrefWidth, setRoll, setScaleX, setScaleXY, setScaleY, setShowing, setSize, setSize, setSkewX, setSkewXY, setSkewY, setStroke, setStrokeColor, setStrokeStyle, setStrokeWidth, setTime, setTimeline, setURL, setUseFill, setUseStroke, setVisible, setX, setXY, setXY, setXYP, setY, shapeHidden, shapeShown, undoerDisable, undoerEnable, undoerSetUndoTitle, width, x, yMethods inherited from class com.inductiveautomation.rm.base.RMObjectaddPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChangeMethods inherited from class com.inductiveautomation.rm.base.RMListenerListaddListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
- 
Field Details- 
WRAP_NONEpublic static final byte WRAP_NONE- See Also:
 
- 
WRAP_BASICpublic static final byte WRAP_BASIC- See Also:
 
- 
WRAP_SCALEpublic static final byte WRAP_SCALE- See Also:
 
 
- 
- 
Constructor Details- 
RMTextShapepublic RMTextShape()Creates an empty text instance.
- 
RMTextShapeCreates a text instance initialized with the given RMXString.
- 
RMTextShapeCreates a text instance initialized with the given plain text String.
 
- 
- 
Method Details- 
getXStringReturns the XString associated with this RMText.
- 
setXStringSets the XString associated with this RMText.
- 
createXStringCreates the xstring for this text.
- 
lengthpublic int length()Returns the length, in characters, of the XString associated with this RMText.
- 
getTextReturns the text associated with this RMText as a plain String.
- 
setTextReplaces the current text associated with this RMText with the given String.
- 
getVisibleStartpublic int getVisibleStart()Returns the first character index visible in this text.
- 
getVisibleEndpublic int getVisibleEnd()Returns the last character index visible in this text.
- 
isAllTextVisiblepublic boolean isAllTextVisible()Returns whether all characters can be visibly rendered in text bounds.
- 
getFontReturns the font for char 0.
- 
setFontSets the font for all characters.
- 
setFormatDeprecated.Sets the format for all characters.
- 
getNegativeInRedpublic boolean getNegativeInRed()
- 
setNegativeInRedpublic void setNegativeInRed(boolean negativeInRed) 
- 
getNumberFormat
- 
setNumberFormatApplies the given number format.Does nothing if: - The incoming format is null
- The incoming format is an empty string
- The incoming format is not a valid DecimalFormat
 
- 
getDateFormat
- 
setDateFormatApplies the given date format. If we get null in, the existing format won't change.
- 
getNullFormat
- 
setNullFormat
- 
getTextColorReturns the color of the first character of the xstring associated with this RMText.- Overrides:
- getTextColorin class- RMShape
 
- 
setTextColorSets the color of the characters in the XString associated with this RMText.- Overrides:
- setTextColorin class- RMShape
 
- 
isUnderlinedpublic boolean isUnderlined()Returns if char 0 is underlined.- Overrides:
- isUnderlinedin class- RMShape
 
- 
setUnderlinedpublic void setUnderlined(boolean aFlag) Sets all chars to be underlined.- Overrides:
- setUnderlinedin class- RMShape
 
- 
getOutlineReturns the outline for char 0.- Overrides:
- getOutlinein class- RMShape
 
- 
setOutlineSets the Outline for all characters.- Overrides:
- setOutlinein class- RMShape
 
- 
getAlignmentXReturns the alignment for char 0.- Overrides:
- getAlignmentXin class- RMShape
 
- 
setAlignmentXSets the align for all chars. Because this takes an enum, we won't allow bindings to it.- Overrides:
- setAlignmentXin class- RMShape
 
- 
getAlignStringReturns the alignment as a string, one of: "left", "center" or "right".
- 
getAlignmentYReturns the vertical alignment.- Overrides:
- getAlignmentYin class- RMShape
 
- 
setAlignmentYSets the vertical alignment. Because this takes an enum, we won't allow bindings to it.- Overrides:
- setAlignmentYin class- RMShape
 
- 
getWrapspublic byte getWraps()Returns the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK).
- 
setWrapspublic void setWraps(byte aValue) Sets the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK). No bindings because this takes a byte and no expression function returns a byte.
- 
getPerformsWrappublic boolean getPerformsWrap()Returns whether text should wrap around other shapes that cause wrap.
- 
setPerformsWrappublic void setPerformsWrap(boolean aFlag) Sets whether text should wrap around other shapes that cause wrap.
- 
getCoalesceNewlinespublic boolean getCoalesceNewlines()Returns whether text should coalesce consecutive newlines in rpgClone.
- 
setCoalesceNewlinespublic void setCoalesceNewlines(boolean aFlag) Sets whether text should coalesce consecutive newlines in rpgClone.
- 
getDrawsSelectionRectpublic boolean getDrawsSelectionRect()Returns whether text should always draw at least a light gray border (useful when editing).
- 
setDrawsSelectionRectpublic void setDrawsSelectionRect(boolean aValue) Sets whether text should always draw at least a light-gray border (useful when editing).
- 
getCharSpacingpublic float getCharSpacing()Returns the char spacing at char 0.
- 
setCharSpacingpublic void setCharSpacing(float aValue) Sets the char spacing for the text string.
- 
getLineSpacingpublic float getLineSpacing()Returns the line spacing at char 0.
- 
setLineSpacingpublic void setLineSpacing(float aHeight) Sets the line spacing for all chars.
- 
getLineGappublic float getLineGap()Returns the line gap at char 0.
- 
setLineGappublic void setLineGap(float aHeight) Sets the line gap for all chars.
- 
getLineHeightMinpublic float getLineHeightMin()Returns the minimum line height at char 0.
- 
setLineHeightMinpublic void setLineHeightMin(float aHeight) Sets the minimum line height for all chars.
- 
getLineHeightMaxpublic float getLineHeightMax()Returns the maximum line height at char 0.
- 
setLineHeightMaxpublic void setLineHeightMax(float aHeight) Sets the maximum line height for all chars.
- 
getMarginReturns margin.
- 
setMarginSets margin. Not bindable because it takes Insets.
- 
getMarginDefaultReturns the default margin of the text (top=1, left=2, right=2, bottom=0).
- 
getMarginStringReturns the margin as a string.
- 
setMarginStringSets the margin as a string.
- 
getMarginLeftpublic int getMarginLeft()Returns the left margin of the text (default to 2).
- 
getMarginRightpublic int getMarginRight()Returns the right margin of the text (defaults to 2).
- 
getMarginToppublic int getMarginTop()Returns the top margin of the text (defaults to 1).
- 
getMarginBottompublic int getMarginBottom()Returns the bottom margin of the text (defaults to 0).
- 
setWidthpublic void setWidth(double aValue) Override to revalidate.
- 
setHeightpublic void setHeight(double aValue) Override to revalidate.
- 
getPathReturns the path for this shape (might be PathShape).- Overrides:
- getPathin class- RMRectShape
 
- 
getPathInBoundsOverrides shape implementation to pass through getPathInBounds(inset).- Overrides:
- getPathInBoundsin class- RMShape
 
- 
getPathInBoundsReturns the shape's path scaled to the shape's current bounds.
- 
peerDidChangeThis notification method is called when any peer is changed.
- 
getPathShapeReturns the shape that provides the path for this text to wrap text to.
- 
setPathShapeSets the shape that provides the path for this text to wrap text to.
- 
setRadiuspublic void setRadius(float aValue) Overrides rectangle implementation to potentially clear path shape.- Overrides:
- setRadiusin class- RMRectShape
 
- 
getLinkedTextReturns the linked text for this text (if any).
- 
setLinkedTextSets the linked text for this text (if any).
- 
getTextLayoutReturns a text layout.
- 
createTextLayoutCreates a new layout.
- 
computePrefWidthprotected double computePrefWidth(double aHeight) Override to compute from RMTextLayout.- Overrides:
- computePrefWidthin class- RMShape
 
- 
computePrefHeightprotected double computePrefHeight(double aWidth) Override to compute from RMTextLayout.- Overrides:
- computePrefHeightin class- RMShape
 
- 
scaleFontspublic void scaleFonts(double aFactor) Resizes all the fonts in text string by given factor.
- 
rpgShapeGenerate report.
- 
paginatePaginates this text by creating linked texts to show all text and returns a list of this text and the linked texts.
- 
resolvePageReferencesRe-does the RPG clone to resolve any @Page@ keys (assumed to be present in userInfo).- Overrides:
- resolvePageReferencesin class- RMShape
 
- 
createDivideShapeRemainderCreates a shape suitable for the "remainder" portion of a divideShape call (just a clone by default).- Overrides:
- createDivideShapeRemainderin class- RMShape
 
- 
getMaskPathOverridden from RMShape to provide the outlines of all the glyphs- Overrides:
- getMaskPathin class- RMShape
 
- 
superSelectablepublic boolean superSelectable()Editor method - indicates that this shape can be super selected.- Overrides:
- superSelectablein class- RMShape
 
- 
isStructuredpublic boolean isStructured()Editor method.
- 
paintShapePaints a text shape.- Overrides:
- paintShapein class- RMShape
 
- 
paintShapeBackPaints the text shape background.
- 
paintShapeTextPaints the text shape text.
- 
paintTextRunPaints the layout in a given graphics.
- 
copyTextCopies attributes from given object.
- 
getPropertyNamesReturns the property names for RMShape.- Overrides:
- getPropertyNamesin class- RMShape
 
- 
propertyChangeOverride to catch XString changes.- Specified by:
- propertyChangein interface- PropertyChangeListener
- Overrides:
- propertyChangein class- RMShape
 
- 
revalidatepublic void revalidate()Override to do home-brew layout.
- 
cloneStandard clone implementation.
- 
toXMLXML archival.- Specified by:
- toXMLin interface- Archivable
- Overrides:
- toXMLin class- RMRectShape
 
- 
fromXMLXML unarchival.- Specified by:
- fromXMLin interface- Archivable
- Overrides:
- fromXMLin class- RMRectShape
 
- 
fromXMLFinishXML reference unarchival - to unarchive linked text.
- 
toStringStandard toString implementation.
- 
isDeletablepublic boolean isDeletable()Description copied from class:RMShapeOverride this for shapes (like a table row) that don't don't make sense to delete by themselves.- Overrides:
- isDeletablein class- RMShape
 
- 
getAutosizingDefaultDescription copied from class:RMShapeReturns the autosizing default.- Overrides:
- getAutosizingDefaultin class- RMShape
 
 
-