|
ReportMill 7.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.reportmill.foundation.RMObject
com.reportmill.shape.RMShape
com.reportmill.shape.RMRectangle
com.reportmill.shape.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 programatically 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();
| Field Summary | |
static byte |
ALIGN_BOTTOM
|
static byte |
ALIGN_CENTER
|
static byte |
ALIGN_LEFT
|
static byte |
ALIGN_MIDDLE
|
static byte |
ALIGN_RIGHT
|
static byte |
ALIGN_TOP
|
static int |
BREAK_GLYPH
|
static int |
BREAK_LINE
|
static int |
BREAK_WORD
|
static byte |
WRAP_BASIC
|
static byte |
WRAP_NONE
|
static byte |
WRAP_SCALE
|
| Fields inherited from class com.reportmill.shape.RMRectangle |
_radius |
| Fields inherited from class com.reportmill.shape.RMShape |
HandleMaxXMaxY, HandleMaxXMidY, HandleMaxXMinY, HandleMidXMaxY, HandleMidXMinY, HandleMinXMaxY, HandleMinXMidY, HandleMinXMinY, HandleWidth |
| Constructor Summary | |
RMText()
Creates an empty text instance. |
|
RMText(RMXString string)
Creates a text instance initialized with the given RMXString. |
|
RMText(java.lang.String plainText)
Creates a text instance initialized with the given plain text String. |
|
| Method Summary | |
boolean |
acceptsEvents()
Editor method. |
boolean |
acceptsFirstEvent()
Editor method. |
com.reportmill.text.RMTextLayout |
beginTextLayout()
Returns an RMTextLayout, configured with the current RMText. |
java.lang.Object |
clone()
Standard clone implementation. |
void |
copy(com.reportmill.foundation.RMObject anObj)
Copies attributes from given object. |
int |
endIndex()
Returns the last character index visible in this text. |
boolean |
equals(java.lang.Object anObj)
Standard equals implementation. |
java.lang.Object |
fromXML(com.ribs.RXArchiver anArchiver,
com.ribs.RXElement anElement)
XML Unarchival. |
byte |
getAlign()
Returns the alignment for char 0. |
java.lang.String |
getAlignString()
Returns the alignment as a string, one of: "left", "center" or "right". |
RMRect |
getBoundsFromTextBounds(RMRect aRect)
Returns bounds from given text bounds, adjusted to account for text margins. |
boolean |
getCoalesceNewlines()
Returns whether text should coalesce consecutive newlines in rpgClone. |
boolean |
getDrawsSelectionRect()
Returns whether text should always draw at least a light gray border (useful when editing). |
RMFont |
getFont()
Returns the font for char 0. |
float |
getFontScale()
Returns the scale to apply to all fonts in text's XString (defaults to 1). |
RMFormat |
getFormat()
Returns the format for char 0. |
float |
getHeightToFit()
Returns the ideal height for this RMText. |
float |
getHeightToFit(boolean includeFinalEmptyLine)
Returns the ideal height for this RMText. |
void |
getHeightToFitReset()
For efficiency, RMText's getHeightToFit() caches the results after calculating the ideal height. |
float |
getMarginBottom()
Returns the bottom margin of the text (defaults to 0). |
float |
getMarginLeft()
Returns the left margin of the text (default to 2). |
float |
getMarginRight()
Returns the right margin of the text (defaults to 2). |
float |
getMarginTop()
Returns the top margin of the text (defaults to 0). |
float |
getMaxLineHeight()
Returns the maximum line height at char 0. |
float |
getMinLineHeight()
Returns the minimum line height at char 0. |
RMXString.Outline |
getOutline()
Returns the outline for char 0. |
RMPolygon |
getPolygonForFrag(com.reportmill.text.RMTextFrag aFrag)
|
java.lang.String |
getText()
Returns the text associated with this RMText as a plain String. |
RMRect |
getTextBounds()
Returns the actual bounding rect of the text (currently just inset 2 pixels on either side). |
RMColor |
getTextColor()
Returns the color of the first character of the xstring associated with this RMText. |
RMPoint |
getTextOrigin()
Returns the point inside this text where the first character is placed. |
byte |
getVAlign()
Returns the vertical alignment. |
java.lang.String |
getVAlignString()
Returns the vertical alignment as a string, one of: "top", "middle" or "bottom". |
float |
getWidthToFit()
Returns the ideal width for this RMText. |
byte |
getWraps()
Returns the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK). |
RMXString |
getXString()
Returns the XString associated with this RMText. |
RMXString |
getXString(boolean create)
Returns the XString associated with this RMText, creating it if needed |
int |
handleCount()
Editor method - returns handle count. |
RMRect |
handleRect(int handle,
boolean isSuperSelected)
Editor method - returns handle rect. |
java.lang.Object |
initWithArchiver(com.reportmill.foundation.RMArchiver anArchiver)
Legacy unarchival. |
boolean |
isStructured()
Editor method. |
boolean |
isUnderlined()
Returns if char 0 is underlined. |
int |
length()
Returns the length, in characters, of the XString associated with this RMText. |
boolean |
renderedAll()
Returns whether all characters were rendered. |
void |
resolvePageReferences(com.reportmill.foundation.ReportMill reportMill,
java.lang.Object userInfo)
Re-does the RPG clone to resolve any @Page@ keys (assumed to be present in userInfo). |
RMShape |
rpgClone(com.reportmill.foundation.ReportMill reportMill)
This method clones the RMText, performing subtition on the XString. |
void |
rpgClonePreprocess(com.reportmill.foundation.ReportMill reportMill)
This standard rpgClone hook allows texts set to wrap to perform the wrap. |
void |
scaleTextToFit()
|
void |
setAlign(int align)
Sets the align for all chars. |
void |
setCoalesceNewlines(boolean aFlag)
Sets whether text should coalesce consecutive newlines in rpgClone. |
void |
setDrawsSelectionRect(boolean aValue)
Sets whether text should always draw at least a light-gray border (useful when editing). |
void |
setFont(RMFont font)
Sets the font for all characters. |
void |
setFontScale(float aFactor)
Sets the scale to apply to all fonts in text's XString. |
void |
setFormat(RMFormat f)
Sets the format for all characters. |
void |
setMaxLineHeight(float aHeight)
Sets the maximum line height for all chars. |
void |
setMinLineHeight(float aHeight)
Sets the minimum line height for all chars. |
void |
setOutline(RMXString.Outline anOutline)
Sets the Outline for all characters. |
void |
setText(RMXString s)
Sets the XString associated with this RMText. |
void |
setText(java.lang.String aString)
Replaces the current text associated with this RMText with the given String. |
void |
setTextColor(RMColor aColor)
Sets the color of the characters in the XString associated with this RMText. |
void |
setUnderlined(boolean aFlag)
Sets all chars to be underlined. |
void |
setVAlign(byte anAlignment)
Sets the vertical alginment. |
void |
setWraps(byte aValue)
Sets the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK). |
void |
setXString(RMXString s)
Sets the XString associated with this RMText. |
int |
startIndex()
Returns the first character index visible in this text. |
java.lang.String |
toString()
Standard toSring implementation. |
com.ribs.RXElement |
toXML(com.ribs.RXArchiver anArchiver)
XML Archival. |
RMShape |
turnToChars(boolean inPlace)
Returns a group shape with an RMText shape for each glyph in the text. |
RMShape |
turnToPath(boolean inPlace)
Returns an RMPolygon shape with the glyph path for the chars in this text. |
| Methods inherited from class com.reportmill.shape.RMRectangle |
getPath, getRadius, setRadius |
| Methods inherited from class com.reportmill.foundation.RMObject |
archiverClassName, didUndo, getAnimAttribute, getClassNameShort |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final byte ALIGN_LEFT
public static final byte ALIGN_CENTER
public static final byte ALIGN_RIGHT
public static final byte ALIGN_TOP
public static final byte ALIGN_MIDDLE
public static final byte ALIGN_BOTTOM
public static final byte WRAP_NONE
public static final byte WRAP_BASIC
public static final byte WRAP_SCALE
public static final int BREAK_GLYPH
public static final int BREAK_WORD
public static final int BREAK_LINE
| Constructor Detail |
public RMText()
public RMText(RMXString string)
public RMText(java.lang.String plainText)
| Method Detail |
public RMXString getXString()
public RMXString getXString(boolean create)
public void setXString(RMXString s)
public int length()
public java.lang.String getText()
public void setText(java.lang.String aString)
public void setText(RMXString s)
public RMColor getTextColor()
getTextColor in class RMShapepublic void setTextColor(RMColor aColor)
setTextColor in class RMShapepublic RMFont getFont()
getFont in class RMShapepublic void setFont(RMFont font)
setFont in class RMShapepublic RMFormat getFormat()
getFormat in class RMShapepublic void setFormat(RMFormat f)
setFormat in class RMShapepublic boolean isUnderlined()
isUnderlined in class RMShapepublic void setUnderlined(boolean aFlag)
setUnderlined in class RMShapepublic RMXString.Outline getOutline()
getOutline in class RMShapepublic void setOutline(RMXString.Outline anOutline)
setOutline in class RMShapepublic byte getAlign()
public void setAlign(int align)
public java.lang.String getAlignString()
public byte getVAlign()
public void setVAlign(byte anAlignment)
public java.lang.String getVAlignString()
public boolean getDrawsSelectionRect()
public void setDrawsSelectionRect(boolean aValue)
public boolean getCoalesceNewlines()
public void setCoalesceNewlines(boolean aFlag)
public byte getWraps()
public void setWraps(byte aValue)
public float getMinLineHeight()
public void setMinLineHeight(float aHeight)
public float getMaxLineHeight()
public void setMaxLineHeight(float aHeight)
public RMPoint getTextOrigin()
public float getMarginLeft()
public float getMarginRight()
public float getMarginTop()
public float getMarginBottom()
public RMRect getTextBounds()
public RMRect getBoundsFromTextBounds(RMRect aRect)
public float getWidthToFit()
getWidthToFit in class RMShapepublic float getHeightToFit()
getHeightToFit in class RMShapepublic float getHeightToFit(boolean includeFinalEmptyLine)
public void getHeightToFitReset()
public com.reportmill.text.RMTextLayout beginTextLayout()
public int startIndex()
public int endIndex()
public boolean renderedAll()
public void scaleTextToFit()
public float getFontScale()
public void setFontScale(float aFactor)
public RMShape rpgClone(com.reportmill.foundation.ReportMill reportMill)
rpgClone in class RMShapepublic void rpgClonePreprocess(com.reportmill.foundation.ReportMill reportMill)
rpgClonePreprocess in class RMShape
public void resolvePageReferences(com.reportmill.foundation.ReportMill reportMill,
java.lang.Object userInfo)
resolvePageReferences in class RMShapepublic java.lang.String toString()
toString in class RMShapepublic RMShape turnToChars(boolean inPlace)
public RMShape turnToPath(boolean inPlace)
public RMPolygon getPolygonForFrag(com.reportmill.text.RMTextFrag aFrag)
public boolean acceptsEvents()
acceptsEvents in class RMShapepublic boolean acceptsFirstEvent()
acceptsFirstEvent in class RMShapepublic boolean isStructured()
public int handleCount()
handleCount in class RMShape
public RMRect handleRect(int handle,
boolean isSuperSelected)
handleRect in class RMShapepublic java.lang.Object clone()
clone in class RMShapepublic boolean equals(java.lang.Object anObj)
equals in class RMRectanglepublic void copy(com.reportmill.foundation.RMObject anObj)
copy in class RMRectanglepublic java.lang.Object initWithArchiver(com.reportmill.foundation.RMArchiver anArchiver)
initWithArchiver in interface com.reportmill.foundation.RMArchiver.ArchivinginitWithArchiver in class RMRectanglepublic com.ribs.RXElement toXML(com.ribs.RXArchiver anArchiver)
toXML in class RMRectangle
public java.lang.Object fromXML(com.ribs.RXArchiver anArchiver,
com.ribs.RXElement anElement)
fromXML in class RMRectangle
|
ReportMill 7.0 API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||