public class TextLine extends TextRect implements java.lang.CharSequence, TextTypes
TextTypes.TabType
RMTypes.Align, RMTypes.AlignX, RMTypes.AlignY
Modifier and Type | Field and Description |
---|---|
static char |
TAB_CENTER |
static char |
TAB_DECIMAL |
static char |
TAB_LEFT |
static char |
TAB_RIGHT |
TEXT_CHAR_SPACING, TEXT_COLOR, TEXT_FONT, TEXT_FORMAT, TEXT_LINK, TEXT_OUTLINE, TEXT_SCRIPTING, TEXT_UNDERLINE
Constructor and Description |
---|
TextLine()
Creates a new TextLine.
|
Modifier and Type | Method and Description |
---|---|
void |
addChars(java.lang.CharSequence theChars,
TextStyle theStyle,
int anIndex)
Adds characters with attributes to this line at given index.
|
void |
addRun(TextRun aRun,
int anIndex)
Adds a run to line.
|
protected TextRun |
addRun(TextStyle theStyle,
int anIndex)
Adds a new run at given index.
|
char |
charAt(int anIndex)
Returns the char value at the specified index.
|
TextLine |
clone()
Standard clone implementation.
|
protected TextRun |
createRun()
Creates a new run.
|
protected java.util.List |
createTokens()
Returns the tokens for this line.
|
RMTypes.AlignX |
getAlignX()
Returns the alignment associated with this paragraph.
|
double |
getBaselineY()
Returns the y position for this line (in same coords as the layout frame).
|
int |
getCharIndex(double anX)
Returns the character index for the given x/y point.
|
int |
getEnd()
Returns the end char index of this line in text.
|
int |
getIndex()
Returns the index of this line in text.
|
char |
getLastChar()
Returns the last char.
|
float |
getLeftIndent()
Returns the left side indentation of this paragraph.
|
float |
getLeftIndentFirst()
Returns the left side indentation of the first line in this paragraph (this can be set different than successive
lines).
|
double |
getLineAdvance()
Returns the vertical distance for any line below this line.
|
float |
getLineGap()
Returns additional line spacing expressed as a constant amount in points.
|
float |
getLineHeightMax()
Returns the maximum line height in printer points associated with this paragraph.
|
float |
getLineHeightMin()
Returns the minimum line height in printer points associated with this paragraph.
|
float |
getLineSpacing()
Returns the spacing of lines expressed as a factor of a given line's height.
|
double |
getMaxAscent()
Returns the max ascent of the chars in this line.
|
TextLine |
getNextLine()
Returns the next line, if available.
|
float |
getParagraphSpacing()
Returns the spacing between paragraphs in printer points associated with this paragraph.
|
TextLine |
getPreviousLine()
Returns the previous line if available.
|
float |
getRightIndent()
Returns the right side indentation of this paragraph.
|
TextRun |
getRun(int anIndex)
Returns the individual run at given index.
|
TextRun |
getRunAt(int anIndex)
Returns the head run for the line.
|
int |
getRunCount()
Returns the number of runs for this line.
|
TextRun |
getRunFor(int anIndex)
Returns the run for the given character index or last run if at end of line.
|
TextRun |
getRunLast()
Returns the last run.
|
int |
getStart()
Returns the start char index of this line in text.
|
java.lang.String |
getString()
Returns the string for the line.
|
float |
getTab(int anIndex)
Returns the specific tab value for the given index in printer points.
|
int |
getTabCount()
Returns the number of tabs associated with this paragraph.
|
int |
getTabIndex(float aLocation)
Returns the tab index for the given location.
|
float[] |
getTabs()
Returns the raw tab array
|
java.lang.String |
getTabsString()
Returns the values of all the tabs associated with this paragraph as a comma separated string.
|
char |
getTabType(int anIndex)
Returns the type of tab at the given index.
|
char[] |
getTabTypes()
Returns the raw tab type array
|
Text |
getText()
Returns the text.
|
TextToken |
getToken(int anIndex)
Returns the individual token at given index.
|
TextToken |
getTokenAt(int anIndex)
Returns the token at character index.
|
int |
getTokenCount()
Returns the number of tokens.
|
TextToken |
getTokenForPointX(double anX)
Returns the token at index.
|
java.util.List<TextToken> |
getTokens()
Returns the tokens for this line.
|
double |
getX()
Returns the line x.
|
double |
getXForChar(int anIndex)
Returns the x coord for the given character index.
|
double |
getY()
Returns the line y.
|
void |
invalidate()
Invalidates this line starting at given run.
|
boolean |
isLastCharNewline()
Returns whether run ends with newline.
|
boolean |
isLastCharWhiteSpace()
Returns whether line ends with space.
|
protected void |
join(TextLine aLine)
Joins the given line to the end of this line.
|
int |
length()
Returns the length of this text line.
|
void |
removeChars(int aStart,
int anEnd)
Removes characters in given range.
|
TextRun |
removeRun(int anIndex)
Removes a run at given index.
|
int |
removeRun(TextRun aRun)
Removes the given run.
|
void |
setAlignX(RMTypes.AlignX anAlign)
Sets the alignment associated with this paragraph.
|
void |
setAttribute(java.lang.String aKey,
java.lang.Object aValue,
int aStart,
int anEnd)
Sets a given attribute to a given value for a given range.
|
void |
setLineGap(float aGap)
Sets additional line spacing expressed as a constant amount in points.
|
void |
setLineHeightMax(float aValue)
Sets the maximum line height in printer points associated with this paragraph.
|
void |
setLineHeightMin(float aValue)
Sets the minimum line height in printer points associated with this paragraph.
|
void |
setLineSpacing(float aSpacing)
Sets the spacing of lines expressed as a factor of a given line's height.
|
void |
setParagraphSpacing(float aValue)
Returns the spacing between paragraphs in printer points associated with this paragraph.
|
void |
setTabsString(java.lang.String aString)
Sets the value of tabs from the given tabs string.
|
protected TextLine |
split(int anIndex)
Splits the line at given index in line.
|
java.lang.CharSequence |
subSequence(int aStart,
int anEnd)
Returns a new char sequence that is a subsequence of this sequence.
|
java.lang.String |
toString()
Standard toString implementation.
|
protected void |
updateRuns(int aRunIndex)
Updates length due to change in given run.
|
void |
validate()
Validates this line.
|
getHeight, getMaxX, getMaxY, getWidth, setHeight, setRect, setSize, setWidth, setX, setY
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
addListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
public static final char TAB_LEFT
public static final char TAB_RIGHT
public static final char TAB_CENTER
public static final char TAB_DECIMAL
public Text getText()
public int getIndex()
public int getStart()
public int getEnd()
public int length()
length
in interface java.lang.CharSequence
public char charAt(int anIndex)
charAt
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int aStart, int anEnd)
subSequence
in interface java.lang.CharSequence
public java.lang.String getString()
public void addChars(java.lang.CharSequence theChars, TextStyle theStyle, int anIndex)
public void removeChars(int aStart, int anEnd)
public void setAttribute(java.lang.String aKey, java.lang.Object aValue, int aStart, int anEnd)
public int getRunCount()
public TextRun getRun(int anIndex)
protected TextRun createRun()
public void addRun(TextRun aRun, int anIndex)
public TextRun removeRun(int anIndex)
public int removeRun(TextRun aRun)
public TextRun getRunLast()
public TextRun getRunAt(int anIndex)
public TextRun getRunFor(int anIndex)
protected void updateRuns(int aRunIndex)
public void invalidate()
public void validate()
public RMTypes.AlignX getAlignX()
public void setAlignX(RMTypes.AlignX anAlign)
public float getLeftIndent()
public float getLeftIndentFirst()
public float getRightIndent()
public float getLineSpacing()
public void setLineSpacing(float aSpacing)
public float getLineGap()
public void setLineGap(float aGap)
public float getLineHeightMin()
public void setLineHeightMin(float aValue)
public float getLineHeightMax()
public void setLineHeightMax(float aValue)
public float getParagraphSpacing()
public void setParagraphSpacing(float aValue)
public int getTabCount()
public float getTab(int anIndex)
public char getTabType(int anIndex)
public float[] getTabs()
public char[] getTabTypes()
public int getTabIndex(float aLocation)
public java.lang.String getTabsString()
public void setTabsString(java.lang.String aString)
public int getTokenCount()
public TextToken getToken(int anIndex)
public java.util.List<TextToken> getTokens()
protected java.util.List createTokens()
public double getBaselineY()
public double getMaxAscent()
public double getLineAdvance()
public char getLastChar()
public boolean isLastCharWhiteSpace()
public boolean isLastCharNewline()
public TextToken getTokenAt(int anIndex)
public TextToken getTokenForPointX(double anX)
public int getCharIndex(double anX)
public double getXForChar(int anIndex)
public TextLine getPreviousLine()
public TextLine getNextLine()
protected TextLine split(int anIndex)
protected void join(TextLine aLine)
public TextLine clone()
clone
in class RMListenerList