public class RMTextShape extends RMRectShape
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();
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
Modifier and Type | Field and Description |
---|---|
static byte |
WRAP_BASIC |
static byte |
WRAP_NONE |
static byte |
WRAP_SCALE |
Constructor and Description |
---|
RMTextShape()
Creates an empty text instance.
|
RMTextShape(RMXString string)
Creates a text instance initialized with the given RMXString.
|
RMTextShape(java.lang.String plainText)
Creates a text instance initialized with the given plain text String.
|
Modifier and Type | Method and Description |
---|---|
RMTextShape |
clone()
Standard clone implementation.
|
void |
copyText(RMTextShape aText)
Copies attributes from given object.
|
RMTextLayout |
createTextLayout()
Creates a new layout.
|
java.lang.Object |
fromXML(XMLArchiver anArchiver,
XMLElement anElement)
XML unarchival.
|
void |
fromXMLFinish(XMLArchiver anArchiver,
XMLElement anElement)
XML reference unarchival - to unarchive linked text.
|
RMTypes.AlignX |
getAlignmentX()
Returns the alignment for char 0.
|
RMTypes.AlignY |
getAlignmentY()
Returns the vertical alignment.
|
java.lang.String |
getAlignString()
Returns the alignment as a string, one of: "left", "center" or "right".
|
float |
getCharSpacing()
Returns the char spacing at char 0.
|
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.
|
RMFormat |
getFormat()
Returns the format for char 0.
|
float |
getLineGap()
Returns the line gap at char 0.
|
float |
getLineHeightMax()
Returns the maximum line height at char 0.
|
float |
getLineHeightMin()
Returns the minimum line height at char 0.
|
float |
getLineSpacing()
Returns the line spacing at char 0.
|
RMLinkedText |
getLinkedText()
Returns the linked text for this text (if any).
|
java.awt.Insets |
getMargin()
Returns margin.
|
int |
getMarginBottom()
Returns the bottom margin of the text (defaults to 0).
|
java.awt.Insets |
getMarginDefault()
Returns the default margin of the text (top=1, left=2, right=2, bottom=0).
|
int |
getMarginLeft()
Returns the left margin of the text (default to 2).
|
int |
getMarginRight()
Returns the right margin of the text (defaults to 2).
|
java.lang.String |
getMarginString()
Returns the margin as a string.
|
int |
getMarginTop()
Returns the top margin of the text (defaults to 1).
|
RMPath |
getMaskPath()
Overridden from RMShape to provide the outlines of all the glyphs
|
RMXString.Outline |
getOutline()
Returns the outline for char 0.
|
RMPath |
getPath()
Returns the path for this shape (might be PathShape).
|
RMPath |
getPathInBounds()
Overrides shape implementation to pass through getPathInBounds(inset).
|
RMPath |
getPathInBounds(int anInset)
Returns the shape's path scaled to the shape's current bounds.
|
RMShape |
getPathShape()
Returns the shape that provides the path for this text to wrap text to.
|
boolean |
getPerformsWrap()
Returns whether text should wrap around other shapes that cause wrap.
|
java.lang.String |
getText()
Returns the text associated with this RMText as a plain String.
|
RMColor |
getTextColor()
Returns the color of the first character of the xstring associated with this RMText.
|
RMTextLayout |
getTextLayout()
Returns a text layout.
|
int |
getVisibleEnd()
Returns the last character index visible in this text.
|
int |
getVisibleStart()
Returns the first character index visible in this text.
|
byte |
getWraps()
Returns the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK).
|
RMXString |
getXString()
Returns the XString associated with this RMText.
|
boolean |
isAllTextVisible()
Returns whether all characters can be visibly rendered in text bounds.
|
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.
|
void |
paintShape(RMShapePainter aPntr)
Paints a text shape.
|
void |
paintShapeBack(RMShapePainter aPntr)
Paints the text shape background.
|
void |
paintShapeText(RMShapePainter aPntr)
Paints the text shape text.
|
void |
peerDidChange(RMShape aShape)
This notification method is called when any peer is changed.
|
void |
propertyChange(java.beans.PropertyChangeEvent anEvent)
Override to catch XString changes.
|
void |
revalidate()
Override to do home-brew layout.
|
void |
scaleFonts(double aFactor)
Resizes all the font's in text string by given factor.
|
void |
setAlignmentX(RMTypes.AlignX anAlignmentX)
Sets the align for all chars.
|
void |
setAlignmentY(RMTypes.AlignY anAlignment)
Sets the vertical alignment.
|
void |
setCharSpacing(float aValue)
Sets the char spacing for the text string.
|
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 aFont)
Sets the font for all characters.
|
void |
setFormat(RMFormat aFormat)
Sets the format for all characters.
|
void |
setHeight(double aValue)
Override to revalidate.
|
void |
setLineGap(float aHeight)
Sets the line gap for all chars.
|
void |
setLineHeightMax(float aHeight)
Sets the maximum line height for all chars.
|
void |
setLineHeightMin(float aHeight)
Sets the minimum line height for all chars.
|
void |
setLineSpacing(float aHeight)
Sets the line spacing for all chars.
|
void |
setLinkedText(RMLinkedText aLinkedText)
Sets the linked text for this text (if any).
|
void |
setMargin(java.awt.Insets aMargin)
Sets margin.
|
void |
setMarginString(java.lang.String aString)
Sets the margin as a string.
|
void |
setOutline(RMXString.Outline anOutline)
Sets the Outline for all characters.
|
void |
setPathShape(RMShape aShape)
Sets the shape that provides the path for this text to wrap text to.
|
void |
setPerformsWrap(boolean aFlag)
Sets whether text should wrap around other shapes that cause wrap.
|
void |
setRadius(float aValue)
Overrides rectangle implementation to potentially clear path shape.
|
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 |
setWidth(double aValue)
Override to revalidate.
|
void |
setWraps(byte aValue)
Sets the wrapping behavior for over-filled rpgCloned text (NONE, WRAP, SHRINK).
|
void |
setXString(RMXString xString)
Sets the XString associated with this RMText.
|
boolean |
superSelectable()
Editor method - indicates that this shape can be super selected.
|
java.lang.String |
toString()
Standard toSring implementation.
|
XMLElement |
toXML(XMLArchiver anArchiver)
XML archival.
|
getRadius
acceptsChildren, acceptsMouse, addBinding, addBinding, addDeepChangeListener, addMouseListener, animUpdate, bounds, childrenSuperSelectImmediately, cloneDeep, contains, convertedPointFromShape, convertedPointToShape, convertedRectFromShape, convertedRectToShape, convertFromShape, convertPathFromShape, convertPathToShape, convertPointFromShape, convertPointToShape, convertRectFromShape, convertRectToShape, convertToShape, convertVectorFromShape, convertVectorToShape, copyShape, deepChange, divideShapeFromEdge, divideShapeFromTop, get, get, getAlignment, getAncestor, getAncestorCount, getAncestorInCommon, getAnimator, getAnimator, getAutosizing, getAutosizingDefault, getBestHeight, getBestHeight, getBestWidth, getBestWidth, getBinding, getBinding, getBindingCount, getBounds, getBoundsInside, getBoundsMarked, getBoundsMarkedDeep, getChild, getChildAnimator, getChildAnimator, getChildCount, getChildren, getClipShape, getColor, getDatasetEntity, getDatasetKey, getDocument, getEffect, getEventAdapter, getFill, 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, getScaleX, getScaleY, getShapesToAncestor, getShapesToDescendant, getShapesToShape, getSize, getSkewX, getSkewY, getStroke, getStrokeColor, getStrokeOnTop, getStrokeWidth, getTimeline, getTimeline, getTransform, getTransformFromShape, getTransformInverse, getTransformToShape, getUndoer, getURL, getWidth, getX, getXY, getXYP, getY, height, indexOf, intersects, isAncestor, isAnimProperty, isDescendant, isEditing, isEnabled, isFontSet, isHittable, isLocked, isMinHeightSet, isMinWidthSet, isPrefHeightSet, isPrefWidthSet, isRoot, isRSS, isViewing, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, offsetXY, page, pageMax, paint, paintShapeAll, paintShapeChildren, paintShapeOver, put, removeBinding, removeBinding, removeDeepChangeListener, removeFromParent, removeMouseListener, repaint, rpgAll, rpgBindings, setAlignment, setAutosizing, setBestHeight, setBestSize, setBounds, setBounds, setColor, 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, setSize, setSize, setSkewX, setSkewXY, setSkewY, setStroke, setStrokeColor, setStrokeWidth, setTime, setURL, setVisible, setX, setXY, setXY, setXYP, setY, undoerDisable, undoerEnable, undoerSetUndoTitle, width, x, y
public static final byte WRAP_NONE
public static final byte WRAP_BASIC
public static final byte WRAP_SCALE
public RMTextShape()
public RMTextShape(RMXString string)
public RMTextShape(java.lang.String plainText)
public RMXString getXString()
public void setXString(RMXString xString)
public int length()
public java.lang.String getText()
public void setText(java.lang.String aString)
public int getVisibleStart()
public int getVisibleEnd()
public boolean isAllTextVisible()
public void setFont(RMFont aFont)
public RMFormat getFormat()
public void setFormat(RMFormat aFormat)
public RMColor getTextColor()
getTextColor
in class RMShape
public void setTextColor(RMColor aColor)
setTextColor
in class RMShape
public boolean isUnderlined()
isUnderlined
in class RMShape
public void setUnderlined(boolean aFlag)
setUnderlined
in class RMShape
public RMXString.Outline getOutline()
getOutline
in class RMShape
public void setOutline(RMXString.Outline anOutline)
setOutline
in class RMShape
public RMTypes.AlignX getAlignmentX()
getAlignmentX
in class RMShape
public void setAlignmentX(RMTypes.AlignX anAlignmentX)
setAlignmentX
in class RMShape
public java.lang.String getAlignString()
public RMTypes.AlignY getAlignmentY()
getAlignmentY
in class RMShape
public void setAlignmentY(RMTypes.AlignY anAlignment)
setAlignmentY
in class RMShape
public byte getWraps()
public void setWraps(byte aValue)
public boolean getPerformsWrap()
public void setPerformsWrap(boolean aFlag)
public boolean getCoalesceNewlines()
public void setCoalesceNewlines(boolean aFlag)
public boolean getDrawsSelectionRect()
public void setDrawsSelectionRect(boolean aValue)
public float getCharSpacing()
public void setCharSpacing(float aValue)
public float getLineSpacing()
public void setLineSpacing(float aHeight)
public float getLineGap()
public void setLineGap(float aHeight)
public float getLineHeightMin()
public void setLineHeightMin(float aHeight)
public float getLineHeightMax()
public void setLineHeightMax(float aHeight)
public java.awt.Insets getMargin()
public void setMargin(java.awt.Insets aMargin)
public java.awt.Insets getMarginDefault()
public java.lang.String getMarginString()
public void setMarginString(java.lang.String aString)
public int getMarginLeft()
public int getMarginRight()
public int getMarginTop()
public int getMarginBottom()
public void setWidth(double aValue)
public void setHeight(double aValue)
public RMPath getPath()
getPath
in class RMRectShape
public RMPath getPathInBounds()
getPathInBounds
in class RMShape
public RMPath getPathInBounds(int anInset)
public void peerDidChange(RMShape aShape)
public RMShape getPathShape()
public void setPathShape(RMShape aShape)
public void setRadius(float aValue)
setRadius
in class RMRectShape
public RMLinkedText getLinkedText()
public void setLinkedText(RMLinkedText aLinkedText)
public RMTextLayout getTextLayout()
public RMTextLayout createTextLayout()
public void scaleFonts(double aFactor)
public RMPath getMaskPath()
getMaskPath
in class RMShape
public boolean superSelectable()
superSelectable
in class RMShape
public boolean isStructured()
public void paintShape(RMShapePainter aPntr)
paintShape
in class RMShape
public void paintShapeBack(RMShapePainter aPntr)
public void paintShapeText(RMShapePainter aPntr)
public void copyText(RMTextShape aText)
public void propertyChange(java.beans.PropertyChangeEvent anEvent)
propertyChange
in interface java.beans.PropertyChangeListener
propertyChange
in class RMShape
public void revalidate()
public RMTextShape clone()
public XMLElement toXML(XMLArchiver anArchiver)
toXML
in class RMRectShape
public java.lang.Object fromXML(XMLArchiver anArchiver, XMLElement anElement)
fromXML
in class RMRectShape
public void fromXMLFinish(XMLArchiver anArchiver, XMLElement anElement)