public class TextLines
extends java.lang.Object
implements java.io.Serializable
TextLines class implements an information of the lines
into which the rich text is composed. This class is a super class of the
TextLayout class. An instance of this class can not be
created outside this package.TextLayout,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected int |
baseline
The baseline of all lines.
|
protected VArray |
baselines
The array for the baseline of the line.
|
protected int |
layoutHeight
The layout height.
|
protected VArray |
lineBegins
The array for the beginning index of the line.
|
protected int |
lineHeight
The height of all lines.
|
protected VArray |
lineTops
The array for the top position of the line.
|
protected VArray |
remainWidths
The array for the remaining width of the line.
|
protected RichText |
richText
The rich text to be composed into lines.
|
protected RichTextStyle |
rtStyle
The style for the rich text.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected void |
append(TextLineInfo lineInfo)
Appends the line described in the specified text line information
to this text lines.
|
protected void |
append(TextLines textLines)
Appends the specified text lines to this text lines.
|
protected void |
assert(boolean b)
Asserts the given boolean to be
true. |
protected void |
changeRemainWidths(int diff)
Changes the remaining widths of this text lines with the
specified difference of the layout width.
|
protected java.awt.Dimension |
doLayoutForEmpty(int width,
int lineWrap)
Lays out the empty text lines with the specified width.
|
protected int |
duplicateLastLine(int width,
int lineTop,
boolean endWithBreak)
Duplicates the last line, with the specified length of the text,
layout width, the paragraph style of the last line, and flag
indicating that the last line is ending with the line break character.
|
int |
getBaselineAt(int lineIndex)
Returns the baseline of the line at the specified index.
|
protected TextPositionInfo |
getIncompleteTextPositionAt(int textIndex,
int lineIndex)
Returns the incomplete text position information from the specified
text index and line index.
|
protected TextPositionInfo |
getIncompleteTextPositionNearby(TextPositionInfo posInfo,
int textIndex)
Returns the incomplete text position information nearby the
specfied text position information at the specified index of the
text.
|
protected TextPositionInfo |
getIncompleteTextPositionNearby(TextPositionInfo posInfo,
java.awt.Point point)
Returns the incomplete text position information nearby the
specfied text position information at the specified location.
|
int |
getLineBeginAt(int lineIndex)
Returns the beginning index of the line at the specified index.
|
int |
getLineCount()
Returns the number of the lines in this text lines.
|
int |
getLineEndAt(int lineIndex)
Returns the ending index of the line at the specified index.
|
int |
getLineIndexNearby(TextPositionInfo posInfo,
int textIndex)
Returns the line index nearby the specfied text position information
at the specified index of the text.
|
protected int |
getLineIndexNearby(TextPositionInfo posInfo,
int textIndex,
int textLength)
Returns the line index nearby the specfied text position information
at the specified index of the text.
|
int |
getLineIndexNearby(TextPositionInfo posInfo,
java.awt.Point point)
Returns the line index nearby the specfied text position information
at the specified location.
|
int |
getLineSkipAt(int lineIndex)
Returns the line skip space at the specified line index.
|
int |
getLineTopAt(int lineIndex)
Returns the top position of the line at the specified index.
|
int |
getRemainWidthAt(int lineIndex)
Returns the remaining width of the line at the specified index.
|
RichText |
getRichText()
Returns the rich text to be composed into lines.
|
RichTextStyle |
getRichTextStyle()
Returns the rich text style of this text lines.
|
Text |
getText()
Returns the text to be composed into lines.
|
TextLineInfo |
getTextLineAt(int lineIndex)
Returns the text line information for the line at the specified
line index.
|
TextLineInfo |
getTextLineInto(int lineIndex,
TextLineInfo lineInfo)
Sets the text line information for the line at the specified line
index into the specified text line information object, and
returns the text line information object set.
|
TextPositionInfo |
getTextPositionAtLineBegin(int lineIndex)
Returns the text position information at the beginning of the line
at the specified line index.
|
protected void |
invalidateLines()
Invalidate lines in this text lines.
|
protected boolean |
isParagraphMark(int lineBegin)
Checks if the encoded beginning index of the line is marked as
a paragraph end.
|
boolean |
isParagraphMarkAt(int lineIndex)
Checks if the line at the specified index is a paragraph end.
|
boolean |
isValid()
Checks if the text lines has a valid layout.
|
protected void |
markLineAt(int lineIndex)
Marks the line at the specified index as a paragraph end.
|
protected int |
markLineBegin(int lineBegin,
boolean isParagraphMark)
Encodes the specified beginning index of the line so that it is
marked as a paragraph end or not, according to the specified boolean.
|
void |
printDebugInfo()
Prints the debbuging information to the
System.out. |
protected int |
reComputeRemainWidths(int width)
Recomputes the remaining widths of this text lines with the
specified layout width.
|
protected void |
replace(int begin,
int end,
TextLines textLines)
Replace the lines of this text lines with the specified text lines.
|
protected TextLines |
sublines(int beginIndex,
int endIndex)
Returns a new text lines that is a sublines of this text lines.
|
protected void |
unmarkLineAt(int lineIndex)
Unmarks the line at the specified index as no paragraph end.
|
protected int |
unmarkLineBegin(int lineBegin)
Decodes the specified encoded beginning index of the line to
the beginning index of the line.
|
protected void |
validateLines()
Validate lines in this text lines.
|
protected RichText richText
protected RichTextStyle rtStyle
protected int layoutHeight
protected VArray lineBegins
protected VArray remainWidths
protected VArray baselines
rtStyle.variableLineHeight
is true.protected VArray lineTops
rtStyle.variableLineHeight
is true.protected int lineHeight
rtStyle.variableLineHeight
is false.protected int baseline
rtStyle.variableLineHeight
is false.public final Text getText()
public final RichText getRichText()
public final RichTextStyle getRichTextStyle()
public final int getLineCount()
public final int getLineBeginAt(int lineIndex)
public final int getLineEndAt(int lineIndex)
public final boolean isParagraphMarkAt(int lineIndex)
public final int getRemainWidthAt(int lineIndex)
public final int getLineSkipAt(int lineIndex)
public final int getBaselineAt(int lineIndex)
public final int getLineTopAt(int lineIndex)
public boolean isValid()
protected void validateLines()
protected void invalidateLines()
protected final void markLineAt(int lineIndex)
protected final void unmarkLineAt(int lineIndex)
public final TextLineInfo getTextLineAt(int lineIndex)
public final TextLineInfo getTextLineInto(int lineIndex, TextLineInfo lineInfo)
public final TextPositionInfo getTextPositionAtLineBegin(int lineIndex)
lineIndex - the line index.protected final TextPositionInfo getIncompleteTextPositionAt(int textIndex, int lineIndex)
protected final void append(TextLineInfo lineInfo)
protected final void append(TextLines textLines)
protected final void replace(int begin,
int end,
TextLines textLines)
begin - the beginning index of the line to replace, inclusive.end - the ending index of the line to replace, exclusive.textLines - a replacement TextLines object.protected final TextLines sublines(int beginIndex, int endIndex)
beginIndex of the
line and extends to the line at index endIndex-1.beginIndex - the beginning index of the line, inclusive.endIndex - the ending index of the line, exclusive.protected final java.awt.Dimension doLayoutForEmpty(int width,
int lineWrap)
width - the width to lay out.lineWrap - the line wrapping style.protected final void changeRemainWidths(int diff)
protected final int reComputeRemainWidths(int width)
protected final int duplicateLastLine(int width,
int lineTop,
boolean endWithBreak)
protected final TextPositionInfo getIncompleteTextPositionNearby(TextPositionInfo posInfo, int textIndex)
posInfo - the text position information used as the
starting point for searching. If null, the
searching starts from the beginning or ending
of the layout according to the index of the text.textIndex - the index of the text to search for.null,
if this layout does not have a valid layout.protected final TextPositionInfo getIncompleteTextPositionNearby(TextPositionInfo posInfo, java.awt.Point point)
posInfo - the text position information used as the
starting point for searching. If null, the
searching starts from the top or bottom of
the layout according to the location.point - the location to search for.null,
if this layout does not have a valid layout.public final int getLineIndexNearby(TextPositionInfo posInfo, int textIndex)
posInfo - the text position information used as the
starting point for searching. If null, the
searching starts from the beginning or ending
of the layout according to the index of
the text.textIndex - the index of the text to search for.-1 if this text lines does
not have a valid layout.protected final int getLineIndexNearby(TextPositionInfo posInfo, int textIndex, int textLength)
posInfo - the text position information used as the
starting point for searching. If null, the
searching starts from the beginning or ending
of the layout according to the index of the text.textIndex - the index of the text to search for.textLength - the length of the text.-1 if this text lines does
not have a valid layout.public final int getLineIndexNearby(TextPositionInfo posInfo, java.awt.Point point)
posInfo - the text position information used as the
starting point for searching. If null, the
searching starts from the top or bottom of
the layout according to the location.point - the location to search for.-1 if this text lines does
not have a valid layout.protected final int markLineBegin(int lineBegin,
boolean isParagraphMark)
protected final int unmarkLineBegin(int lineBegin)
protected final boolean isParagraphMark(int lineBegin)
public void printDebugInfo()
System.out.
This method is used for DEBUG.protected final void assert(boolean b)
true.