|
Eclipse Draw2d 3.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.draw2d.Figure
org.eclipse.draw2d.text.FlowFigure
org.eclipse.draw2d.text.InlineFlow
org.eclipse.draw2d.text.TextFlow
public class TextFlow
An inline flow figure that renders a string of text across one or more lines.
A TextFlow cannot contain children. All InlineFlow
figure's must
be parented by a FlowFigure
.
WARNING: This class is not intended to be subclassed by clients.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure |
---|
Figure.FigureIterator, Figure.IdentitySearch |
Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure |
---|
IFigure.NoInsets |
Field Summary |
---|
Fields inherited from class org.eclipse.draw2d.text.FlowFigure |
---|
selectionStart |
Fields inherited from class org.eclipse.draw2d.Figure |
---|
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip |
Fields inherited from interface org.eclipse.draw2d.IFigure |
---|
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS |
Constructor Summary | |
---|---|
TextFlow()
Constructs a new TextFlow with the empty String. |
|
TextFlow(java.lang.String s)
Constructs a new TextFlow with the specified String. |
Method Summary | |
---|---|
boolean |
addLeadingWordRequirements(int[] width)
Returns the width of the text until the first line-break. |
protected void |
contributeBidi(BidiProcessor proc)
A TextFlow contributes its text. |
protected FlowFigureLayout |
createDefaultFlowLayout()
Creates the default layout manager |
BidiInfo |
getBidiInfo()
Returns the BidiInfo for this figure or null . |
protected java.lang.String |
getBidiSubstring(TextFragmentBox box,
int index)
|
CaretInfo |
getCaretPlacement(int offset,
boolean trailing)
Returns the CaretInfo in absolute coordinates. |
int |
getFirstOffsetForLine(int baseline)
Returns the minimum character offset which is on the given baseline y-coordinate. |
protected FlowUtilities |
getFlowUtilities()
Gets the FlowUtilities instance to be used in measurement
calculations. |
protected java.util.List |
getFragmentsWithoutBorder()
Returns the TextFragmentBox fragments contained in this
TextFlow, not including the border fragments. |
int |
getLastOffsetForLine(int baseline)
Returns the maximum offset for a character which is on the given baseline y-coordinate. |
int |
getNextOffset(Point p,
boolean down,
int[] trailing)
Returns the offset nearest the given point either up or down one line. |
int |
getNextVisibleOffset(int offset)
Returns the next offset which is visible in at least one fragment or -1 if there is not one. |
int |
getOffset(Point p,
int[] trailing,
Dimension proximity)
Returns the offset of the character directly below or nearest the given location. |
int |
getPreviousVisibleOffset(int offset)
Returns the previous offset which is visible in at least one fragment or -1 if there is not one. |
java.lang.String |
getText()
|
protected TextUtilities |
getTextUtilities()
Gets the TextUtilities instance to be used in measurement
calculations. |
boolean |
isTextTruncated()
Returns true if a portion if the text is truncated using
ellipses ("..."). |
protected void |
paintFigure(Graphics g)
Paints this Figure's primary representation, or background. |
protected void |
paintSelection(Graphics graphics)
Renders the XOR selection rectangles to the graphics. |
protected void |
paintText(Graphics g,
java.lang.String draw,
int x,
int y,
int bidiLevel)
|
void |
setBidiInfo(BidiInfo info)
Sets the bidi information for this figure. |
void |
setSelection(int start,
int end)
Sets the extent of selection. |
void |
setText(java.lang.String s)
Sets the text being displayed. |
java.lang.String |
toString()
|
Methods inherited from class org.eclipse.draw2d.text.InlineFlow |
---|
containsPoint, getFragments, paintBorder, postValidate, setBorder |
Methods inherited from class org.eclipse.draw2d.text.FlowFigure |
---|
add, remove, revalidateBidi, setBounds, setFlowContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TextFlow()
Object.Object()
public TextFlow(java.lang.String s)
s
- the stringMethod Detail |
---|
public boolean addLeadingWordRequirements(int[] width)
addLeadingWordRequirements
in class InlineFlow
width
- the width before the next line-break (if one's found; all the
width, otherwise) will be added on to the first int in the
given array
FlowFigure.addLeadingWordRequirements(int[])
protected void contributeBidi(BidiProcessor proc)
contributeBidi
in class FlowFigure
proc
- the BidiProcessor to which contributions should be madeFlowFigure.contributeBidi(org.eclipse.draw2d.text.BidiProcessor)
protected FlowFigureLayout createDefaultFlowLayout()
FlowFigure
createDefaultFlowLayout
in class InlineFlow
InlineFlow.createDefaultFlowLayout()
public BidiInfo getBidiInfo()
null
.
null
or the infoprotected java.lang.String getBidiSubstring(TextFragmentBox box, int index)
box
- which fragmentindex
- the fragment index
public CaretInfo getCaretPlacement(int offset, boolean trailing)
offset
- the location in this figure's texttrailing
- true if the caret is being placed after the offset
java.lang.IllegalArgumentException
- If the offset is not between 0
and the length
of the string inclusivelypublic int getFirstOffsetForLine(int baseline)
-1
is returned.
baseline
- the relative baseline coordinate
protected java.util.List getFragmentsWithoutBorder()
TextFragmentBox
fragments contained in this
TextFlow, not including the border fragments. The returned list should
not be modified.
public int getLastOffsetForLine(int baseline)
-1
is returned.
baseline
- the relative baseline coordinate
public int getNextOffset(Point p, boolean down, int[] trailing)
trailing[0]
will be set
to 1 if the reference point is closer to the trailing edge of the offset
than it is to the leading edge.
p
- a reference pointdown
- true
if the search is downtrailing
- an int array
-1
public int getNextVisibleOffset(int offset)
offset
- the reference offset
public int getOffset(Point p, int[] trailing, Dimension proximity)
null
, the result may also be -1
if no offset
was found within the proximity.
For a typical character, the trailing argument will be filled in to indicate whether the point is closer to the leading edge (0) or the trailing edge (1). When the point is over a cluster composed of multiple characters, the trailing argument will be filled with the position of the character in the cluster that is closest to the point.
If the proximity argument is not null
, then the location may
be no further than the proximity given. Passing null
is
equivalent to passing new
Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)
. The
width
field of the proximity will contain the horizontal
distance, height
will contain vertical. Vertical proximity
is more important than horizontal. The returned offset is the lowest
index with minimum vertical proximity not exceeding the given limit, with
horizontal proximity not exceeding the given limit. If an offset that is
within the proximity is found, then the given Dimension
will
be updated to reflect the new proximity.
p
- the point relative to this figuretrailing
- the trailing bufferproximity
- restricts and records the distance of the returned offset
public int getPreviousVisibleOffset(int offset)
getNextVisibleOffset(int)
for more.
offset
- a reference offset
public java.lang.String getText()
null
public boolean isTextTruncated()
true
if a portion if the text is truncated using
ellipses ("...").
true
if the text is truncated with ellipsesprotected void paintFigure(Graphics g)
Figure
Figure.paintClientArea(Graphics)
and
Figure.paintBorder(Graphics)
. Furthermore, it is safe to call
graphics.restoreState()
within this method, and doing so
will restore the graphics to its original state upon entry.
paintFigure
in class Figure
g
- The Graphics used to paintFigure.paintFigure(Graphics)
protected void paintSelection(Graphics graphics)
InlineFlow
paintSelection
in class InlineFlow
graphics
- the graphics to paint onInlineFlow.paintSelection(org.eclipse.draw2d.Graphics)
protected void paintText(Graphics g, java.lang.String draw, int x, int y, int bidiLevel)
public void setBidiInfo(BidiInfo info)
FlowFigure
FlowFigure.contributeBidi(BidiProcessor)
. If the figure contributes
text associated with it, this method is called back to indicate the bidi
properties for that text within its block.
setBidiInfo
in class FlowFigure
info
- the BidiInfo for this figureFlowFigure.setBidiInfo(org.eclipse.draw2d.text.BidiInfo)
public void setSelection(int start, int end)
setSelection
in class FlowFigure
start
- the start offsetend
- the end offsetpublic void setText(java.lang.String s)
null
.
s
- The new textpublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
protected FlowUtilities getFlowUtilities()
FlowUtilities
instance to be used in measurement
calculations.
FlowUtilities
instanceprotected TextUtilities getTextUtilities()
TextUtilities
instance to be used in measurement
calculations.
TextUtilities
instance
|
Eclipse Draw2d 3.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |