|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.IlvGraphic
ilog.views.graphic.IlvText
public class IlvText
IlvText represents a customizable multiline text label.
An IlvText instance supports word wrapping and truncation. You
can add a background rectangle with margins around the bounding box of the
text label.
The default values for an IlvText instance are as
follows:
IlvPoint(0, 0)IlvConstants.LEADINGIlvToolkit.defaultFontColor.blackfalseColor.grayfalseColor.blackfalseIlvText.WRAP_NONE100100-1IlvConstants.LEADING0000
The following code example shows how to use an IlvText in a
simple Java application:
IlvManager manager = new IlvManager();
IlvText myDefaultText = new IlvText(new IlvPoint(10,20), "Default text");
IlvText myCustomText = new IlvText(new IlvPoint(60,60), "My Custom\ntext");
myCustomText.setFillOn(true);
IlvRect textShape = myCustomText.boundingBox();
myCustomText.setFillPaint(
new GradientPaint(
new Point(textShape.xFloor(),
textShape.yFloor()),
Color.yellow,
new Point(textShape.xFloor() + textShape.widthFloor(),
textShape.yFloor() + textShape.heightFloor()),
Color.red));
myCustomText.setStrokeOn(true);
myCustomText.setStrokeColor(Color.blue);
myCustomText.setAlignment(IlvConstants.CENTER);
myCustomText.setFont(new Font("SansSerif", Font.BOLD, 14));
myCustomText.setForeground(Color.green);
myCustomText.setUnderline(true);
myCustomText.setInterlineSpacing(4);
myCustomText.setLeftMargin(20);
myCustomText.setRightMargin(20);
myCustomText.setBottomMargin(20);
myCustomText.setTopMargin(20);
manager.addObject( myDefaultText, true);
manager.addObject( myCustomText, true);
The following image shows the graphic objects created in the code example:
>
IlvText is a custom graphic object, that is, a subclass of
IlvGraphic. Graphic objects are controlled using an
IlvManager instance and displayed using one or more
IlvManagerView instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.
IlvRect,
IlvManager,
IlvManagerView,
IlvConstants,
Serialized Form| Nested Class Summary | |
|---|---|
static class |
IlvText.Editor
This is the text editor of IlvText. |
| Field Summary | |
|---|---|
static short |
OUTLINE_BACK
Outline mode that the text draws first its text and then its outline. |
static short |
OUTLINE_DISABLED
Outline mode that the text does not draw its outline. |
static short |
OUTLINE_FRONT
Outline mode that the text draws its outline after drawing its text. |
static short |
OUTLINE_ONLY
Outline mode that the text draws only its outline. |
static short |
WRAP_NONE
The text is fully displayed and breaking lines only occurs where the text explicitly contains line break characters. |
static short |
WRAP_TRUNCATE
This text is broken into several lines at line break characters and an ellipsis is added to the end of each line such that the text fits the getWrappingHeight() height
and getWrappingWidth() width. |
static short |
WRAP_WORD
This text is broken into several lines at line break characters and additional line break occurs such that the text best fit the getWrappingWidth() width. |
| Constructor Summary | |
|---|---|
IlvText()
Creates a new IlvText instance with (0, 0)
as anchor point and an empty text. |
|
IlvText(IlvInputStream stream)
This build an IlvText instance from an IlvInputStream. |
|
IlvText(IlvPoint anchor,
String text)
Creates a new IlvText instance with a specified anchor point. |
|
IlvText(IlvText source)
This build an IlvText instance equivalent to the source
one. |
|
| Method Summary | |
|---|---|
protected Paint |
adaptPaint(Shape shape,
Paint paint)
Returns a new Paint object that will fit the shape parameter
according to the initial paint parameter. |
void |
addLabelAttribute(AttributedCharacterIterator.Attribute attribute,
Object value)
This convenience method allows you to modify a text attribute of the label. |
void |
addLabelAttribute(AttributedCharacterIterator.Attribute attribute,
Object value,
int beginIndex,
int endIndex)
This convenient method allows you to modify a text attribute of the label. |
void |
addLabelAttributes(Map attributes,
int beginIndex,
int endIndex)
This convenient method allows you to modify a text attribute of the label. |
void |
applyTransform(IlvTransformer t)
Applies an additional transformation to the rendering of the IlvText. |
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the IlvText. |
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the object. |
IlvGraphic |
copy()
Returns a copy of the IlvText instance. |
void |
draw(Graphics dst,
IlvTransformer t)
Draws the IlvText object. |
int |
getAlignment()
Return the alignment of the multilines text. |
IlvPoint |
getAnchorPoint()
Returns the anchor point for the text. |
int |
getAnchorPosition()
Returns the anchor position for the text. |
AttributedString |
getAttributedLabel()
Returns the attributed text that will be displayed by the IlvText. |
float |
getBottomMargin()
Returns the bottom margin of the box around the text. |
Shape |
getCaretShape(IlvTextSelection.Range range,
IlvTransformer t)
This method is called to get the shape enveloping the characters specified by the Range. |
IlvPoint |
getEffectiveAnchorPoint()
Returns the effective anchor point. |
Paint |
getFillPaint()
Returns the Paint object used to fill the background
rectangle. |
Font |
getFont()
Returns the Font used to draw the IlvText. |
Color |
getForeground()
Returns the foreground color of object, i.e the color used to draw the text itself. |
float |
getInterlineSpacing()
Returns the interline spacing used when the text is displayed as several lines. |
String |
getLabel()
Returns the label that will be displayed by the IlvText. |
IlvRect |
getLabelBBox(IlvTransformer t)
Returns the bounding rectangle of the text part of the IlvText. |
float |
getLeftMargin()
Returns the left margin of the box around the text. |
Color |
getOutlineColor()
Returns the outline color of the text. |
int |
getOutlineMode()
Returns the outline mode. |
float |
getOutlineThickness()
Returns the outline thickness of the text. |
float |
getRightMargin()
Returns the right margin of the box around the text. |
float |
getRotationAlignmentAngle()
Returns the rotation alignment angle. |
float |
getRotationAlignmentThresholdAngle()
Returns the threshold angle that decides whether a rotated multiline text object is aligned parallel to the rotation alignment axis, or perpendicular to the rotation alignment axis. |
Color |
getStrokeColor()
Returns the stroke color of the object, i.e the color used to draw the stroke around the background rectangle. |
float |
getTopMargin()
Returns the top margin of the box around the text. |
IlvTransformer |
getTransformer()
Returns the internal transformation used to draw the label in addition to the IlvManagerView transformation. |
float |
getWrappingHeight()
Returns the IlvText wrapping height. |
short |
getWrappingMode()
Returns the wrapping status of the text. |
float |
getWrappingWidth()
Returns the IlvText wrapping width. |
boolean |
isAntialiasing()
Returns true if the anti-aliasing mode
of the label is on. |
boolean |
isAutoWrappingSizeMode()
Returns the auto resize mode. |
boolean |
isFillOn()
Returns true if the background rectangle
of the text is drawn. |
boolean |
isFractionalMetrics()
Returns true if the fractional metrics mode
of the text is on. |
boolean |
isPaintAbsolute()
Returns false if the TexturePaint or
GradientPaint will be adapted to the bounding rectangle of the
object. |
boolean |
isStrikethrough()
Returns true if the entire text has strikethrough attribute. |
boolean |
isStrokeOn()
Returns true if the frame of the background rectangle
of the text is drawn. |
static boolean |
IsTransformerDependentRendering()
Returns whether all IlvText objects are rendered with
a strategy that requires re-rendering when the transformer changes. |
boolean |
isUnderline()
Returns true if the entire text has underline attribute. |
int |
lineCount()
Returns the line count for a multiline text. |
int |
lineOffset(int index)
For a multiline label, you need to know the start offset for a specified line. |
IlvSelection |
makeSelection()
Create an IlvTextSelection. |
void |
moveResize(IlvRect size)
Resizes the object. |
int |
pickCharacter(IlvPoint click,
IlvTransformer t)
This method is called when a user is clicking on the label to hit-test which character is clicked. |
void |
resize(float neww,
float newh)
Resizes the object. |
void |
setAlignment(int alignment)
Changes the alignment of the multilines text. |
void |
setAnchorPoint(IlvPoint anchor)
Sets the anchor point for the text. |
void |
setAnchorPosition(int position)
Sets the anchor position for the text. |
void |
setAntialiasing(boolean set)
Changes the anti-aliasing mode of the text. |
void |
setAttributedLabel(AttributedString label)
Sets the attributed text that will be displayed by the IlvText. |
void |
setAutoWrappingSizeMode(boolean value)
Sets the auto wrapping size mode. |
void |
setBackground(Color c)
Changes the background color of the object, i.e the color used to fill the background rectangle. |
void |
setBottomMargin(float margin)
Sets the bottom margin of the box around the text. |
void |
setFillOn(boolean value)
Changes the visibility of the background rectangle of the text. |
void |
setFillPaint(Paint paint)
Changes the background Paint of the object, i.e the
paint server used to fill the background rectangle. |
void |
setFont(Font font)
Sets the Font used to draw the entire IlvText. |
void |
setForeground(Color c)
Changes the foreground color of the object, i.e the color used to draw the text itself. |
void |
setFractionalMetrics(boolean set)
Changes the fractional metrics mode of the text. |
void |
setInterlineSpacing(float spacing)
Sets the interline spacing used when the text is displayed as several lines. |
void |
setLabel(String label)
Sets the label that will be displayed by the IlvText. |
void |
setLeftMargin(float margin)
Sets the left margin of the box around the text. |
void |
setOutlineColor(Color c)
Changes the outline color of the text. |
void |
setOutlineMode(int mode)
Sets the outline mode. |
void |
setOutlineThickness(float thickness)
Changes the outline thickness of the text. |
void |
setPaintAbsolute(boolean set)
When set to false, specifies that the
TexturePaint or GradientPaint will be adapted to
the bounding rectangle of the object. |
void |
setRightMargin(float margin)
Sets the right margin of the box around the text. |
void |
setRotationAlignmentAngle(float angle)
Sets the rotation alignment angle. |
void |
setRotationAlignmentThresholdAngle(float angle)
Sets the threshold angle that decides whether a rotated multiline text object is aligned parallel to the rotation alignment axis, or perpendicular to the rotation alignment axis. |
void |
setStrikethrough(boolean set)
Changes the strikethrough attribute of the entire text. |
void |
setStrokeColor(Color c)
Changes the stroke color of the object, i.e the color used to draw the stroke around the background rectangle. |
void |
setStrokeOn(boolean value)
Changes the visibility of the stroke of the background rectangle. |
void |
setTopMargin(float margin)
Sets the top margin of the box around the text. |
static void |
SetTransformerDependentRendering(boolean flag)
Sets whether all IlvText objects are rendered with
a strategy that requires re-rendering when the transformer changes. |
void |
setUnderline(boolean set)
Changes the underline attribute of the entire text. |
void |
setWrappingHeight(float height)
Sets the IlvText wrapping height. |
void |
setWrappingMode(short value)
Changes the wrapping mode of the text. |
void |
setWrappingWidth(float width)
Sets the IlvText wrapping width. |
boolean |
supportMultiline()
Always returns true for IlvText. |
void |
translate(float dx,
float dy)
Translates the object. |
void |
write(IlvOutputStream stream)
Writes the contents of the IlvText to an IVL file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final short OUTLINE_ONLY
setOutlineMode(int),
getOutlineMode(),
Constant Field Valuespublic static final short OUTLINE_FRONT
setOutlineMode(int),
getOutlineMode(),
Constant Field Valuespublic static final short OUTLINE_BACK
setOutlineMode(int),
getOutlineMode(),
Constant Field Valuespublic static final short OUTLINE_DISABLED
setOutlineMode(int),
getOutlineMode(),
Constant Field Valuespublic static final short WRAP_NONE
setWrappingMode(short),
Constant Field Valuespublic static final short WRAP_WORD
getWrappingWidth() width.
setWrappingMode(short),
Constant Field Valuespublic static final short WRAP_TRUNCATE
getWrappingHeight() height
and getWrappingWidth() width.
Note: In this mode, the text can be selected but cannot be edited in place by
using the new IlvTextSelection introduced since JViews 7.5. However the
text can still be edited by the
IlvEditLabelInteractor.
setWrappingMode(short),
Constant Field Values| Constructor Detail |
|---|
public IlvText()
IlvText instance with (0, 0)
as anchor point and an empty text.
IlvText(IlvPoint, String)
public IlvText(IlvPoint anchor,
String text)
IlvText instance with a specified anchor point.
anchor - the anchor point in manager coordinates.text - the text to be displayed.setAnchorPoint(IlvPoint),
setAnchorPosition(int),
setLabel(String)public IlvText(IlvText source)
IlvText instance equivalent to the source
one.
source - The IlvText to be copied.
public IlvText(IlvInputStream stream)
throws IlvReadFileException
IlvText instance from an IlvInputStream.
stream - the input stream
IlvReadFileException - if the format is not correct.| Method Detail |
|---|
public IlvGraphic copy()
IlvText instance.
copy in class IlvGraphicIlvGraphic instance.IlvGraphic
public void draw(Graphics dst,
IlvTransformer t)
IlvText object.
draw in class IlvGraphicdst - The destination Graphics.t - The view transformation used to draw the object.IlvGraphic.boundingBox(ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic final IlvTransformer getTransformer()
IlvManagerView transformation. When
applyTransform(IlvTransformer) is called its parameter
transformer is concatenated to this transformer. The returned value may
be null if no transformer has been applied.
public IlvRect boundingBox(IlvTransformer t)
IlvText.
boundingBox in class IlvGraphict - The view transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic void applyTransform(IlvTransformer t)
IlvText.
This can be used to rotate or scale the text.
applyTransform in class IlvGraphict - The transformer to be applied.IlvGraphicpublic void moveResize(IlvRect size)
isAutoWrappingSizeMode() is false this method
calls IlvGraphic.moveResize(IlvRect); otherwise it translates the
internal transformer (getTransformer()) so that the effective
anchor is at the new position and adapts the wrapping width
and height according the size rectangle.
moveResize in class IlvGraphicsize - The new bounding rectangle of the object.setWrappingWidth(float),
setWrappingHeight(float),
getEffectiveAnchorPoint()
public void translate(float dx,
float dy)
isAutoWrappingSizeMode() is false this method
calls IlvGraphic.translate(float, float); otherwise it translates
the internal transformer (getTransformer()) so that the effective
anchor is at the new position.
translate in class IlvGraphicdx - The horizontal translation factor.dy - The vertical translation factor.IlvGraphic,
IlvGraphic.applyTransform(IlvTransformer)
public void resize(float neww,
float newh)
isAutoWrappingSizeMode() is false this method calls
IlvGraphic.resize(float, float) otherwise it changes the
wrapping width (setWrappingWidth(float)) and height
(setWrappingHeight(float))
according the given scaling factors.
resize in class IlvGraphicneww - The new widthnewh - The new heightIlvGraphic,
IlvGraphic.applyTransform(IlvTransformer)public final void setAnchorPoint(IlvPoint anchor)
getTransformer()) the text
will be attached to.
anchor - the anchor point.setAnchorPosition(int)public final IlvPoint getAnchorPoint()
getTransformer()) the text
is attached to.
getAnchorPosition()public final IlvPoint getEffectiveAnchorPoint()
getAnchorPoint() is the
anchor of the untransformed text object. However as soon as the text
object is moved or reshaped, the text object is transformed.
This method returns the anchor point while respecting this transformation.
The meaning of the anchor point depends on the font and on the string
displayed in the text. For instance for Latin based fonts with
western European text (English, French, German etc., i.e. text with
left-to-right orientation), the effective anchor point specifies:
IlvConstants.LEFT or
IlvConstants.LEADING. If the text is multiline text
and the lines have different widths, the maximum width of all lines
defines the corners of each line.
IlvConstants.RIGHT or
IlvConstants.TRAILING. If the text is multiline text
and the lines have different widths, the maximum width of all lines
defines the corners of each line.
IlvConstants.CENTER.
public final void setAnchorPosition(int position)
position - the anchor position. One of the following values:
IlvConstants.LEFT: the anchor point is at the left side
of the first line of the text.
IlvConstants.RIGHT: the anchor point is at the right side
of the first line of the text.
IlvConstants.CENTER: the anchor point is at the center of
the text.
IlvConstants.LEADING: the anchor point is at the leading
edge of the first line of the text (the default).
IlvConstants.TRAILING: the anchor points is at the
trailing edge of the first line of the text.
setAnchorPoint(IlvPoint)public final int getAnchorPosition()
IlvConstants.LEFT: the anchor point is at the left side
of the first line of the text.
IlvConstants.RIGHT: the anchor point is at the right side
of the first line of the text.
IlvConstants.CENTER: the anchor point is at the center of
the text.
IlvConstants.LEADING: the anchor point is at the leading
edge of the first line of the text (the default).
IlvConstants.TRAILING: the anchor points is at the
trailing edge of the first line of the text.
setAnchorPoint(IlvPoint)public void setLabel(String label)
IlvText. If the
label contains line breaking characters ('\n') it will be
displayed on several lines.
Depending on the value of getWrappingMode() the text will be
drawn differently.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
setLabel in interface IlvLabelInterfacelabel - the new label.public String getLabel()
IlvText.
This method returns the label even if it was set via
setAttributedLabel(java.text.AttributedString).
getLabel in interface IlvLabelInterfacesetLabel(String)public void setAttributedLabel(AttributedString label)
IlvText. If the text contains line breaking characters
('\n') it will be displayed on several lines.
Depending on the value of getWrappingMode() the text will be
drawn differently.
All text attributes can be used. However, the label is assumed to be
unidirectional, that is, Bidi changes (for example, mixing LTR orientation with
RTL orientation) inside the same label are not supported.
Partial font attributes (such as TextAttribute.WEIGHT) cannot
be specified individually, since the font specification overrides them,
but it is possible to specify the full TextAttribute.FONT
attribute for selected parts of the string.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
label - the new label.TextAttributepublic AttributedString getAttributedLabel()
IlvText.
If you modify the attributes of the returned attributed text, you need
to call setAttributedLabel(java.text.AttributedString) again so that the new attributes
become valid. A more comfortable way is to modify the text attributes
via addLabelAttribute(java.text.AttributedCharacterIterator.Attribute, Object, int, int).
setAttributedLabel(AttributedString),
addLabelAttribute(java.text.AttributedCharacterIterator.Attribute, Object),
addLabelAttribute(java.text.AttributedCharacterIterator.Attribute, Object, int, int),
addLabelAttributes(Map, int, int)
public void addLabelAttribute(AttributedCharacterIterator.Attribute attribute,
Object value)
AttributedString.addAttribute(java.text.AttributedCharacterIterator.Attribute, Object).
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
attribute - The attribute key.value - The value of the attribute; may be null.
IllegalArgumentException - if the AttributedString has length 0.
(attributes cannot be applied to a 0-length range).addLabelAttribute(java.text.AttributedCharacterIterator.Attribute, Object, int, int),
TextAttribute
public void addLabelAttribute(AttributedCharacterIterator.Attribute attribute,
Object value,
int beginIndex,
int endIndex)
AttributedString.addAttribute(java.text.AttributedCharacterIterator.Attribute, Object, int, int).
For instance, in order to create a text label and underline the 3th and 4th character of the label, call
IlvText text = new IlvText(new IlvPoint(0,0), "ABCDEFG");
text.addLabelAttribute(TextAttribute.UNDERLINE,
TextAttribute.UNDERLINE_ON,
3, 5);
All text attributes can be used. However, the label is assumed to be
unidirectional, that is, Bidi changes (for example, mixing LTR orientation with
RTL orientation) inside the same label are not supported.
Partial font attributes (such as TextAttribute.WEIGHT) cannot
be specified individually, since the font specification overrides them,
but it is possible to specify the full TextAttribute.FONT
attribute for selected parts of the string.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
attribute - The attribute key.value - The value of the attribute; may be null.beginIndex - Index of the first character of the range.endIndex - Index of the character following the last character
of the range.
IllegalArgumentException - if beginIndex is less then 0, endIndex
is greater than the length of the string, or beginIndex and
endIndex together don't define a non-empty subrange of the
string.TextAttribute
public void addLabelAttributes(Map attributes,
int beginIndex,
int endIndex)
AttributedString.addAttributes(Map, int, int).
All text attributes can be used. However, the label is assumed to be
unidirectional, that is Bidi changes (for example, mixing LTR orientation with
RTL orientation) inside the same label are not supported.
Partial font attributes (such as TextAttribute.WEIGHT) cannot
be specified individually, since the font specification overrides them,
but it is possible to specify the full TextAttribute.FONT
attribute for selected parts of the string.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
attributes - The attributes to be added to the string.beginIndex - Index of the first character of the range.endIndex - Index of the character following the last
character of the range.
IllegalArgumentException - if beginIndex is less then 0, endIndex
is greater than the length of the string, or beginIndex and
endIndex together don't define a non-empty subrange of the
string and the attributes parameter is not an empty Map.addLabelAttribute(java.text.AttributedCharacterIterator.Attribute, Object, int, int),
TextAttributepublic boolean supportMultiline()
true for IlvText.
supportMultiline in interface IlvLabelInterfacepublic IlvRect getLabelBBox(IlvTransformer t)
IlvText.
It is equivalent to the boundingBox(IlvTransformer) without the margins.
getLabelBBox in interface IlvLabelInterfacet - the transformer used to draw the graphic object.public void setFont(Font font)
Font used to draw the entire IlvText.
If an attributed string label is used, the local attributes on the attributed string dominate, i.e. set font is only set to those characters of the attributed string that don't have any local font attribute.
setFont in interface IlvFontInterfacefont - The new font.setAttributedLabel(java.text.AttributedString)public Font getFont()
Font used to draw the IlvText.
getFont in interface IlvFontInterfacepublic final boolean isAntialiasing()
true if the anti-aliasing mode
of the label is on. The default value is false.
public final void setAntialiasing(boolean set)
false.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
public final boolean isStrikethrough()
true if the entire text has strikethrough attribute.
The default value is false.
public final void setStrikethrough(boolean set)
false.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
If an attributed string label is used, the local attributes on the attributed string dominate, that is strikethrough is only performed on those characters of the attributed string that don't have any strikethrough attribute.
setAttributedLabel(java.text.AttributedString)public final boolean isUnderline()
true if the entire text has underline attribute.
The default value is false.
public final void setUnderline(boolean set)
false.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
If an attributed string label is used, the local attributes on the attributed string dominate, that is underlining is only performed on those characters of the attributed string that don't have any underline attribute.
setAttributedLabel(java.text.AttributedString)public int getOutlineMode()
OUTLINE_DISABLED,
OUTLINE_ONLY, OUTLINE_FRONT, and OUTLINE_BACK.setOutlineMode(int)public void setOutlineMode(int mode)
mode - Must be one of the following values: OUTLINE_DISABLED,
OUTLINE_ONLY, OUTLINE_FRONT, and OUTLINE_BACK.getOutlineMode()public final boolean isFractionalMetrics()
true if the fractional metrics mode
of the text is on. The default value is true, setting
it to false will speed up the IlvText but may
lead to less precise text positioning.
public final void setFractionalMetrics(boolean set)
true, setting it to false will speed up the
IlvText but may lead to less precise text positioning.
Note that this may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify this flag
using the applyToObject method of the manager.
public void setForeground(Color c)
setForeground in class IlvGraphicc - The new color.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setBackground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic Color getForeground()
Color.BLACK.
public void setOutlineColor(Color c)
c - The new outline color.public Color getOutlineColor()
Color.BLACK.
public void setBackground(Color c)
setFillPaint(java.awt.Paint).
setBackground in class IlvGraphicc - The new color.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setForeground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic void setFillPaint(Paint paint)
Paint of the object, i.e the
paint server used to fill the background rectangle.
paint - the new Paint object.public Paint getFillPaint()
Paint object used to fill the background
rectangle. The default value is Color.GRAY.
setFillPaint(java.awt.Paint)
protected Paint adaptPaint(Shape shape,
Paint paint)
Paint object that will fit the shape parameter
according to the initial paint parameter.
This method is called only if isPaintAbsolute() returns
false.
By default, it deals with GradientPaint and
TexturePaint instances to adapt them correctly because they
do not automatically fit the shape of the object on which they are drawn.
You can override this method to manage your own Paint
subclasses if they do not take the shape of the object into account. You
will generally call the superclass method for GradientPaint
and TexturePaint instances.
Other Paint objects deriving from
IlvMultipleGradientPaint automatically take into
account the shape of the object if their
IlvMultipleGradientPaint.isAdapting() method
returns true and thus are not modified by this method.
shape - The shape parameter that the returned Paint
should fit.paint - The initial Paint object.isPaintAbsolute()public final boolean isPaintAbsolute()
false if the TexturePaint or
GradientPaint will be adapted to the bounding rectangle of the
object. The default value is false. This value does not
affect automatically adjusted Paint such as
ilog.views.util.java2d.IlvLinearGradientPaint.
setPaintAbsolute(boolean),
setFillPaint(java.awt.Paint),
adaptPaint(java.awt.Shape, java.awt.Paint)public final void setPaintAbsolute(boolean set)
false, specifies that the
TexturePaint or GradientPaint will be adapted to
the bounding rectangle of the object.
The default value is false. This value does not affect
automatically adjusted Paint such as
ilog.views.util.java2d.IlvLinearGradientPaint.
isPaintAbsolute(),
setFillPaint(java.awt.Paint),
adaptPaint(java.awt.Shape, java.awt.Paint)public final void setFillOn(boolean value)
setFillOn in class IlvGraphicvalue - true if fill is on.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setBackground(Color),
IlvGraphic.setForeground(Color),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic final boolean isFillOn()
true if the background rectangle
of the text is drawn.
setFillPaint(java.awt.Paint),
setFillOn(boolean)public final void setStrokeOn(boolean value)
setStrokeOn in class IlvGraphicvalue - true if stroke is on.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setBackground(Color),
IlvGraphic.setForeground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphicpublic final boolean isStrokeOn()
true if the frame of the background rectangle
of the text is drawn.
setStrokeColor(Color),
setStrokeOn(boolean)public final void setStrokeColor(Color c)
c - The new color.getStrokeColor()public final Color getStrokeColor()
getForeground().
public final void setAutoWrappingSizeMode(boolean value)
false.
When set to true subsequent calls to moveResize(IlvRect),
resize(float, float) and translate(float, float) instead
of calling applyTransform(IlvTransformer) will change the anchor
point and the wrapping width and height to match as much as possible the
given size. In that case the resulting size of the IlvText may
not exactly be the given size if the text doesn't require that much size
to be displayed or margins require more room.
value - true if the auto wrapping size mode is needed.getWrappingWidth(),
getWrappingHeight(),
getAnchorPoint()public final boolean isAutoWrappingSizeMode()
false.
setAutoWrappingSizeMode(boolean)public final void setWrappingMode(short value)
IlvText.WRAP_NONE.
value - One of the following values or a combination:
IlvText.WRAP_NONE : the text is displayed as-is.
IlvText.WRAP_WORD : the text is automatically broken into
lines using a line instance java.text.BreakIterator which will
break the text where appropriate to best fit the getWrappingWidth()
width. For example in latin languages this will break the text at white
spaces. To prevent the text from being broken at a particular white space
you should use the unicode non-breaking white space (' ').
IlvText.WRAP_TRUNCATE : the text is automatically truncated
such that it fits the getWrappingHeight() height and the
getWrappingWidth() width. An ellipsis is added at the end of the
truncated line.